FrmBomConfirm.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
  6. using Core.StlMes.Client.PlnSaleOrd.OrderManage.entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Drawing;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Windows.Forms;
  19. namespace Core.StlMes.Client.PlnSaleOrd.OrderManage.froms
  20. {
  21. public partial class FrmBomConfirm : FrmBase
  22. {
  23. private string Bom = "";//原BOM
  24. private string GradeCode = "";//原钢种代码
  25. private string GradeName = "";//原钢种
  26. private string SpecCode = "";//原规格代码
  27. private string SpecName = "";//原规格
  28. private string OrdLnDlyPk = "";//交货行PK
  29. private string ProPlanId = "";//订单编号
  30. private string GxPlanNo = "";//排产序号
  31. private string PlineCodeD = "";//轧管产线
  32. private ArrayList PlineCodeEList = null;//镦拔扩产线
  33. private ArrayList PlineCodeFList = null;//热处理产线
  34. private ArrayList PlineCodeGList = null;//加工产线
  35. private string MscPline = "";//原制程索引号
  36. private string Month = "";//轧制月份
  37. private string PassCode = "";//孔型代码
  38. private string PassName = "";//孔型
  39. private string DimaterManderl = "";//芯棒直径
  40. private string AimDimater = "";
  41. private string AimHeight = "";
  42. private string specCodeR = "";//轧管规格代码
  43. private string specNameR = "";//轧管规格
  44. private string indexSeq = "";//制程号
  45. public bool Flag = false;
  46. private string[] groupCic = null;
  47. private string cicGp = "";
  48. private string PlineCodeZz = "";//铸造产线
  49. private int num = 0;
  50. public FrmBomConfirm()
  51. {
  52. InitializeComponent();
  53. }
  54. public FrmBomConfirm(string ordLnDlyPk, string proPlanId, string gxPlanNo, OpeBase ob, string[] _groupCic, string _cicGp, int _num)
  55. {
  56. InitializeComponent();
  57. num=_num;
  58. this.OrdLnDlyPk = ordLnDlyPk;
  59. this.ProPlanId = proPlanId;
  60. this.GxPlanNo = gxPlanNo;
  61. this.ob = ob;
  62. groupCic = _groupCic;
  63. cicGp = _cicGp;
  64. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  65. }
  66. private void FrmBomConfirm_Load(object sender, EventArgs e)
  67. {
  68. BaseHelper.setOtherColumnReadOnly(entityGridBom, new string[] { "" });
  69. BaseHelper.setOtherColumnReadOnly(entityGridD, new string[] { "" });
  70. BaseHelper.setOtherColumnReadOnly(entityGridE, new string[] { "" });
  71. BaseHelper.setOtherColumnReadOnly(entityGridF, new string[] { "" });
  72. BaseHelper.setOtherColumnReadOnly(entityGridG, new string[] { "" });
  73. BaseHelper.setOtherColumnReadOnly(entityGridPass, new string[] { "" });
  74. BaseHelper.setOtherColumnReadOnly(entityGridDimater, new string[] { "" });
  75. BaseHelper.setOtherColumnReadOnly(ultraGridGrade, new string[] { "" });
  76. BaseHelper.InitCellPosition(entityGridD, new string[] { "HrCapcty", "PrdRate", "DblLenMax", "RolLenMin", "RolLenMax", "CropEnd", "MandrelSize" });
  77. BaseHelper.InitCellPosition(entityGridE, new string[] { "HrCapcty" });
  78. BaseHelper.InitCellPosition(entityGridF, new string[] { "HrCapcty" });
  79. BaseHelper.InitCellPosition(entityGridG, new string[] { "HrCapcty" });
  80. BaseHelper.InitCellPosition(entityGridPass, new string[] { "PassName" });
  81. BaseHelper.InitCellPosition(entityGridDimater, new string[] { "DiameterMandrel" });
  82. InitData();
  83. }
  84. private void InitData()
  85. {
  86. GetPlineEByProPlanId(ProPlanId);
  87. GetPlineFByProPlanId(ProPlanId);
  88. GetPlineGByProPlanId(ProPlanId);
  89. GetZgPlanInfo(ProPlanId, GxPlanNo);
  90. //GetPlanOrderInfo(OrdLnDlyPk, ProPlanId);
  91. GetSpecBySpecName(SpecName);
  92. txtSpec.Value = SpecName;
  93. txtGrade.Value = GradeName;
  94. txtDimater.Value = DimaterManderl;
  95. txtPass.Value = PassName;
  96. GetBomByOrdLnDlyPk(OrdLnDlyPk);
  97. GetGradeCic(GradeCode);
  98. GetPlineCodeZz(ProPlanId, GxPlanNo);
  99. }
  100. private void GetPlineCodeZz(string ProPlanId, string GxPlanNo)
  101. {
  102. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.queryZzPlin",
  103. new object[] { ProPlanId, GxPlanNo }, this.ob);
  104. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  105. foreach (UltraGridRow ugr in entityGridZz.Rows)
  106. {
  107. string stdIdx = ugr.Cells["PLINE_CODE"].Value.ToString();
  108. if (stdIdx.Equals(PlineCodeZz))
  109. {
  110. ugr.Appearance.BackColor = Color.GreenYellow;
  111. ugr.Activate();
  112. return;
  113. }
  114. }
  115. }
  116. /// <summary>
  117. /// 查询轧管订单信息
  118. /// </summary>
  119. /// <param name="proPlanId"></param>
  120. /// <param name="gxPlanNo"></param>
  121. public void GetZgPlanInfo(string proPlanId, string gxPlanNo)
  122. {
  123. DataTable listSource = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getZgPlanInfo",
  124. new object[] { ProPlanId, GxPlanNo }, this.ob);
  125. if (listSource.Rows.Count > 0)
  126. {
  127. this.PlineCodeD = listSource.Rows[0]["PLINE_CODE"].ToString();
  128. this.SpecName = listSource.Rows[0]["DIAMETER_GP"].ToString();
  129. this.Month = listSource.Rows[0]["PRO_MONTH"].ToString();
  130. this.PassName = listSource.Rows[0]["PASS_NAME"].ToString();
  131. this.PassCode = listSource.Rows[0]["PASS_CODE"].ToString();
  132. this.DimaterManderl = listSource.Rows[0]["DIAMETER_MANDREL"].ToString();
  133. this.AimDimater = listSource.Rows[0]["OUTDIAMETER_ZG"].ToString();
  134. this.AimHeight = listSource.Rows[0]["WALLTHICK_ZG"].ToString();
  135. this.GradeCode = listSource.Rows[0]["GRADECODE"].ToString();
  136. this.GradeName = listSource.Rows[0]["GRADENAME"].ToString();
  137. MscPline = listSource.Rows[0]["INDEX_SEQ"].ToString();
  138. Bom = listSource.Rows[0]["BOM"].ToString();
  139. PlineCodeZz = listSource.Rows[0]["PLINE_CODE_ZZ"].ToString();
  140. }
  141. }
  142. /// <summary>
  143. /// 查询轧管工序合同
  144. /// </summary>
  145. /// <param name="ordLnDlyPk"></param>
  146. /// <param name="proPlanId"></param>
  147. //public void GetPlanOrderInfo(string ordLnDlyPk, string proPlanId)
  148. //{
  149. // DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlanOrderInfo", new object[] { ordLnDlyPk, proPlanId }, this.ob);
  150. // if (dt != null && dt.Rows.Count > 0)
  151. // {
  152. // MscPline = dt.Rows[0]["INDEX_SEQ"].ToString();
  153. // //Bom = dt.Rows[0]["Bom"].ToString();
  154. // }
  155. // else { MscPline = ""; Bom = ""; }
  156. //}
  157. /// <summary>
  158. /// 通过规格名称查询规格代码
  159. /// </summary>
  160. /// <param name="ordLnDlyPk"></param>
  161. /// <param name="proPlanId"></param>
  162. public void GetSpecBySpecName(string specName)
  163. {
  164. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getSpecBySpecName", new object[] { specName }, this.ob);
  165. if (dt != null && dt.Rows.Count > 0)
  166. {
  167. SpecCode = dt.Rows[0]["SPEC_CODE"].ToString();
  168. }
  169. else { SpecCode = ""; }
  170. }
  171. /// <summary>
  172. /// 查询BOM
  173. /// </summary>
  174. /// <param name="ordLnDlyPk"></param>
  175. public void GetBomByOrdLnDlyPk(string ordLnDlyPk)
  176. {
  177. List<SlmOrdDesignBomEntity> listSource = EntityHelper.GetData<SlmOrdDesignBomEntity>
  178. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getBomByOrdLnDlyPk",
  179. new object[] { ordLnDlyPk }, this.ob);
  180. slmOrdDesignBomEntityBindingSource.DataSource = listSource;
  181. if (listSource != null && listSource.Count > 0)
  182. {
  183. foreach (UltraGridRow ugr in entityGridBom.Rows)
  184. {
  185. specCodeR = ugr.Cells["SpecCodeR"].Text.ToString();
  186. specNameR = ugr.Cells["SpecNameR"].Text.ToString();
  187. string bom = ugr.Cells["Bom"].Value.ToString();
  188. string grade = ugr.Cells["Gradename"].Value.ToString();
  189. string plinMsc = ugr.Cells["MscPline"].Value.ToString();
  190. if (bom.Equals(Bom) && grade.Equals(GradeName) && plinMsc.Equals(MscPline))
  191. {
  192. ugr.Appearance.BackColor = Color.GreenYellow;
  193. ugr.Activate();
  194. return;
  195. }
  196. }
  197. }
  198. }
  199. /// <summary>
  200. /// 通过产线与管坯规格查询孔型
  201. /// </summary>
  202. /// <param name="plineCode"></param>
  203. /// <param name="specName"></param>
  204. public void GetPassCodeByPlineAndSpec(string plineCode, string speCode)
  205. {
  206. List<comBasePassModelEntity> listSource = EntityHelper.GetData<comBasePassModelEntity>
  207. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPassCodeByPlineAndSpec",
  208. new object[] { plineCode, speCode }, this.ob);
  209. comBasePassModelEntityBindingSource.DataSource = listSource;
  210. if (listSource != null && listSource.Count() > 0)
  211. {
  212. foreach (UltraGridRow ugr in entityGridPass.Rows)
  213. {
  214. comBasePassModelEntity entity = (comBasePassModelEntity)ugr.ListObject;
  215. if (entity.PassCode.Equals(PassCode))
  216. {
  217. ugr.Appearance.BackColor = Color.GreenYellow;
  218. ugr.Cells["CHC"].Value = true;
  219. ugr.Activate();
  220. }
  221. }
  222. }
  223. }
  224. /// <summary>
  225. /// 查询芯棒
  226. /// </summary>
  227. /// <param name="plineCode"></param>
  228. /// <param name="passCode"></param>
  229. /// <param name="dimater"></param>
  230. /// <param name="height"></param>
  231. public void GetDiameterMandrel(String plineCode, String passCode, String dimater, String height)
  232. {
  233. List<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity>
  234. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getDiameterMandrel",
  235. new object[] { plineCode, passCode, dimater, height }, this.ob);
  236. comBaseMandrelEntityBindingSource.DataSource = listSource;
  237. if (listSource != null && listSource.Count() > 0)
  238. {
  239. if (DimaterManderl.Equals("") || DimaterManderl == null)
  240. {
  241. DimaterManderl = "0";
  242. }
  243. foreach (UltraGridRow ugr in entityGridDimater.Rows)
  244. {
  245. Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity entity = (Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity)ugr.ListObject;
  246. string DiameterMandrelEntity = entity.DiameterMandrel.ToString();
  247. if (entity.DiameterMandrel.ToString().Equals("") || entity.DiameterMandrel.ToString() == null)
  248. {
  249. DiameterMandrelEntity = "0";
  250. }
  251. if (Math.Abs(Double.Parse(DiameterMandrelEntity) - Double.Parse(DimaterManderl)) <= 0.00001)
  252. {
  253. ugr.Appearance.BackColor = Color.GreenYellow;
  254. ugr.Cells["CHC"].Value = true;
  255. ugr.Activate();
  256. }
  257. }
  258. }
  259. }
  260. /// <summary>
  261. /// 通过产线与管坯规格查询孔型
  262. /// </summary>
  263. /// <param name="plineCode"></param>
  264. /// <param name="specName"></param>
  265. public ArrayList getPassCodeByPlineAndMonth(string plineCode, string month)
  266. {
  267. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPassCodeByPlineAndMonth", new object[] { plineCode, month }, this.ob);
  268. ArrayList passCodeList = null;
  269. if (dt != null && dt.Rows.Count > 0)
  270. {
  271. passCodeList = new ArrayList();
  272. for(int i=0;i<dt.Rows.Count;i++){
  273. passCodeList.Add(dt.Rows[i]["PASS_CODE"].ToString());
  274. }
  275. }
  276. return passCodeList;
  277. }
  278. /// <summary>
  279. /// 通过轧制订单编号查询镦拔扩产线
  280. /// </summary>
  281. /// <param name="proPlanId"></param>
  282. public void GetPlineEByProPlanId(string proPlanId)
  283. {
  284. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineEByProPlanId", new object[] { proPlanId }, this.ob);
  285. if (dt != null && dt.Rows.Count > 0)
  286. {
  287. PlineCodeEList = new ArrayList();
  288. foreach (DataRow dr in dt.Rows)
  289. {
  290. PlineCodeEList.Add(dr["PLINE_CODE"].ToString());
  291. }
  292. }
  293. }
  294. /// <summary>
  295. /// 通过轧制订单编号查询热处理产线
  296. /// </summary>
  297. /// <param name="proPlanId"></param>
  298. public void GetPlineFByProPlanId(string proPlanId)
  299. {
  300. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineFByProPlanId", new object[] { proPlanId }, this.ob);
  301. if (dt != null && dt.Rows.Count > 0)
  302. {
  303. PlineCodeFList = new ArrayList();
  304. foreach (DataRow dr in dt.Rows)
  305. {
  306. PlineCodeFList.Add(dr["PLINE_CODE"].ToString());
  307. }
  308. }
  309. }
  310. /// <summary>
  311. /// 通过轧制订单编号查询加工产线
  312. /// </summary>
  313. /// <param name="proPlanId"></param>
  314. public void GetPlineGByProPlanId(string proPlanId)
  315. {
  316. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineGByProPlanId", new object[] { proPlanId }, this.ob);
  317. if (dt != null && dt.Rows.Count > 0)
  318. {
  319. PlineCodeGList = new ArrayList();
  320. foreach (DataRow dr in dt.Rows)
  321. {
  322. PlineCodeGList.Add(dr["PLINE_CODE"].ToString());
  323. }
  324. }
  325. }
  326. /// <summary>
  327. /// 查询轧管产线能力
  328. /// </summary>
  329. /// <param name="inMaterialNo">投入物料</param>
  330. /// <param name="outMaterialNo">产出物料</param>
  331. /// <param name="designKey">工艺主键</param>
  332. /// <param name="mscPline">制程</param>
  333. public void GetPlineD(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
  334. {
  335. List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity>
  336. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineD",
  337. new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
  338. slmBaseMaterialDPlEntityBindingSource.DataSource = listSource;
  339. if (listSource != null && listSource.Count() > 0)
  340. {
  341. foreach (UltraGridRow ugr in entityGridD.Rows)
  342. {
  343. if (ugr.GetValue("PlineCode").Equals(PlineCodeD))
  344. {
  345. ugr.Appearance.BackColor = Color.GreenYellow;
  346. ugr.Cells["CHC"].Value = true;
  347. ugr.Activate();
  348. }
  349. }
  350. }
  351. }
  352. /// <summary>
  353. /// 查询镦拔扩产线能力
  354. /// </summary>
  355. /// <param name="inMaterialNo">投入物料</param>
  356. /// <param name="outMaterialNo">产出物料</param>
  357. /// <param name="designKey">工艺主键</param>
  358. /// <param name="mscPline">制程</param>
  359. public void GetPlineE(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
  360. {
  361. List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity>
  362. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineE",
  363. new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
  364. slmBaseMaterialEPlEntityBindingSource.DataSource = listSource;
  365. if (listSource != null && listSource.Count() > 0 && PlineCodeEList != null)
  366. {
  367. foreach (UltraGridRow ugr in entityGridE.Rows)
  368. {
  369. if (PlineCodeEList.Contains(ugr.GetValue("PlineCode")))
  370. {
  371. ugr.Appearance.BackColor = Color.GreenYellow;
  372. ugr.Cells["CHC"].Value = true;
  373. }
  374. }
  375. }
  376. }
  377. /// <summary>
  378. /// 查询热处理产线能力
  379. /// </summary>
  380. /// <param name="inMaterialNo">投入物料</param>
  381. /// <param name="outMaterialNo">产出物料</param>
  382. /// <param name="designKey">工艺主键</param>
  383. /// <param name="mscPline">制程</param>
  384. public void GetPlineF(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
  385. {
  386. List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity>
  387. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineF",
  388. new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
  389. slmBaseMaterialFPlEntityBindingSource.DataSource = listSource;
  390. if (listSource != null && listSource.Count() > 0 && PlineCodeFList != null)
  391. {
  392. foreach (UltraGridRow ugr in entityGridF.Rows)
  393. {
  394. if (PlineCodeFList.Contains(ugr.GetValue("PlineCode")))
  395. {
  396. ugr.Appearance.BackColor = Color.GreenYellow;
  397. ugr.Cells["CHC"].Value = true;
  398. }
  399. }
  400. }
  401. }
  402. /// <summary>
  403. /// 查询加工产线能力
  404. /// </summary>
  405. /// <param name="inMaterialNo">投入物料</param>
  406. /// <param name="outMaterialNo">产出物料</param>
  407. /// <param name="designKey">工艺主键</param>
  408. /// <param name="mscPline">制程</param>
  409. public void GetPlineG(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
  410. {
  411. List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity>
  412. ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineG",
  413. new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
  414. slmBaseMaterialKPlEntityBindingSource.DataSource = listSource;
  415. if (listSource != null && listSource.Count() > 0 && PlineCodeGList != null)
  416. {
  417. foreach (UltraGridRow ugr in entityGridG.Rows)
  418. {
  419. if (PlineCodeGList.Contains(ugr.GetValue("PlineCode")))
  420. {
  421. ugr.Appearance.BackColor = Color.GreenYellow;
  422. ugr.Cells["CHC"].Value = true;
  423. }
  424. }
  425. }
  426. }
  427. /// <summary>
  428. /// 钢种索引码
  429. /// </summary>
  430. private void GetGradeCic(string gradCode)
  431. {
  432. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getQueryGrade",
  433. new object[] { groupCic }, ob);
  434. DataRow[] dr = dt.Select("GRADECODE LIKE '" + gradCode + "'", "");
  435. if (dr == null || dr.Length == 0)
  436. {
  437. DataTable dt1 = new DataTable();
  438. GridHelper.CopyDataToDatatable(dt1, this.dataTable1, true);
  439. return;
  440. }
  441. DataTable tmp = dr[0].Table.Clone(); // 复制DataRow的表结构
  442. foreach (DataRow row in dr)
  443. {
  444. tmp.ImportRow(row); // 将DataRow添加到DataTable中
  445. }
  446. GridHelper.CopyDataToDatatable(tmp, this.dataTable1, true);
  447. foreach (UltraGridRow ugr in ultraGridGrade.Rows)
  448. {
  449. string stdIdx = ugr.Cells["CIC"].Value.ToString();
  450. if (stdIdx.Equals(cicGp))
  451. {
  452. ugr.Appearance.BackColor = Color.GreenYellow;
  453. ugr.Activate();
  454. return;
  455. }
  456. }
  457. }
  458. private void entityGridBom_AfterRowActivate(object sender, EventArgs e)
  459. {
  460. UltraGridRow ugr = entityGridBom.ActiveRow;
  461. if (ugr == null)
  462. {
  463. slmBaseMaterialDPlEntityBindingSource.Clear();
  464. slmBaseMaterialEPlEntityBindingSource.Clear();
  465. slmBaseMaterialFPlEntityBindingSource.Clear();
  466. slmBaseMaterialKPlEntityBindingSource.Clear();
  467. }
  468. else
  469. {
  470. BaseHelper.SetRowChecked(entityGridBom);
  471. SlmOrdDesignBomEntity entity = (SlmOrdDesignBomEntity)ugr.ListObject;
  472. string wholeBacklog = entity.WholeBacklog;
  473. if (wholeBacklog.Contains("D"))
  474. {
  475. ultraTabControl1.Tabs[0].Enabled = true;
  476. GetPlineD(entity.DInMaterialNo, entity.DOutMaterialNo, entity.DesignKey, entity.MscPline);
  477. }
  478. else
  479. {
  480. ultraTabControl1.Tabs[0].Enabled = false;
  481. }
  482. if (wholeBacklog.Contains("E"))
  483. {
  484. ultraTabControl1.Tabs[1].Enabled = true;
  485. GetPlineE(entity.EInMaterialNo, entity.EOutMaterialNo, entity.DesignKey, entity.MscPline);
  486. }
  487. else
  488. {
  489. ultraTabControl1.Tabs[1].Enabled = false;
  490. }
  491. if (wholeBacklog.Contains("F"))
  492. {
  493. ultraTabControl1.Tabs[2].Enabled = true;
  494. GetPlineF(entity.FInMaterialNo, entity.FOutMaterialNo, entity.DesignKey, entity.MscPline);
  495. }
  496. else
  497. {
  498. ultraTabControl1.Tabs[2].Enabled = false;
  499. }
  500. if (wholeBacklog.Contains("G"))
  501. {
  502. ultraTabControl1.Tabs[3].Enabled = true;
  503. GetPlineG(entity.IInMaterialNo, entity.IOutMaterialNo, entity.DesignKey, entity.MscPline);
  504. }
  505. else
  506. {
  507. ultraTabControl1.Tabs[3].Enabled = false;
  508. }
  509. GetGradeCic(entity.Gradecode);
  510. }
  511. }
  512. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  513. {
  514. switch (e.Tool.Key)
  515. {
  516. case "ChangeGrade": // ButtonTool
  517. ChangeZgPlan("1");
  518. break;
  519. case "ChangeSpec": // ButtonTool
  520. ChangeZgPlan("2");
  521. break;
  522. case "ChangePline": // ButtonTool
  523. ChangeZgPlan("3");
  524. break;
  525. case "Close": // ButtonTool
  526. this.Close();
  527. break;
  528. }
  529. }
  530. private void ChangeZgPlan(string flag)
  531. {
  532. entityGridBom.UpdateData();
  533. entityGridD.UpdateData();
  534. string cic = "";
  535. string casTyte = "";
  536. //BOM
  537. ArrayList bomList = BaseHelper.GetRows<SlmOrdDesignBomEntity>(entityGridBom, "CHC", "True");
  538. if (bomList == null || bomList.Count > 1) { MessageUtil.ShowWarning("请选择BOM!", entityGridBom); return; }
  539. SlmOrdDesignBomEntity bomEntity = (SlmOrdDesignBomEntity)bomList[0];
  540. if (!bomEntity.MscPline.Equals(MscPline))
  541. {
  542. MessageUtil.ShowWarning("制程发生改变,请重新选择BOM(如需变更制程,请重新下发)!", entityGridBom); return;
  543. }
  544. //判断投入产出是否禁用
  545. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.changeZgInOutMate", new object[] { PlineCodeD, bomEntity.DInMaterialNo, bomEntity.DOutMaterialNo }, ob);
  546. if (dt.Rows.Count > 0)
  547. {
  548. MessageUtil.ShowWarning("选择的投入产出在投入产出物料及产线能力维护表里已经被禁用了!", entityGridBom); return;
  549. }
  550. //轧管产线
  551. ArrayList plineDList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity>(entityGridD, "CHC", "True");
  552. if (plineDList == null || plineDList.Count > 1) { MessageUtil.ShowWarning("请选择轧管产线!", entityGridD); return; }
  553. Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity plineDentiy = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)plineDList[0];
  554. string plineCode = plineDentiy.PlineCode;
  555. string plineName = plineDentiy.PlineName;
  556. //孔型
  557. ArrayList passList = BaseHelper.GetRows<comBasePassModelEntity>(entityGridPass, "CHC", "True");
  558. if (passList == null || passList.Count > 1) { MessageUtil.ShowWarning("请选择孔型!", entityGridPass); return; }
  559. comBasePassModelEntity passEntity = (comBasePassModelEntity)passList[0];
  560. string passCode = passEntity.PassCode;
  561. string passName = passEntity.PassName;
  562. //验证孔型
  563. ArrayList passCodeList = getPassCodeByPlineAndMonth(plineCode,Month);
  564. if (passCodeList == null || !passCodeList.Contains(passCode))
  565. {
  566. MessageUtil.ShowWarning("没有维护产线:" + plineName+ " "+ Month + "的孔型计划!", entityGridBom); return;
  567. }
  568. //芯棒
  569. ArrayList dimaterList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity>(entityGridDimater, "CHC", "True");
  570. string dimaterManderl = "0";
  571. if (dimaterList != null && dimaterList.Count > 0)
  572. {
  573. Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity dimaterEntity = (Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity)dimaterList[0];
  574. dimaterManderl = dimaterEntity.DiameterMandrel.ToString();
  575. }
  576. //if (PlineCodeEList != null)
  577. //{
  578. // ArrayList plineEList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity>(entityGridE, "CHC", "True");
  579. // if (plineEList == null) { MessageUtil.ShowWarning("BOM没有相应的镦拔扩产线,不能修改!", entityGridE); return; }
  580. //}
  581. //if (PlineCodeFList != null)
  582. //{
  583. // ArrayList plineFList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity>(entityGridF, "CHC", "True");
  584. // if (plineFList == null) { MessageUtil.ShowWarning("BOM没有相应的热处理产线,不能修改!", entityGridF); return; }
  585. //}
  586. //if (PlineCodeGList != null)
  587. //{
  588. // ArrayList plineGList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity>(entityGridG, "CHC", "True");
  589. // if (plineGList == null) { MessageUtil.ShowWarning("BOM没有相应的加工产线,不能修改!", entityGridG); return; }
  590. //}
  591. //管坯规格
  592. string specCode = bomEntity.SpecCodeD;//制程管坯规格
  593. string specName = bomEntity.SpecNameD;
  594. if (specCode.Equals("")) { specCode = bomEntity.SpecCodeZ; specName = bomEntity.SpecNameZ; }
  595. if (!bomEntity.SpecCodeR.Equals(specCodeR))
  596. {
  597. MessageUtil.ShowWarning("轧管规格不同,不能修改!", entityGridBom); return;
  598. }
  599. if (flag.Equals("1"))
  600. {
  601. if (bomEntity.Gradecode.Equals(GradeCode) || !specCode.Equals(SpecCode))
  602. {
  603. MessageUtil.ShowWarning("钢种没有改变/规格发生改变,不能修改钢种!", entityGridBom); return;
  604. }
  605. }
  606. if (flag.Equals("2"))
  607. {
  608. if (specCode.Equals(SpecCode) || !bomEntity.Gradecode.Equals(GradeCode))
  609. {
  610. MessageUtil.ShowWarning("规格没有改变/钢种发生改变,不能修改规格!", entityGridBom); return;
  611. }
  612. }
  613. ultraGridGrade.UpdateData();
  614. UltraGridRow row = ultraGridGrade.ActiveRow;
  615. if (row != null)
  616. {
  617. int count = 0;
  618. foreach (UltraGridRow rows in ultraGridGrade.Rows)
  619. {
  620. if (Convert.ToBoolean(rows.Cells["CHC"].Text) == true)
  621. {
  622. count++;
  623. cic = rows.Cells["CIC"].Text.ToString();
  624. if (rows.Cells["ALLOW_BUY"].Text.ToString().Equals("自炼"))
  625. {
  626. casTyte = "0";
  627. }
  628. else
  629. {
  630. casTyte = "1";
  631. }
  632. }
  633. }
  634. if (count == 0)
  635. {
  636. MessageUtil.ShowWarning("请选择钢种索引码!", entityGridBom); return;
  637. }
  638. }
  639. else
  640. {
  641. MessageUtil.ShowTips("无索引码!"); return;
  642. }
  643. entityGridZz.UpdateData();
  644. UltraGridRow rowZz = entityGridZz.ActiveRow;
  645. string plineCodeZz = "";
  646. string plineNameZz = "";
  647. if (bomEntity.WholeBacklog.ToString().Contains("B"))
  648. {
  649. if (rowZz == null) { MessageUtil.ShowTips("无适用铸造产线!"); return; }
  650. else
  651. {
  652. int countZz = 0;
  653. foreach (UltraGridRow rowsZ in entityGridZz.Rows)
  654. {
  655. if (Convert.ToBoolean(rowsZ.Cells["CHC"].Text) == true)
  656. {
  657. countZz++;
  658. plineCodeZz = rowsZ.Cells["PLINE_CODE"].Text.ToString();
  659. plineNameZz = rowsZ.Cells["PLINE_NAME"].Text.ToString();
  660. if (casTyte.Equals("1"))
  661. {
  662. if (!plineCodeZz.Equals("C063"))
  663. {
  664. rowsZ.Cells["CHC"].Value = false;
  665. plineCodeZz = "C063";
  666. plineNameZz = "连铸坯(外购)";
  667. //MessageUtil.ShowTips("请选择适用铸造外购产线!");
  668. //return;
  669. }
  670. }
  671. else
  672. {
  673. if (plineCodeZz.Equals("C063"))
  674. {
  675. MessageUtil.ShowTips("请选择适用铸造自炼产线!");
  676. return;
  677. }
  678. }
  679. }
  680. }
  681. if (casTyte.Equals("0"))
  682. {
  683. if (countZz == 0)
  684. {
  685. MessageUtil.ShowWarning("请选择适用铸造产线!", entityGridBom); return;
  686. }
  687. }
  688. }
  689. }
  690. if (num > 0)
  691. {
  692. //if (MessageUtil.ShowYesNoAndQuestion("存在LJ,装炉,出库支吨,是否需要拆分行?") == DialogResult.Yes)
  693. //{
  694. // return;
  695. //}
  696. if (MessageUtil.ShowYesNoAndQuestion("存在LJ支吨,是否需要拆分行?") == DialogResult.Yes)
  697. {
  698. return;
  699. }
  700. }
  701. string message = "";
  702. if (flag.Equals("1")) { message = "是否修改钢种?"; } else if (flag.Equals("2")) { message = "是否修改规格?"; } else { message = "是否修改产线/孔型/芯棒/坯子来源?"; }
  703. if (MessageUtil.ShowYesNoAndQuestion(message) == DialogResult.No)
  704. {
  705. return;
  706. }
  707. string[] param = BaseHelper.SetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.changeZgPlan", new object[] { bomEntity.Bom, plineCode,
  708. plineName, specName, passCode,
  709. passName, dimaterManderl, ProPlanId,
  710. GxPlanNo,cic,casTyte,plineCodeZz,plineNameZz}, ob);
  711. if (param == null) { MessageUtil.ShowWarning("服务端处理失败!", entityGridBom); }
  712. else
  713. {
  714. //MessageUtil.ShowWarning(param[1], entityGridBom);
  715. MessageUtil.ShowTips(param[1]);
  716. if ((bool.Parse(param[0]))) { Flag = true; InitData(); }
  717. }
  718. }
  719. private void entityGridD_AfterRowActivate(object sender, EventArgs e)
  720. {
  721. UltraGridRow ugr = entityGridD.ActiveRow;
  722. if (ugr == null)
  723. {
  724. comBasePassModelEntityBindingSource.Clear();
  725. comBaseMandrelEntityBindingSource.Clear();
  726. return;
  727. }
  728. ArrayList bomList = BaseHelper.GetRows<SlmOrdDesignBomEntity>(entityGridBom, "CHC", "True");
  729. SlmOrdDesignBomEntity bomEntity = (SlmOrdDesignBomEntity)bomList[0];
  730. string specCode = bomEntity.SpecCodeD;
  731. if (specCode.Equals(""))
  732. {
  733. specCode = bomEntity.SpecCodeZ;
  734. }
  735. BaseHelper.SetRowChecked(entityGridD);
  736. Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity entity = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)ugr.ListObject;
  737. string plineCode = entity.PlineCode;
  738. GetPassCodeByPlineAndSpec(plineCode, specCode);
  739. }
  740. private void entityGridPass_AfterRowActivate(object sender, EventArgs e)
  741. {
  742. UltraGridRow ugr = entityGridPass.ActiveRow;
  743. if (ugr == null)
  744. {
  745. comBaseMandrelEntityBindingSource.Clear();
  746. return;
  747. }
  748. BaseHelper.SetRowChecked(entityGridPass);
  749. comBasePassModelEntity entity = (comBasePassModelEntity)ugr.ListObject;
  750. string passCode = entity.PassCode;
  751. UltraGridRow ugrD = entityGridD.ActiveRow;
  752. Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity entityD = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)ugrD.ListObject;
  753. string plineCode = entityD.PlineCode;
  754. GetDiameterMandrel(plineCode, passCode, AimDimater, AimHeight);
  755. }
  756. private void entityGridDimater_AfterRowActivate(object sender, EventArgs e)
  757. {
  758. UltraGridRow ugr = entityGridDimater.ActiveRow;
  759. if (ugr == null)
  760. {
  761. return;
  762. }
  763. BaseHelper.SetRowChecked(entityGridDimater);
  764. }
  765. private void ultraGridGrade_AfterRowActivate(object sender, EventArgs e)
  766. {
  767. UltraGridRow ugr = ultraGridGrade.ActiveRow;
  768. if (ugr == null)
  769. {
  770. return;
  771. }
  772. BaseHelper.SetRowChecked(ultraGridGrade);
  773. UltraGridRow ugr1 = entityGridZz.ActiveRow;
  774. if (ugr1 == null)
  775. {
  776. return;
  777. }
  778. foreach (UltraGridRow row in entityGridZz.Rows)
  779. {
  780. string stdIdx = row.Cells["PLINE_CODE"].Value.ToString();
  781. if (ugr.Cells["ALLOW_BUY"].Text.ToString().Equals("自炼"))
  782. {
  783. if (!stdIdx.Equals("C063"))
  784. {
  785. ugr.Appearance.BackColor = Color.GreenYellow;
  786. ugr.Activate();
  787. return;
  788. }
  789. }
  790. else
  791. {
  792. if (stdIdx.Equals("C063"))
  793. {
  794. ugr.Appearance.BackColor = Color.GreenYellow;
  795. ugr.Activate();
  796. return;
  797. }
  798. }
  799. }
  800. }
  801. private void entityGridZz_AfterRowActivate(object sender, EventArgs e)
  802. {
  803. UltraGridRow ugr = entityGridZz.ActiveRow;
  804. if (ugr == null)
  805. {
  806. return;
  807. }
  808. BaseHelper.SetRowChecked(entityGridZz);
  809. }
  810. }
  811. }