ComJgMBlOrd.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. using System;
  2. using System.Data;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using CoreFS.CA06;
  6. using Core.Mes.Client.Comm.Control;
  7. using System.Collections;
  8. using Infragistics.Win.UltraWinGrid;
  9. using Core.Mes.Client.Comm.Tool;
  10. using Core.Mes.Client.Comm.Server;
  11. using com.steering.pss.plnsaleord.order.model;
  12. using Core.StlMes.Client.PlnSaleOrd.JGGXPln.Entity;
  13. using com.steering.pss.plnsaleord.jggxpln.model;
  14. using System.Collections.Generic;
  15. using System.Drawing;
  16. namespace Core.StlMes.Client.PlnSaleOrd
  17. {
  18. public partial class ComJgMBlOrd : UserControl
  19. {
  20. public OpeBase _ob = null;
  21. //用于计算可分离容器的大小。
  22. private int _splitterDistance2 = 0;
  23. private int _splitterDistance3 = 0;
  24. private int _splitterDistance1 = 0;
  25. private bool _groupBox2ExpandedChanged = false;
  26. private bool _groupBox3ExpandedChanged = false;
  27. private bool _groupBox4ExpandedChanged = false;
  28. private bool _groupBox5ExpandedChanged = false;
  29. public ComJgMBlOrd()
  30. {
  31. InitializeComponent();
  32. Init();
  33. }
  34. public void Init()
  35. {
  36. EntityHelper.ShowGridCaption<PlnSaleordEntity>(ultraGridSaleOrder.DisplayLayout.Bands[0]);
  37. EntityHelper.ShowGridCaption<FrmPlnGxJgMEntity>(ultraGridJgGxM.DisplayLayout.Bands[0]);
  38. PlanComm.setGridActivation(ultraGridJgGxM.DisplayLayout.Bands[0], "CHC");
  39. PlanComm.setGridActivation(ultraGridJgEdit.DisplayLayout.Bands[0], "CHC");//"NUM_JG", "SINGLE_ADDLEN"
  40. PlanComm.setGridActivation(ultraGridBl.DisplayLayout.Bands[0], "CHC");
  41. PlanComm.setGridActivation(ultraGridJgBl.DisplayLayout.Bands[0], "CHC");
  42. PlanComm.setGridActivation(ultraGridSaleOrder.DisplayLayout.Bands[0]);
  43. PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 2,
  44. "Outdiameter", "Wallthick", "Aimlength", "Singleweight", "Diameter", "DiameterJg",
  45. "CheckJVal", "MinD", "MinH", "BlMinDOut", "BlMaxDIn", "AimlengthBl", "HeightJg",
  46. "DiameterPl", "HeightPl", "LengthMin", "LengthMax", "LengthJg", "WeightJg",
  47. "MinDCp", "MaxDCp", "LengthMin", "LengthMax", "MinHCp","MaxHCp", "MinDJg", "MaxDJg");
  48. PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 3, "BlWeight");
  49. PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 0,
  50. "ProducedNum", "ZyplanNum", "BlNum", "PlanNum", "JgwtBlreq", "Buyplannum", "Matchnum");
  51. PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 2,
  52. "OUTDIAMETER", "WALLTHICK", "AIMWALLTHICK", "LENGTHMAX", "LENGTHMIN", "AIMLENGTH");
  53. PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 3,
  54. "SINGLEWEIGHT", "JGBL_REQ_WEIGHT", "MATCHWEIGHT");
  55. PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 0,
  56. "JGBL_REQ_NUM", "MATCHNUM");
  57. PlanComm.setGridDigitalCol(ultraGridJgBl.DisplayLayout.Bands[0], 5, 2,
  58. "OUTDIAMETER", "WALLTHICK", "AIMLENGTH", "SINGLEWEIGHT", "SINGLEWEIGHT2",
  59. "AIMLENGTH_BL", "JGBL_REQ_WEIGHT", "GETRATE", "WEIGHT_JG", "SINGLE_ADDLEN");
  60. PlanComm.setGridDigitalCol(ultraGridJgBl.DisplayLayout.Bands[0], 5, 0,
  61. "JGPLAN_NUM", "NUM_JG", "JGBL_REQ_NUM" );
  62. ultraGridJgEdit.DisplayLayout.Bands[0].Columns["PLINE_NAME"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  63. }
  64. public void RefresDate()
  65. {
  66. DataTable dtDd = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgGxMNo",
  67. new object[] { }, _ob);
  68. if (dtDd != null && dtDd.Rows.Count > 0)
  69. {
  70. DataRow dr = dtDd.NewRow();
  71. dtDd.Rows.InsertAt(dr, 0);
  72. }
  73. ultraComboJgDdNo.DataSource = dtDd;
  74. ultraComboJgDdNo.DisplayMember = "PRO_PLAN_ID";
  75. ultraComboJgDdNo.ValueMember = "PRO_PLAN_ID";
  76. DataTable dtReq = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJglRelNo",
  77. new object[] { }, _ob);
  78. if (dtReq != null && dtReq.Rows.Count > 0)
  79. {
  80. DataRow dr = dtReq.NewRow();
  81. dtReq.Rows.InsertAt(dr, 0);
  82. }
  83. ultraComboJglReqNo.DataSource = dtReq;
  84. ultraComboJglReqNo.DisplayMember = "REQ_BL_ID";
  85. ultraComboJglReqNo.ValueMember = "REQ_BL_ID";
  86. }
  87. /// <summary>
  88. /// 接箍料编制查询
  89. /// </summary>
  90. public void Query()
  91. {
  92. string strJglReqNo = "";
  93. string strJgDdNo = "";
  94. string strInFinished = "0";//包含完成配料的订单
  95. if (checkBoxJglReqNo.Checked)
  96. {
  97. strJglReqNo = ultraComboJglReqNo.Text;
  98. }
  99. if (checkBoxJgDdNo.Checked)
  100. {
  101. strJgDdNo = this.ultraComboJgDdNo.Text;
  102. }
  103. if (this.checkBoxFinish.Checked)
  104. {
  105. strInFinished = "1";
  106. }
  107. bindingSourcePlnGxJgMEntity.DataSource = EntityHelper.GetData<FrmPlnGxJgMEntity>(
  108. "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryGxJgM", new object[] { strJgDdNo, strInFinished }, _ob);
  109. DataTable dtEdit = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgDealedit",
  110. new object[] { strJgDdNo, strInFinished }, _ob);
  111. GridHelper.CopyDataToDatatable(dtEdit, dataTableEdit, true);
  112. //foreach (UltraGridRow uRow in ultraGridJgEdit.Rows)
  113. //{
  114. // uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
  115. // uRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
  116. // uRow.Cells["NUM_JG"].Appearance.BackColor = Color.;
  117. // uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
  118. // uRow.Cells["SINGLE_ADDLEN"].Activation = Activation.ActivateOnly;
  119. //}
  120. DataTable dtJgl = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgBlNeed",
  121. new object[] { strJglReqNo }, _ob);
  122. GridHelper.CopyDataToDatatable(dtJgl, dataTableBl, true);
  123. this.dataTableRel.Clear();
  124. }
  125. /// <summary>
  126. /// 查询备料接箍对应关系表
  127. /// </summary>
  128. /// <param name="blReqId"></param>
  129. private void DoQueryJAndB(string blReqId)
  130. {
  131. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryRelation",
  132. new object[] { blReqId }, _ob);
  133. GridHelper.CopyDataToDatatable(dt, dataTableRel, true);
  134. }
  135. /// <summary>
  136. /// 接箍订单关联合同
  137. /// </summary>
  138. /// <param name="jgMId"></param>
  139. private void DoQueryJgMOrd(string jgMId)
  140. {
  141. List<PlnSaleordEntity> listSource = EntityHelper.GetData<PlnSaleordEntity>
  142. ("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.querySaleOrder",
  143. new object[] { jgMId }, _ob);
  144. bindingSourceSaleOrd.DataSource = listSource;
  145. }
  146. /// <summary>
  147. /// 新建接箍料需求信息
  148. /// </summary>
  149. public void DoAddJgBlReq()
  150. {
  151. ultraGridJgEdit.UpdateData();
  152. ArrayList list = new ArrayList();
  153. IQueryable<UltraGridRow> checkRows = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True' ");
  154. if (checkRows.Count() == 0)
  155. {
  156. MessageUtil.ShowTips("未勾选新建行。");
  157. return;
  158. }
  159. foreach (UltraGridRow uRow in checkRows)
  160. {
  161. PlnOrdJgMEditEntity editEntiy = new PlnOrdJgMEditEntity();
  162. if (uRow.Cells["JGBL_SUMLENTH"].Value.Equals("0") ||
  163. uRow.Cells["JGBL_SUMLENTH"].Value.Equals(""))
  164. {
  165. MessageUtil.ShowTips("合同:" + uRow.Cells["PRO_PLAN_ID"].Value.ToString()
  166. + ",备料:" + uRow.Cells["CODE_JG_BL"].Value.ToString() + "的项未知备料需求量!");
  167. return;
  168. }
  169. editEntiy.ProPlanId = uRow.Cells["PRO_PLAN_ID"].Value.ToString();
  170. editEntiy.CodeJg = uRow.Cells["CODE_JG"].Value.ToString();
  171. editEntiy.CodeJgBl = uRow.Cells["CODE_JG_BL"].Value.ToString();
  172. editEntiy.WeightJg = uRow.Cells["WEIGHT_JG"].Value.ToString();
  173. editEntiy.NumJg = uRow.Cells["NUM_JG"].Value.ToString();
  174. editEntiy.SingleAddlen = uRow.Cells["SINGLE_ADDLEN"].Value.ToString();
  175. editEntiy.JgblSumlenth = uRow.Cells["JGBL_SUMLENTH"].Value.ToString();
  176. editEntiy.NumJgbl = uRow.Cells["NUM_JGBL"].Value.ToString();
  177. editEntiy.JgblReqWeight = uRow.Cells["JGBL_REQ_WEIGHT"].Value.ToString();
  178. editEntiy.PrdcrNo = uRow.Cells["PRDCR_NO"].Value.ToString();
  179. editEntiy.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  180. list.Add(editEntiy);
  181. }
  182. CoreClientParam ccp = new CoreClientParam();
  183. ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
  184. ccp.MethodName = "addJgBlReq";
  185. ccp.ServerParams = new object[] { list };
  186. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  187. if (ccp == null)
  188. {
  189. MessageUtil.ShowError("服务端处理失败!");
  190. return;
  191. }
  192. if (ccp.ReturnCode < 0)
  193. {
  194. MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
  195. return;
  196. }
  197. if (ccp.ReturnObject != null)
  198. {
  199. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  200. Query();
  201. }
  202. }
  203. /// <summary>
  204. /// 加入现有接箍料需求
  205. /// </summary>
  206. public void DoAddJgAndBl()
  207. {
  208. ultraGridJgEdit.UpdateData();
  209. ultraGridBl.UpdateData();
  210. ArrayList list = new ArrayList();
  211. string blOrdNo = "";//备料需求编号
  212. string codeBl = "";//备料码
  213. IQueryable<UltraGridRow> checkRows = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True' ");
  214. IQueryable<UltraGridRow> checkRows1 = ultraGridBl.Rows.AsQueryable().Where(" CHC = 'True' ");
  215. if (checkRows.Count() == 0)
  216. {
  217. MessageUtil.ShowTips("未勾选加入需求的行。");
  218. return;
  219. }
  220. if (checkRows1.Count() != 1)
  221. {
  222. MessageUtil.ShowTips("请选择一条已有的备料需求。");
  223. return;
  224. }
  225. codeBl = checkRows1.First().Cells["CODE_JG_BL"].Value.ToString();
  226. blOrdNo = checkRows1.First().Cells["REQ_BL_ID"].Value.ToString();
  227. IQueryable<UltraGridRow> outRows = checkRows.Where(" CODE_JG_BL != '" + codeBl + "' ");
  228. if (outRows.Count() > 0)
  229. {
  230. MessageUtil.ShowTips("接箍合同:" + outRows.First().Cells["PRO_PLAN_ID"].Value.ToString()
  231. + "、备料码:" + outRows.First().Cells["CODE_JG_BL"].Value.ToString()
  232. + ",不能加入备料需求:" + blOrdNo + "中。(备料码不一致!)");
  233. return;
  234. }
  235. foreach (UltraGridRow uRow in checkRows)
  236. {
  237. PlnOrdJgMEditEntity editEntiy = new PlnOrdJgMEditEntity();
  238. if (uRow.Cells["JGBL_SUMLENTH"].Value.Equals("0") ||
  239. uRow.Cells["JGBL_SUMLENTH"].Value.Equals(""))
  240. {
  241. MessageUtil.ShowTips("合同:" + uRow.Cells["PRO_PLAN_ID"].Value.ToString()
  242. + ",备料:" + uRow.Cells["CODE_JG_BL"].Value.ToString() + "的项未知备料需求量!");
  243. return;
  244. }
  245. editEntiy.ProPlanId = uRow.Cells["PRO_PLAN_ID"].Value.ToString();
  246. editEntiy.CodeJg = uRow.Cells["CODE_JG"].Value.ToString();
  247. editEntiy.CodeJgBl = uRow.Cells["CODE_JG_BL"].Value.ToString();
  248. editEntiy.WeightJg = uRow.Cells["WEIGHT_JG"].Value.ToString();
  249. editEntiy.NumJg = uRow.Cells["NUM_JG"].Value.ToString();
  250. editEntiy.SingleAddlen = uRow.Cells["SINGLE_ADDLEN"].Value.ToString();
  251. editEntiy.JgblSumlenth = uRow.Cells["JGBL_SUMLENTH"].Value.ToString();
  252. editEntiy.NumJgbl = uRow.Cells["NUM_JGBL"].Value.ToString();
  253. editEntiy.JgblReqWeight = uRow.Cells["JGBL_REQ_WEIGHT"].Value.ToString();
  254. editEntiy.PrdcrNo = uRow.Cells["PRDCR_NO"].Value.ToString();
  255. editEntiy.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  256. list.Add(editEntiy);
  257. }
  258. CoreClientParam ccp = new CoreClientParam();
  259. ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
  260. ccp.MethodName = "addJgAndBl";
  261. ccp.ServerParams = new object[] { list, blOrdNo };
  262. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  263. if (ccp == null)
  264. {
  265. MessageUtil.ShowError("服务端处理失败!");
  266. return;
  267. }
  268. if (ccp.ReturnCode < 0)
  269. {
  270. MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
  271. return;
  272. }
  273. if (ccp.ReturnObject != null)
  274. {
  275. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  276. Query();
  277. }
  278. }
  279. /// <summary>
  280. /// 删除接箍料需求
  281. /// </summary>
  282. public void DoDelete()
  283. {
  284. ultraGridBl.UpdateData();
  285. ArrayList list = new ArrayList();
  286. IQueryable<UltraGridRow> checkRows = ultraGridBl.Rows.AsQueryable().Where(" CHC = 'True' ");
  287. if (checkRows.Count() == 0)
  288. {
  289. MessageUtil.ShowTips("请选择要删除的备料需求。");
  290. return;
  291. }
  292. foreach (UltraGridRow uRow in checkRows)
  293. {
  294. list.Add(uRow.Cells["REQ_BL_ID"].Value.ToString());
  295. }
  296. CoreClientParam ccp = new CoreClientParam();
  297. ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
  298. ccp.MethodName = "deleteReq";
  299. ccp.ServerParams = new object[] { list };
  300. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  301. if (ccp == null)
  302. {
  303. MessageUtil.ShowError("服务端处理失败!");
  304. return;
  305. }
  306. if (ccp.ReturnCode < 0)
  307. {
  308. MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
  309. return;
  310. }
  311. if (ccp.ReturnObject != null)
  312. {
  313. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  314. Query();
  315. }
  316. }
  317. /// <summary>
  318. /// 删除接箍料需求明细项
  319. /// </summary>
  320. public void DoDeleteOne()
  321. {
  322. ultraGridJgBl.UpdateData();
  323. ArrayList list = new ArrayList();
  324. IQueryable<UltraGridRow> checkRows = ultraGridJgBl.Rows.AsQueryable().Where(" CHC = 'True' ");
  325. if (checkRows.Count() == 0)
  326. {
  327. MessageUtil.ShowTips("请选择要删除的备料需求。");
  328. return;
  329. }
  330. string ReqBlId = checkRows.First().Cells["REQ_BL_ID"].Value.ToString();
  331. foreach (UltraGridRow uRow in checkRows)
  332. {
  333. list.Add(uRow.Cells["PRO_PLAN_ID"].Value.ToString());
  334. }
  335. CoreClientParam ccp = new CoreClientParam();
  336. ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
  337. ccp.MethodName = "deleteRelation";
  338. ccp.ServerParams = new object[] { list, ReqBlId,
  339. CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
  340. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  341. if (ccp == null)
  342. {
  343. MessageUtil.ShowError("服务端处理失败!");
  344. return;
  345. }
  346. if (ccp.ReturnCode < 0)
  347. {
  348. MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
  349. return;
  350. }
  351. if (ccp.ReturnObject != null)
  352. {
  353. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  354. Query();
  355. }
  356. }
  357. /// <summary>
  358. /// 备料确认
  359. /// </summary>
  360. public void DoConfirmJgl()
  361. {
  362. ultraGridBl.UpdateData();
  363. ArrayList list = new ArrayList();
  364. IQueryable<UltraGridRow> ugrs = ultraGridBl.Rows.AsQueryable().Where("CHC = 'True'");
  365. if (ugrs.Count() == 0)
  366. {
  367. MessageUtil.ShowTips("请勾选需要确认的备料需求。");
  368. return;
  369. }
  370. foreach (UltraGridRow ugr in ugrs)
  371. {
  372. PlnPorderBlReqEntity blReqEntity = new PlnPorderBlReqEntity();
  373. blReqEntity.ReqBlId = ugr.Cells["REQ_BL_ID"].Value.ToString();
  374. list.Add(blReqEntity);
  375. }
  376. CoreClientParam ccp = new CoreClientParam();
  377. ccp.ServerName = "com.steering.pss.plnsaleord.order.CorePlnOrdJgDjDeal";
  378. ccp.MethodName = "doConfirmBl";
  379. ccp.ServerParams = new object[] { list, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
  380. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  381. if (ccp.ReturnCode != -1)
  382. {
  383. if (ccp.ReturnObject != null && !ccp.ReturnObject.ToString().Equals(""))
  384. {
  385. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  386. }
  387. Query();
  388. }
  389. }
  390. /// <summary>
  391. /// 备料取消确认
  392. /// </summary>
  393. public void CanCelConfirmBl()
  394. {
  395. ultraGridBl.UpdateData();
  396. ArrayList list = new ArrayList();
  397. IQueryable<UltraGridRow> ugrs = ultraGridBl.Rows.AsQueryable().Where("CHC = 'True'");
  398. if (ugrs.Count() == 0)
  399. {
  400. MessageUtil.ShowTips("未勾选备料需求。");
  401. return;
  402. }
  403. foreach (UltraGridRow ugr in ugrs)
  404. {
  405. list.Add(ugr.Cells["REQ_BL_ID"].Value.ToString());
  406. }
  407. CoreClientParam ccp = new CoreClientParam();
  408. ccp.ServerName = "com.steering.pss.plnsaleord.order.CorePlnOrdJgDjDeal";
  409. ccp.MethodName = "canCelConfirmBl";
  410. ccp.ServerParams = new object[] { list };
  411. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  412. if (ccp.ReturnCode != -1)
  413. {
  414. if (ccp.ReturnObject != null && !ccp.ReturnObject.ToString().Equals(""))
  415. {
  416. MessageUtil.ShowTips(ccp.ReturnObject.ToString());
  417. }
  418. Query();
  419. }
  420. }
  421. /// <summary>
  422. /// 输入要做备料需求的接箍个数
  423. /// </summary>
  424. /// <param name="sender"></param>
  425. /// <param name="e"></param>
  426. private void ultraGridJgEdit_AfterCellUpdate(object sender, CellEventArgs e)
  427. {
  428. if (e.Cell.Column.Key == "CHC")
  429. {
  430. if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
  431. {
  432. computJglLen(e.Cell.Row);
  433. e.Cell.Row.Update();
  434. }
  435. }
  436. if (e.Cell.Column.Key == "NUM_JG")
  437. {
  438. if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
  439. {
  440. computJglLen(e.Cell.Row);
  441. e.Cell.Row.Update();
  442. }
  443. }
  444. if (e.Cell.Column.Key.Equals("SINGLE_ADDLEN"))
  445. {
  446. double addlen = 0;
  447. if (!double.TryParse(e.Cell.Row.Cells["SINGLE_ADDLEN"].Value.ToString(), out addlen))
  448. {
  449. e.Cell.Row.Cells["SINGLE_ADDLEN"].Value = 0;
  450. }
  451. if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
  452. {
  453. computJglLen(e.Cell.Row);
  454. e.Cell.Row.Update();
  455. }
  456. }
  457. }
  458. /// <summary>
  459. /// 根据接箍个数,算接箍料长度,重量
  460. /// </summary>
  461. /// <param name="uRow"></param>
  462. private void computJglLen(UltraGridRow uRow)
  463. {
  464. int Num_Jg = 0;
  465. if (int.TryParse(uRow.Cells["NUM_JG"].Value.ToString(), out Num_Jg))
  466. {
  467. //接箍料长度=接箍个数*(接箍长度+单个接箍切损长度)
  468. double jgbl_sumlenth = Num_Jg * (Convert.ToDouble(uRow.Cells["AIMLENGTH"].Value)
  469. + Convert.ToDouble(uRow.Cells["SINGLE_ADDLEN"].Value)) / 1000;
  470. double singleweight_jg = Convert.ToDouble(uRow.Cells["SINGLEWEIGHT"].Value);//接箍单重(kg)
  471. //接箍料目标长度取长度上下限中间值
  472. double JglAimlenth = (Convert.ToDouble(uRow.Cells["MIN_L"].Value.ToString3())
  473. + Convert.ToDouble(uRow.Cells["MAX_L"].Value.ToString3())) / 2;
  474. int numJgl = 0; //接箍料支数
  475. double weight_jg = singleweight_jg * Num_Jg / 1000;//接箍重量
  476. double min_d = Convert.ToDouble(uRow.Cells["MIN_D"].Value.ToString3()); //备料外径
  477. double min_h = Convert.ToDouble(uRow.Cells["MIN_H"].Value.ToString3()); //备料壁厚
  478. double Weight_One = PlanComm.WeightOfMi(min_d, min_h); //接箍料米单重
  479. if ((jgbl_sumlenth % JglAimlenth) == 0)
  480. {
  481. numJgl = (int)(jgbl_sumlenth / JglAimlenth);
  482. }
  483. else
  484. {
  485. numJgl = (int)(jgbl_sumlenth / JglAimlenth) + 1;
  486. }
  487. uRow.Cells["NUM_JGBL"].Value = numJgl;
  488. uRow.Cells["JGBL_SUMLENTH"].Value = Math.Round(jgbl_sumlenth, 2);
  489. uRow.Cells["WEIGHT_JG"].Value = Math.Round(weight_jg, 3);
  490. uRow.Cells["JGBL_REQ_WEIGHT"].Value = Math.Round(Weight_One * jgbl_sumlenth, 3);
  491. }
  492. else
  493. {
  494. uRow.Cells["NUM_JG"].Value = 0;
  495. }
  496. }
  497. /// <summary>
  498. /// 选择接箍合同备料
  499. /// </summary>
  500. /// <param name="sender"></param>
  501. /// <param name="e"></param>
  502. private void ultraGridJgEdit_CellChange(object sender, CellEventArgs e)
  503. {
  504. if (e.Cell.Column.Key == "CHC")
  505. {
  506. setJgleditNum(e.Cell.Row);
  507. }
  508. if (e.Cell.Column.Key.Equals("NUM_JG"))
  509. {
  510. ultraGridJgEdit.UpdateData();
  511. ultraGridJgGxM.UpdateData();
  512. }
  513. if (e.Cell.Column.Key.Equals("SINGLE_ADDLEN"))
  514. {
  515. ultraGridJgEdit.UpdateData();
  516. ultraGridJgGxM.UpdateData();
  517. }
  518. //computJglLen(e.Cell.Row);
  519. }
  520. /// <summary>
  521. /// 接箍料编辑表勾选时的操作
  522. /// </summary>
  523. /// <param name="uRow">勾选行</param>
  524. private void setJgleditNum(UltraGridRow cRow)
  525. {
  526. if (Convert.ToBoolean(cRow.Cells["CHC"].Text))
  527. {
  528. ultraGridJgEdit.UpdateData();
  529. IQueryable<UltraGridRow> listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True'");
  530. listRow = listRow.Where(" PRO_PLAN_ID = '"
  531. + cRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
  532. listRow = listRow.Where(" CODE_JG_BL != '"
  533. + cRow.Cells["CODE_JG_BL"].Value.ToString() + "'");
  534. //foreach (UltraGridRow uRow in listRow.ToArray())
  535. //{
  536. //cRow.Cells["CHC"].Value = false;
  537. //cRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
  538. ////uRow.Cells["NUM_JG"].Value = 0;
  539. //cRow.Cells["WEIGHT_JG"].Value = 0;
  540. //cRow.Cells["NUM_JGBL"].Value = 0;
  541. //cRow.Cells["JGBL_SUMLENTH"].Value = 0;
  542. //cRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
  543. //}
  544. ultraGridJgGxM.UpdateData();
  545. listRow = ultraGridJgGxM.Rows.AsQueryable().Where(" ProPlanId = '"
  546. + cRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
  547. //foreach (UltraGridRow uRow in listRow.ToArray())
  548. //{
  549. // int num_jg = Convert.ToInt32(uRow.Cells["PlanNum"].Value) -
  550. // Convert.ToInt32(uRow.Cells["Matchnum"].Value) -
  551. // Convert.ToInt32(uRow.Cells["JgwtBlreq"].Value);
  552. // if (num_jg < 0)
  553. // {
  554. // num_jg = 0;
  555. // }
  556. // cRow.Cells["NUM_JG"].Value = num_jg;
  557. // break;
  558. //}
  559. cRow.Cells["NUM_JG"].Activation = Activation.AllowEdit;
  560. cRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
  561. cRow.Cells["NUM_JG"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  562. cRow.Cells["SINGLE_ADDLEN"].Activation = Activation.AllowEdit;
  563. cRow.Cells["SINGLE_ADDLEN"].IgnoreRowColActivation = true;
  564. cRow.Cells["SINGLE_ADDLEN"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  565. cRow.Update();
  566. }
  567. if (!Convert.ToBoolean(cRow.Cells["CHC"].Text))
  568. {
  569. cRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
  570. cRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
  571. cRow.Cells["NUM_JG"].Appearance.BackColor = Color.Transparent;
  572. cRow.Cells["SINGLE_ADDLEN"].Activation = Activation.ActivateOnly;
  573. cRow.Cells["SINGLE_ADDLEN"].IgnoreRowColActivation = true;
  574. cRow.Cells["SINGLE_ADDLEN"].Appearance.BackColor = Color.Transparent;
  575. //cRow.Cells["NUM_JG"].Value = 0;
  576. cRow.Cells["WEIGHT_JG"].Value = 0;
  577. cRow.Cells["NUM_JGBL"].Value = 0;
  578. cRow.Cells["JGBL_SUMLENTH"].Value = 0;
  579. cRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
  580. cRow.Update();
  581. }
  582. ultraGridJgEdit.UpdateData();
  583. ultraGridJgGxM.UpdateData();
  584. }
  585. private void splitContainer2_SplitterMoved(object sender, SplitterEventArgs e)
  586. {
  587. if (_groupBox2ExpandedChanged == false)
  588. {
  589. _splitterDistance2 = splitContainer2.SplitterDistance;
  590. if (splitContainer2.SplitterDistance < splitContainer2.Parent.Width - 30)
  591. {
  592. ultraExpandableGroupBox2.Expanded = true;
  593. }
  594. else
  595. {
  596. ultraExpandableGroupBox2.Expanded = false;
  597. }
  598. }
  599. }
  600. private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
  601. {
  602. _groupBox2ExpandedChanged = true;
  603. if (ultraExpandableGroupBox2.Expanded == false)
  604. {
  605. splitContainer2.SplitterDistance = this.Width;
  606. }
  607. else
  608. {
  609. splitContainer2.SplitterDistance = _splitterDistance2;
  610. }
  611. _groupBox2ExpandedChanged = false;
  612. }
  613. private void ultraGridBl_AfterRowActivate(object sender, EventArgs e)
  614. {
  615. UltraGridRow ugr = this.ultraGridBl.ActiveRow;
  616. if (ugr == null)
  617. {
  618. return;
  619. }
  620. DoQueryJAndB(ugr.Cells["REQ_BL_ID"].Value.ToString());
  621. }
  622. private void ultraGridJgEdit_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
  623. {
  624. ultraGridJgGxM.UpdateData();
  625. ultraGridJgEdit.UpdateData();
  626. IQueryable<UltraGridRow> listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CODE_JG_BL = '"
  627. + e.Row.Cells["CODE_JG_BL"].Value.ToString() + "'");
  628. foreach (UltraGridRow uRow in listRow.ToArray())
  629. {
  630. uRow.Cells["CHC"].Value = true;
  631. IQueryable<UltraGridRow> rows = ultraGridJgGxM.Rows.AsQueryable().Where(" ProPlanId = '"
  632. + uRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
  633. uRow.Cells["NUM_JG"].Activation = Activation.AllowEdit;
  634. //foreach (UltraGridRow cRow in rows)
  635. //{
  636. // int num_jg = Convert.ToInt32(cRow.Cells["PlanNum"].Value) -
  637. // Convert.ToInt32(cRow.Cells["Matchnum"].Value) -
  638. // Convert.ToInt32(cRow.Cells["JgwtBlreq"].Value);
  639. // if (num_jg < 0)
  640. // {
  641. // num_jg = 0;
  642. // }
  643. // uRow.Cells["NUM_JG"].Value = num_jg;
  644. // break;
  645. //}
  646. }
  647. listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CODE_JG_BL != '"
  648. + e.Row.Cells["CODE_JG_BL"].Value.ToString() + "'");
  649. foreach (UltraGridRow uRow in listRow.ToArray())
  650. {
  651. uRow.Cells["CHC"].Value = false;
  652. uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
  653. //uRow.Cells["NUM_JG"].Value = 0;
  654. uRow.Cells["WEIGHT_JG"].Value = 0;
  655. uRow.Cells["NUM_JGBL"].Value = 0;
  656. uRow.Cells["JGBL_SUMLENTH"].Value = 0;
  657. uRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
  658. }
  659. }
  660. private void ultraGridJg_AfterRowActivate(object sender, EventArgs e)
  661. {
  662. UltraGridRow ugr = ultraGridJgGxM.ActiveRow;
  663. if (ugr == null)
  664. {
  665. return;
  666. }
  667. foreach (UltraGridRow uRow in ultraGridJgEdit.Rows)
  668. {
  669. if (uRow.Cells["PRO_PLAN_ID"].Value.ToString().Equals(
  670. ugr.Cells["ProPlanId"].Value.ToString()))
  671. {
  672. ultraGridJgEdit.ActiveRow = uRow;
  673. uRow.Appearance.ForeColor = System.Drawing.Color.DarkBlue;
  674. }
  675. else
  676. {
  677. uRow.Appearance.ForeColor = System.Drawing.Color.Black;
  678. }
  679. }
  680. //string strInFinished = "";
  681. //if (this.checkBoxFinish.Checked)
  682. //{
  683. // strInFinished = "1";
  684. //}
  685. //string strJgDdNo = ugr.Cells["ProPlanId"].Value.ToString();
  686. //DataTable dtEdit = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgDealedit",
  687. // new object[] { strJgDdNo, strInFinished }, _ob);
  688. //GridHelper.CopyDataToDatatable(dtEdit, dataTableEdit, true);
  689. }
  690. private void splitContainer3_SplitterMoved(object sender, SplitterEventArgs e)
  691. {
  692. if (_groupBox3ExpandedChanged == false || _groupBox4ExpandedChanged == false)
  693. {
  694. _splitterDistance3 = splitContainer3.SplitterDistance;
  695. if (splitContainer3.SplitterDistance > 25)
  696. {
  697. ultraExpandableGroupBox3.Expanded = true;
  698. }
  699. else
  700. {
  701. ultraExpandableGroupBox3.Expanded = false;
  702. }
  703. if (splitContainer3.SplitterDistance < splitContainer3.Parent.Height - 30)
  704. {
  705. ultraExpandableGroupBox4.Expanded = true;
  706. }
  707. else
  708. {
  709. ultraExpandableGroupBox4.Expanded = false;
  710. }
  711. }
  712. }
  713. private void ultraExpandableGroupBox3_ExpandedStateChanged(object sender, EventArgs e)
  714. {
  715. _groupBox3ExpandedChanged = true;
  716. if (ultraExpandableGroupBox3.Expanded == false)
  717. {
  718. _groupBox4ExpandedChanged = true;
  719. ultraExpandableGroupBox4.Expanded = true;
  720. splitContainer3.SplitterDistance = 0;
  721. _groupBox4ExpandedChanged = false;
  722. }
  723. else
  724. {
  725. splitContainer3.SplitterDistance = _splitterDistance3;
  726. }
  727. _groupBox3ExpandedChanged = false;
  728. }
  729. private void ultraExpandableGroupBox4_ExpandedStateChanged(object sender, EventArgs e)
  730. {
  731. _groupBox4ExpandedChanged = true;
  732. if (ultraExpandableGroupBox4.Expanded == false)
  733. {
  734. _groupBox3ExpandedChanged = true;
  735. ultraExpandableGroupBox3.Expanded = true;
  736. splitContainer3.SplitterDistance = this.Height;
  737. _groupBox3ExpandedChanged = false;
  738. }
  739. else
  740. {
  741. splitContainer3.SplitterDistance = _splitterDistance3;
  742. }
  743. _groupBox4ExpandedChanged = false;
  744. }
  745. private void checkBoxJgDdNo_CheckedChanged(object sender, EventArgs e)
  746. {
  747. if (checkBoxJgDdNo.Checked)
  748. {
  749. ultraComboJgDdNo.Enabled = true;
  750. }
  751. else
  752. {
  753. ultraComboJgDdNo.Enabled = false;
  754. }
  755. }
  756. private void checkBoxJglReqNo_CheckedChanged(object sender, EventArgs e)
  757. {
  758. if (checkBoxJglReqNo.Checked)
  759. {
  760. ultraComboJglReqNo.Enabled = true;
  761. }
  762. else
  763. {
  764. ultraComboJglReqNo.Enabled = false;
  765. }
  766. }
  767. private void ultraGridJgEdit_AfterCellActivate(object sender, EventArgs e)
  768. {
  769. UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
  770. if (ugr == null)
  771. {
  772. return;
  773. }
  774. ultraGridJgGxM.UpdateData();
  775. IQueryable<UltraGridRow> urow = ultraGridJgGxM.Rows.AsQueryable().Where(
  776. "ProPlanId = '" + ugr.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
  777. if (urow.Count() > 0)
  778. {
  779. ultraGridJgGxM.ActiveRow = urow.First();
  780. }
  781. }
  782. private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
  783. {
  784. if (_groupBox5ExpandedChanged == false)
  785. {
  786. _splitterDistance1 = splitContainer1.SplitterDistance;
  787. if (splitContainer1.SplitterDistance < splitContainer1.Parent.Height - 30)
  788. {
  789. ultraExpandableGroupBox5.Expanded = true;
  790. }
  791. else
  792. {
  793. ultraExpandableGroupBox5.Expanded = false;
  794. }
  795. }
  796. }
  797. private void ultraExpandableGroupBox5_ExpandedStateChanged(object sender, EventArgs e)
  798. {
  799. _groupBox5ExpandedChanged = true;
  800. if (ultraExpandableGroupBox5.Expanded == false)
  801. {
  802. splitContainer1.SplitterDistance = this.Height;
  803. }
  804. else
  805. {
  806. splitContainer1.SplitterDistance = _splitterDistance1;
  807. }
  808. _groupBox5ExpandedChanged = false;
  809. }
  810. private void ultraGridJgEdit_AfterRowActivate(object sender, EventArgs e)
  811. {
  812. UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
  813. if (ugr == null)
  814. {
  815. return;
  816. }
  817. DoQueryJgMOrd(ugr.Cells["PRO_PLAN_ID"].Value.ToString());
  818. }
  819. /// <summary>
  820. /// 修改万只废品数,修改产线
  821. /// </summary>
  822. /// <param name="sender"></param>
  823. /// <param name="e"></param>
  824. private void ultraGridJgEdit_ClickCellButton(object sender, CellEventArgs e)
  825. {
  826. UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
  827. if (ugr == null)
  828. {
  829. return;
  830. }
  831. string proPlanId = ugr.Cells["PRO_PLAN_ID"].Text;
  832. string inMaterialNo = ugr.Cells["BL_WL_ID"].Text;
  833. string outMaterialNo = ugr.Cells["CODE_JG"].Text;
  834. string plineCode = ugr.Cells["PLINE_CODE"].Value.ToString();
  835. int numJg = int.Parse(ugr.Cells["NUM_JG"].Text);
  836. FrmBaseMaterialHPl frmBase = new FrmBaseMaterialHPl(inMaterialNo, outMaterialNo, plineCode, _ob, proPlanId);
  837. frmBase.ShowDialog();
  838. bool flag = frmBase.Flag;
  839. if (flag)
  840. {
  841. //修改接箍订单接箍个数
  842. CoreClientParam ccp = new CoreClientParam();
  843. ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
  844. ccp.MethodName = "updatePlanGxJgM";
  845. ccp.ServerParams = new object[] { proPlanId};
  846. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  847. if (ccp.ReturnCode == -1) return;
  848. //MessageUtil.ShowTips(ccp.ReturnInfo);
  849. if (ccp.ReturnInfo.Equals("修改成功!"))
  850. {
  851. Query();
  852. }
  853. }
  854. }
  855. }
  856. }