PlnGetOrdAmount.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. using System;
  2. using CoreFS.CA06;
  3. using com.steering.pss.plnsaleord.ordAmCal.model;
  4. using System.Windows.Forms;
  5. using Core.Mes.Client.Comm.Server;
  6. namespace Core.StlMes.Client.PlnSaleOrd.BaseMethod
  7. {
  8. class PlnGetOrdAmount
  9. {
  10. private OpeBase opeBase = null;
  11. InOrdParamEntity inEnity = null;
  12. public PlnGetOrdAmount(OpeBase _ob)
  13. {
  14. opeBase = _ob;
  15. }
  16. public OutOrdParamEntity getOrdAmount()
  17. {
  18. CoreClientParam ccp = new CoreClientParam();
  19. ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount";
  20. ccp.MethodName = "getOrdCalResult";
  21. ccp.ServerParams = new object[] { inEnity };
  22. ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  23. if (ccp == null || ccp.ReturnObject == null)
  24. {
  25. MessageBox.Show("服务端处理失败!");
  26. return null;
  27. }
  28. return (OutOrdParamEntity)ccp.ReturnObject;
  29. }
  30. /// <summary>
  31. /// 查询合同量转换参数
  32. /// </summary>
  33. /// <param name="desginKey">质量设计</param>
  34. /// <param name="mscPline">制程</param>
  35. /// <param name="ordLnDlyPk">交货Pk</param>
  36. /// <param name="plineCodeD">轧管选用产线</param>
  37. /// <param name="bom">选用BOM</param>
  38. /// <param name="codeJg">接箍码</param>
  39. /// <param name="putRate">投料率</param>
  40. /// <returns></returns>
  41. public InOrdParamEntity getInOrdParam(string desginKey, string mscPline, string ordLnDlyPk,
  42. string plineCodeD, string bom, string codeJg, Double putRate)
  43. {
  44. CoreClientParam ccp = new CoreClientParam();
  45. ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount";
  46. ccp.MethodName = "getInOrdParam";
  47. ccp.ServerParams = new object[] { desginKey, mscPline, ordLnDlyPk,
  48. plineCodeD, bom, codeJg, putRate };
  49. ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  50. if (ccp == null || ccp.ReturnObject == null)
  51. {
  52. MessageBox.Show("服务端处理失败!");
  53. return null;
  54. }
  55. return (InOrdParamEntity)ccp.ReturnObject;
  56. }
  57. /// <summary>
  58. /// 查询合同量转换参数
  59. /// </summary>
  60. /// <param name="desginKey">质量设计</param>
  61. /// <param name="mscPline">制程</param>
  62. /// <param name="ordLnDlyPk">交货Pk</param>
  63. /// <param name="plnDivideId">排产流水号</param>
  64. /// <param name="plineCodeD">轧管选用产线</param>
  65. /// <param name="bom">选用BOM</param>
  66. /// <param name="codeJg">接箍码</param>
  67. /// <param name="putRate">投料率</param>
  68. /// <returns></returns>
  69. public InOrdParamEntity getInOrdPlnParam(string desginKey, string mscPline, string ordLnDlyPk,
  70. string plnDivideId, string plineCodeD, string bom, string codeJg, Double putRate)
  71. {
  72. CoreClientParam ccp = new CoreClientParam();
  73. ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount";
  74. ccp.MethodName = "getInOrdPlnParam";
  75. ccp.ServerParams = new object[] { desginKey, mscPline, ordLnDlyPk, plnDivideId,
  76. plineCodeD, bom, codeJg, putRate };
  77. ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  78. if (ccp == null || ccp.ReturnObject == null)
  79. {
  80. MessageBox.Show("服务端处理失败!");
  81. return null;
  82. }
  83. return (InOrdParamEntity)ccp.ReturnObject;
  84. }
  85. /// <summary>
  86. /// 查询合同量转换参数
  87. /// </summary>
  88. /// <param name="orderQty">顶货量</param>
  89. /// <param name="orderUnit">订货单位</param>
  90. /// <param name="desginKey">质量设计</param>
  91. /// <param name="mscPline">制程</param>
  92. /// <param name="ordLnDlyPk">交货Pk</param>
  93. /// <param name="plineCodeD">轧管选用产线</param>
  94. /// <param name="bom">选用BOM</param>
  95. /// <param name="codeJg">接箍码</param>
  96. /// <param name="putRate">投料率</param>
  97. /// <returns></returns>
  98. public InOrdParamEntity getInOrdPlnQtyParam(Double orderQty, string orderUnit, string desginKey,
  99. string mscPline, string ordLnDlyPk, string plineCodeD, string bom,
  100. string codeJg, Double putRate)
  101. {
  102. CoreClientParam ccp = new CoreClientParam();
  103. ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount";
  104. ccp.MethodName = "getInOrdPlnQtyParam";
  105. ccp.ServerParams = new object[] { orderQty, orderUnit, desginKey, mscPline,
  106. ordLnDlyPk, plineCodeD, bom, codeJg, putRate };
  107. ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  108. if (ccp == null || ccp.ReturnObject == null)
  109. {
  110. MessageBox.Show("服务端处理失败!");
  111. return null;
  112. }
  113. return (InOrdParamEntity)ccp.ReturnObject;
  114. }
  115. /// <summary>
  116. /// 验证合同量计算参数是否有误
  117. /// </summary>
  118. /// <param name="param"></param>
  119. /// <param name="?"></param>
  120. /// <returns></returns>
  121. public bool isRightParam(InOrdParamEntity inEntity, string desginKey,
  122. string codeJg, string bom, string dPline, out string errMessage)
  123. {
  124. errMessage = "";
  125. if (desginKey.Equals(""))
  126. {
  127. errMessage = "未找到工艺评审。";
  128. return false;
  129. }
  130. if (inEntity == null)
  131. {
  132. errMessage = "查询合同量转换参数出错。";
  133. return false;
  134. }
  135. if (!inEntity.OrderUnit.Equals("支")
  136. && !inEntity.OrderUnit.Equals("英磅")
  137. && !inEntity.OrderUnit.Equals("吨")
  138. && !inEntity.OrderUnit.Equals("米")
  139. && !inEntity.OrderUnit.Equals("英尺"))
  140. {
  141. errMessage = "合同订货单位未知!";
  142. return false;
  143. }
  144. if (inEntity.OrderQty <= 0)
  145. {
  146. errMessage = "合同订货量必须大于零!";
  147. return false;
  148. }
  149. if (inEntity.Totlength > 0)
  150. {
  151. if (!inEntity.TotlengthUnit.Equals("米")
  152. && !inEntity.TotlengthUnit.Equals("英尺"))
  153. {
  154. errMessage = "合同有保总长,但保总长单位未知!";
  155. return false;
  156. }
  157. }
  158. if (inEntity.Totlength < 0)
  159. {
  160. errMessage = "合同保总长不能为负数!";
  161. return false;
  162. }
  163. if (!inEntity.OrderUnit.Equals("支"))
  164. {
  165. #region
  166. if (inEntity.LengthMax <= 0)
  167. {
  168. errMessage = "合同长度上限必须大于零!";
  169. return false;
  170. }
  171. if (inEntity.LengthMin < 0)
  172. {
  173. errMessage = "合同长度下限不能为负数!";
  174. return false;
  175. }
  176. if (inEntity.LengthMax < inEntity.LengthMin)
  177. {
  178. errMessage = "合同长度上限不能小于下限!";
  179. return false;
  180. }
  181. if (inEntity.Outdiameter <= 0)
  182. {
  183. errMessage = "合同外径必须大于零!";
  184. return false;
  185. }
  186. if (inEntity.Wallthick <= 0)
  187. {
  188. errMessage = "合同壁厚必须大于零!";
  189. return false;
  190. }
  191. if (inEntity.Outdiameter < inEntity.Wallthick)
  192. {
  193. errMessage = "合同外径不能小于壁厚!";
  194. return false;
  195. }
  196. if (inEntity.DiameterZg <= 0)
  197. {
  198. errMessage = "轧管工序,轧管规格外径必须大于零!\n BOM:" + bom;
  199. return false;
  200. }
  201. if (inEntity.HeightZg <= 0)
  202. {
  203. errMessage = "轧管工序,轧管规格壁厚必须大于零!\n BOM:" + bom;
  204. return false;
  205. }
  206. if (inEntity.DiameterZg < inEntity.HeightZg)
  207. {
  208. errMessage = "轧管规格外径不能小于壁厚!\n BOM:" + bom;
  209. return false;
  210. }
  211. if (inEntity.DiameterPl == null
  212. || inEntity.DiameterPl.Count == 0)
  213. {
  214. errMessage = "管坯坯料断面规格未知!\n BOM:" + bom;
  215. return false;
  216. }
  217. else
  218. {
  219. for (int i = 0; i < inEntity.DiameterPl.Count; i++)
  220. {
  221. if (inEntity.DiameterPl[0] <= 0)
  222. {
  223. errMessage = "管坯坯料断面必须大于零!\n BOM:" + bom;
  224. return false;
  225. }
  226. }
  227. }
  228. if (inEntity.CutHeadEnd < 0)
  229. {
  230. errMessage = "轧管工序,切头尾不能为负数!\n BOM:" + bom + ",轧管机组:" + getPlineNameByCode(dPline, opeBase);
  231. return false;
  232. }
  233. if (inEntity.LengthMaxRing <= 0)
  234. {
  235. errMessage = "轧管工序,环形炉最大长度未知!\n 轧管机组:" + getPlineNameByCode(dPline, opeBase);
  236. return false;
  237. }
  238. if (inEntity.LengthColdbed <= 0)
  239. {
  240. errMessage = "轧管工序,产线冷床长度必须大于零!\n 轧管机组:" + getPlineNameByCode(dPline, opeBase);
  241. return false;
  242. }
  243. if (inEntity.Sigllen < 0)
  244. {
  245. errMessage = "单倍尺长不能为负数!";
  246. return false;
  247. }
  248. if (inEntity.BurnoutRate < 0 || inEntity.BurnoutRate > 100)
  249. {
  250. errMessage = "轧管烧损率有误!\n 烧损率" + inEntity.BurnoutRate + "%\n 轧管机组:" + getPlineNameByCode(dPline, opeBase);
  251. return false;
  252. }
  253. if (inEntity.BurnoutDbk < 0 || inEntity.BurnoutDbk > 100)
  254. {
  255. errMessage = "镦拔扩烧损率有误!\n 烧损率" + inEntity.BurnoutDbk + "%。";
  256. return false;
  257. }
  258. if (inEntity.Footmin < 0)
  259. {
  260. errMessage = "短尺最短不能为负数!";
  261. return false;
  262. }
  263. if (inEntity.StdWallthickMax == 0 && inEntity.StdWallthickMin == 0)
  264. {
  265. errMessage = "未找到交货标准";
  266. return false;
  267. }
  268. if (inEntity.AddLengthDbk < 0)
  269. {
  270. errMessage = "镦拔扩切头尾长度不能为负数!\n BOM:" + bom;
  271. return false;
  272. }
  273. if (inEntity.AddLengthDc < 0)
  274. {
  275. errMessage = "镦粗影响长度不能为负数!\n BOM:" + bom;
  276. return false;
  277. }
  278. if (inEntity.InspectLen < 0)
  279. {
  280. errMessage = "探伤盲区切长度值不能为负数!";
  281. return false;
  282. }
  283. #endregion
  284. }
  285. if (inEntity.OrderUnit.Equals("英磅")
  286. || inEntity.OrderUnit.Equals("吨"))
  287. {
  288. if (inEntity.Totlength == 0)
  289. {
  290. if (inEntity.WeightType != 0
  291. && inEntity.WeightType != 1
  292. && inEntity.WeightType != -1)
  293. {
  294. errMessage = "合同按重量交货,但未知计重方式!";
  295. return false;
  296. }
  297. }
  298. }
  299. if (inEntity.DelvryRangeMax < 0
  300. || inEntity.DelvryRangeMin < 0)
  301. {
  302. errMessage = "合同交货量差有误!";
  303. return false;
  304. }
  305. if (inEntity.DelvryRangeTpe != 1
  306. && inEntity.DelvryRangeTpe != 2)
  307. {
  308. errMessage = "合同交货量差方式未知!";
  309. return false;
  310. }
  311. if (inEntity.WeightJg < 0)
  312. {
  313. errMessage = "接箍单重不能为负数!\n 接箍码:"+codeJg;
  314. return false;
  315. }
  316. if (inEntity.CheckJVal < 0)
  317. {
  318. errMessage = "接箍测量J值不能为负数!\n 接箍码:" + codeJg;
  319. return false;
  320. }
  321. return true;
  322. }
  323. public static string getPlineNameByCode(string plineCode,OpeBase _ob)
  324. {
  325. System.Data.DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order" +
  326. ".baseMethod.CoreGetOrdAmount.getPlineNameByCode",
  327. new object[] { plineCode }, _ob);
  328. if (dt != null && dt.Rows.Count > 0)
  329. {
  330. return dt.Rows[0]["PLINE_NAME"].ToString();
  331. }
  332. return "";
  333. }
  334. /// <summary>
  335. /// 合同量计算传入参数实体类
  336. /// </summary>
  337. internal InOrdParamEntity InEnity
  338. {
  339. get { return inEnity; }
  340. set { inEnity = value; }
  341. }
  342. }
  343. }