GoodsDTO.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. using FluentValidation;
  2. using OASystem.Domain.Enums;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace OASystem.Domain.Dtos.PersonnelModule
  9. {
  10. /// <summary>
  11. /// 物品DTO
  12. /// </summary>
  13. public class GoodsDto
  14. {
  15. }
  16. #region 物品 DTO
  17. /// <summary>
  18. /// 物品List DTO
  19. /// </summary>
  20. public class GoodsListDto : DtoBase
  21. {
  22. /// <summary>
  23. /// 类型Id
  24. /// 全部类型:""
  25. /// 其他类型:"1,2,3,4,5"
  26. /// </summary>
  27. public string TypeIds { get; set; }
  28. public string GoodsName { get; set; }
  29. }
  30. /// <summary>
  31. /// 物品 OP DTO
  32. /// </summary>
  33. public class GoodsOpDto
  34. {
  35. /// <summary>
  36. /// ID编号
  37. /// ID > 0 Edit
  38. /// ID < 1 Add
  39. /// </summary>
  40. public int Id { get; set; }
  41. /// <summary>
  42. /// 物品名称
  43. /// </summary>
  44. public string Name { get; set; }
  45. /// <summary>
  46. /// 类型
  47. /// </summary>
  48. public int Type { get; set; }
  49. /// <summary>
  50. /// 备注
  51. /// </summary>
  52. public string Remark { get; set; }
  53. }
  54. /// <summary>
  55. /// 物品 OP DTO
  56. /// Validator
  57. /// </summary>
  58. public class GoodsOPDTOValidator : AbstractValidator<GoodsOpDto>
  59. {
  60. /// <summary>
  61. /// 初始化
  62. /// </summary>
  63. public GoodsOPDTOValidator()
  64. {
  65. //RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
  66. RuleFor(x => x.Name).NotEmpty().WithMessage("物品名称为空!");
  67. RuleFor(x => x.Type).Must(x => x > 0).WithMessage("物品所属类型未选择!");
  68. }
  69. }
  70. #endregion
  71. #region 物品入库 DTO
  72. /// <summary>
  73. /// 物品入库List DTO
  74. /// </summary>
  75. public class GoodsStorageListDto : DtoBase
  76. {
  77. /// <summary>
  78. /// 物品Id
  79. /// </summary>
  80. public int GoodsId { get; set; }
  81. /// <summary>
  82. /// 入库批次号
  83. /// </summary>
  84. public string? BatchNo { get; set; }
  85. }
  86. /// <summary>
  87. /// 物品入库 操作(Create Or Edit)
  88. /// </summary>
  89. public class GoodsStorageOpDto
  90. {
  91. /// <summary>
  92. /// ID编号
  93. /// ID > 0 Edit
  94. /// ID < 1 Add
  95. /// </summary>
  96. public int Id { get; set; }
  97. /// <summary>
  98. /// 商品Id
  99. /// </summary>
  100. public int GoodsId { get; set; }
  101. /// <summary>
  102. /// 此次入库数量
  103. /// </summary>
  104. public decimal Quantity { get; set; }
  105. /// <summary>
  106. /// 此次物品单价
  107. /// </summary>
  108. public decimal UnitPrice { get; set; }
  109. /// <summary>
  110. /// 此次物品总价
  111. /// </summary>
  112. public decimal TotalPrice { get; set; }
  113. /// <summary>
  114. /// 此次供应商名称
  115. /// </summary>
  116. public string? SupplierName { get; set; }
  117. /// <summary>
  118. /// 此次供应商电话
  119. /// </summary>
  120. public string? SupplierTel { get; set; }
  121. /// <summary>
  122. /// 此次供应商地址
  123. /// </summary>
  124. public string? SupplierAddress { get; set; }
  125. /// <summary>
  126. /// 此次供应商来源
  127. /// </summary>
  128. public string? SupplierSource { get; set; }
  129. /// <summary>
  130. /// 入库人
  131. /// </summary>
  132. public int StorageUserId { get; set; }
  133. /// <summary>
  134. /// 入库时间
  135. /// eg:2024-10-01 15:00:00
  136. /// </summary>
  137. public string? StorageTime { get; set; }
  138. /// <summary>
  139. /// 备注
  140. /// </summary>
  141. public string? Remark { get; set; }
  142. }
  143. /// <summary>
  144. /// 物品入库 操作(Create Or Edit)
  145. /// Validator
  146. /// </summary>
  147. public class GoodsStorageOpDtoValidator : AbstractValidator<GoodsStorageOpDto>
  148. {
  149. /// <summary>
  150. /// 初始化
  151. /// </summary>
  152. public GoodsStorageOpDtoValidator()
  153. {
  154. //RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
  155. RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
  156. RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
  157. RuleFor(x => x.UnitPrice).Must(x => x > 0).WithMessage("请传入有效的物品单价!");
  158. RuleFor(x => x.TotalPrice).Must(x => x > 0).WithMessage("请传入有效的物品价格合计!");
  159. RuleFor(x => x.StorageUserId).Must(x => x > 0).WithMessage("请传入有效用户Id!");
  160. RuleFor(x => x.StorageTime).NotEmpty().WithMessage("请传入有效的入库时间!");
  161. }
  162. }
  163. #endregion
  164. #region 物品领用
  165. /// <summary>
  166. /// 物品领用List DTO
  167. /// </summary>
  168. public class GoodsReceiveListDTO : DtoBase
  169. {
  170. /// <summary>
  171. /// 物品Id
  172. /// </summary>
  173. public int GoodsId { get; set; }
  174. /// <summary>
  175. /// 物品Name
  176. /// </summary>
  177. public string GoodsName { get; set; }
  178. /// <summary>
  179. /// 开始时间
  180. /// </summary>
  181. public string BeginDt { get; set; }
  182. /// <summary>
  183. /// 结束时间
  184. /// </summary>
  185. public string EndDt { get; set; }
  186. /// <summary>
  187. /// 团组Ids
  188. /// </summary>
  189. public string? GroupLabel { get; set; }
  190. /// <summary>
  191. /// 类型Ids
  192. /// </summary>
  193. public string? TypeLabel { get; set; }
  194. /// <summary>
  195. /// UserIds
  196. /// </summary>
  197. public string? UserLabel { get; set; }
  198. /// <summary>
  199. /// AuditIds
  200. /// </summary>
  201. public string AuditLabel { get; set; }
  202. }
  203. /// <summary>
  204. /// 物品领用 OP DTO
  205. /// </summary>
  206. public class GoodsReceiveOpDto
  207. {
  208. /// <summary>
  209. /// ID
  210. /// Id > 0 修改
  211. /// Id < 1 添加
  212. /// </summary>
  213. public int Id { get; set; }
  214. /// <summary>
  215. /// 团组Id
  216. /// Grp_DelegationInfo Id
  217. /// </summary>
  218. public int GroupId { get; set; }
  219. /// <summary>
  220. /// 商品Id
  221. /// Pm_GoodsInfo Id
  222. /// </summary>
  223. public int GoodsId { get; set; }
  224. /// <summary>
  225. /// 领用数量
  226. /// </summary>
  227. public decimal Quantity { get; set; }
  228. /// <summary>
  229. /// 领用原因
  230. /// </summary>
  231. public string? Reason { get; set; }
  232. /// <summary>
  233. /// 备注
  234. /// </summary>
  235. public string? Remark { get; set; }
  236. }
  237. /// <summary>
  238. /// 物品领用 OP
  239. /// Validator
  240. /// </summary>
  241. public class GoodsReceiveOpDtoValidator : AbstractValidator<GoodsReceiveOpDto>
  242. {
  243. /// <summary>
  244. /// 初始化
  245. /// </summary>
  246. public GoodsReceiveOpDtoValidator()
  247. {
  248. RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
  249. RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
  250. RuleFor(x => x.Reason).NotEmpty().WithMessage("请填写领用原由!");
  251. }
  252. }
  253. /// <summary>
  254. /// 物品领用 Audit DTO
  255. /// </summary>
  256. public class GoodsReceiveAuditDTO
  257. {
  258. /// <summary>
  259. /// 数据ID string
  260. /// 1,2,3,4
  261. /// </summary>
  262. public string Label { get; set; }
  263. /// <summary>
  264. /// 审核状态
  265. /// </summary>
  266. public GoodsAuditEnum AuditEnum { get; set; }
  267. }
  268. /// <summary>
  269. /// 物品领用 Audit
  270. /// Validator
  271. /// </summary>
  272. public class GoodsReceiveAuditDTOValidator : AbstractValidator<GoodsReceiveAuditDTO>
  273. {
  274. /// <summary>
  275. /// 初始化
  276. /// </summary>
  277. public GoodsReceiveAuditDTOValidator()
  278. {
  279. RuleFor(x => x.Label).NotEmpty().WithMessage("数据ID字符串为空!");
  280. }
  281. }
  282. #endregion
  283. }