WCS_PalletizingCode.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. using SqlSugar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using WCS.Data.Utils;
  7. namespace WCS.Data.Models
  8. {
  9. /// <summary>
  10. /// 码垛编号清单
  11. /// </summary>
  12. public class WCS_PalletizingCode
  13. {
  14. /// <summary>
  15. /// 码垛编号(码垛机器人使用)
  16. /// </summary>
  17. [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
  18. public int Id { get; set; }
  19. public int PalletizingNo { get; set; }
  20. /// <summary>
  21. /// 子托盘编号(码垛机器人使用)
  22. /// </summary>
  23. public int PalletizingSonTrayNo { get; set; }
  24. /// <summary>
  25. /// 子托盘编码(WMS中的编码)
  26. /// </summary>
  27. public string PalletizingSonTrayCode { get; set; }
  28. /// <summary>
  29. /// 子托盘尺寸
  30. /// </summary>
  31. public string PalletizingSonTraySize { get; set; }
  32. [SugarColumn(IsIgnore = true)]
  33. public string[] PalletizingSonTraySizeList
  34. {
  35. get
  36. {
  37. return PalletizingSonTraySize.Split('*');
  38. }
  39. }
  40. [SugarColumn(IsIgnore = true)]
  41. public decimal SonTraySizeLength
  42. {
  43. get
  44. {
  45. return Convert.ToDecimal(PalletizingSonTraySizeList[0]);
  46. }
  47. }
  48. [SugarColumn(IsIgnore = true)]
  49. public decimal SonTraySizeLength_Max
  50. {
  51. get
  52. {
  53. decimal maxNum = 0.5M;
  54. return SonTraySizeLength + maxNum;
  55. }
  56. }
  57. [SugarColumn(IsIgnore = true)]
  58. public decimal SonTraySizeLength_Min
  59. {
  60. get
  61. {
  62. decimal minNum = 0.5M;
  63. return SonTraySizeLength - minNum;
  64. }
  65. }
  66. [SugarColumn(IsIgnore = true)]
  67. public decimal SonTraySizeWidth
  68. {
  69. get
  70. {
  71. return Convert.ToDecimal(PalletizingSonTraySizeList[1]);
  72. }
  73. }
  74. [SugarColumn(IsIgnore = true)]
  75. public decimal SonTraySizeWidth_Max
  76. {
  77. get
  78. {
  79. decimal maxNum = 0.5M;
  80. return SonTraySizeWidth + maxNum;
  81. }
  82. }
  83. [SugarColumn(IsIgnore = true)]
  84. public decimal SonTraySizeWidth_Min
  85. {
  86. get
  87. {
  88. decimal minNum = 0.5M;
  89. return SonTraySizeWidth - minNum;
  90. }
  91. }
  92. /// <summary>
  93. /// 箱子编号(码垛机器人使用)
  94. /// </summary>
  95. public int PalletizingBoxNo { get; set; }
  96. /// <summary>
  97. /// 箱子尺寸
  98. /// </summary>
  99. public string PalletizingBoxSize { get; set; }
  100. [SugarColumn(IsIgnore = true)]
  101. public string[] PalletizingBoxSizeList
  102. {
  103. get
  104. {
  105. return PalletizingBoxSize.Split('*');
  106. }
  107. }
  108. [SugarColumn(IsIgnore = true)]
  109. public decimal BoxSizeLength
  110. {
  111. get
  112. {
  113. return Convert.ToDecimal(PalletizingBoxSizeList[0]);
  114. }
  115. }
  116. [SugarColumn(IsIgnore = true)]
  117. public decimal BoxSizeLength_Max
  118. {
  119. get
  120. {
  121. decimal maxNum = 0.5M;
  122. return BoxSizeLength + maxNum;
  123. }
  124. }
  125. [SugarColumn(IsIgnore = true)]
  126. public decimal BoxSizeLength_Min
  127. {
  128. get
  129. {
  130. decimal minNum = 0.5M;
  131. return BoxSizeLength - minNum;
  132. }
  133. }
  134. [SugarColumn(IsIgnore = true)]
  135. public decimal BoxSizeWidth
  136. {
  137. get
  138. {
  139. return Convert.ToDecimal(PalletizingBoxSizeList[1]);
  140. }
  141. }
  142. [SugarColumn(IsIgnore = true)]
  143. public decimal BoxSizeWidth_Max
  144. {
  145. get
  146. {
  147. decimal maxNum = 0.5M;
  148. return BoxSizeWidth + maxNum;
  149. }
  150. }
  151. [SugarColumn(IsIgnore = true)]
  152. public decimal BoxSizeWidth_Min
  153. {
  154. get
  155. {
  156. decimal minNum = 0.5M;
  157. return BoxSizeWidth - minNum;
  158. }
  159. }
  160. [SugarColumn(IsIgnore = true)]
  161. public decimal BoxSizeHeight
  162. {
  163. get
  164. {
  165. return Convert.ToDecimal(PalletizingBoxSizeList[2]);
  166. }
  167. }
  168. [SugarColumn(IsIgnore = true)]
  169. public decimal BoxSizeHeight_Max
  170. {
  171. get
  172. {
  173. decimal maxNum = 0.5M;
  174. return BoxSizeHeight + maxNum;
  175. }
  176. }
  177. [SugarColumn(IsIgnore = true)]
  178. public decimal BoxSizeHeight_Min
  179. {
  180. get
  181. {
  182. decimal minNum = 0.5M;
  183. return BoxSizeHeight - minNum;
  184. }
  185. }
  186. public string Notes { get; set; }
  187. /// <summary>
  188. /// 检测箱子尺寸是否在可用范围
  189. /// </summary>
  190. public bool IsAvailableRange_BoxSize(string boxSize,int task_no)
  191. {
  192. bool result = false;
  193. try
  194. {
  195. string[] boxsizeSet = boxSize.Split('*');
  196. if (boxsizeSet.Count() < 3)
  197. throw new Exception(string.Format("任务[{0}]箱子尺寸[{1}]不正确", task_no, boxSize));
  198. decimal length = Convert.ToDecimal(boxsizeSet[0]);
  199. decimal width = Convert.ToDecimal(boxsizeSet[1]);
  200. decimal height = Convert.ToDecimal(boxsizeSet[2]);
  201. if (length >= BoxSizeLength_Min && length <= BoxSizeLength_Max &&
  202. width >= BoxSizeWidth_Min && width <= BoxSizeWidth_Max &&
  203. height >= BoxSizeHeight_Min && height <= BoxSizeHeight_Max)
  204. {
  205. result = true;
  206. }
  207. }
  208. catch (Exception ex)
  209. {
  210. LogMessageHelper.RecordLogMessage(ex);
  211. }
  212. return result;
  213. }
  214. /// <summary>
  215. /// 检测托盘尺寸是否在可用范围
  216. /// </summary>
  217. public bool IsAvailableRange_SonTraySize(string sonTraySize, int task_no)
  218. {
  219. bool result = false;
  220. try
  221. {
  222. string[] sonTraySizeSet = sonTraySize.Split('*');
  223. if (sonTraySizeSet.Count() < 3)
  224. throw new Exception(string.Format("任务[{0}]子托盘尺寸[{1}]不正确", task_no, sonTraySize));
  225. decimal length = Convert.ToDecimal(sonTraySizeSet[0]);
  226. decimal width = Convert.ToDecimal(sonTraySizeSet[1]);
  227. decimal height = Convert.ToDecimal(sonTraySizeSet[2]);
  228. if (length >= SonTraySizeLength_Min && length <= SonTraySizeLength_Max &&
  229. width >= SonTraySizeWidth_Min && width <= SonTraySizeWidth_Max)
  230. {
  231. result = true;
  232. }
  233. }
  234. catch (Exception ex)
  235. {
  236. LogMessageHelper.RecordLogMessage(ex);
  237. }
  238. return result;
  239. }
  240. }
  241. }