frmPipStoreRed.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.StlMes.Client.YdmBase;
  11. using Core.StlMes.Client.YdmPipeManage.Tool;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Core.Mes.Client.Comm.Tool;
  15. using System.Collections;
  16. using Infragistics.Win.UltraWinEditors;
  17. using Infragistics.Win.UltraWinGrid;
  18. using com.steering.pss.ydm.entity;
  19. using Core.StlMes.Client.YdmPipeManage.Controls;
  20. using Core.StlMes.Client.YdmPipeManage.Entity;
  21. namespace Core.StlMes.Client.YdmPipeManage
  22. {
  23. public partial class frmPipStoreRed : FrmBase
  24. {
  25. public frmPipStoreRed()
  26. {
  27. this.IsLoadUserView = true;
  28. InitializeComponent();
  29. }
  30. private void frmPipStoreRed_Load(object sender, EventArgs e)
  31. {
  32. StartTime.Value = DateTime.Parse(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString());
  33. //StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
  34. DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
  35. //EndTime.Value = DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd") + " 23:59:59");
  36. EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") +" 23:59:59");
  37. this.StartTime.Enabled = false;
  38. this.EndTime.Enabled = false;
  39. this.cmbJudge.Enabled = false;
  40. this.cmbOrder.Enabled = false;
  41. this.cmbStorager.Enabled = false;
  42. Init();
  43. }
  44. UltraComboEditor stroreName = new UltraComboEditor();
  45. string strInbound = "800704";//产出红冲
  46. private void Init()
  47. {
  48. YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  49. YdmBaseClass.InitComboEditor(stroreName, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  50. YdmBaseClass.BindColumn(stroreName, "STORAGE_NO", this.Controls, this.ultraGrid2, 0);
  51. BaseMethod.InitPline(cmbFactory, this.ob);
  52. BaseMethod.InitSourse(cmbSource, this.ob);
  53. //YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
  54. }
  55. /// <summary>
  56. /// 重写基类方法
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="ToolbarKey"></param>
  60. public override void ToolBar_Click(object sender, string ToolbarKey)
  61. {
  62. switch (ToolbarKey)
  63. {
  64. case "Query2":
  65. QueryMat();
  66. break;
  67. case"Query1":
  68. getInList();
  69. break;
  70. case "pipRedStore":
  71. pipRedStore();
  72. break;
  73. case "CanclePipe":
  74. DoCanclePipeIn();
  75. break;
  76. case"adjust":
  77. adjustYear();
  78. break;
  79. case"Export":
  80. exportData();
  81. break;
  82. case "Close":
  83. this.Close();
  84. break;
  85. }
  86. }
  87. /// <summary>
  88. /// 调整结转年月
  89. /// </summary>
  90. private void adjustYear()
  91. {
  92. this.ultraGrid4.UpdateData();
  93. ArrayList list = new ArrayList();
  94. ArrayList parm = new ArrayList();
  95. int isUpdate = 0;
  96. string inDoc = "";
  97. string heatNo = "";
  98. string mothYear = "";
  99. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
  100. foreach (UltraGridRow uRow in ultraGrid4.Rows)
  101. {
  102. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  103. {
  104. isUpdate += 1;
  105. inDoc = uRow.Cells["INSTOCK_DOC"].Value.ToString();
  106. heatNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
  107. mothYear = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
  108. parm.Add(DateTime.Now.ToString("yyyyMM"));
  109. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeEnter.selectYearMoth", new object[] { parm, arr }, ob);
  110. if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  111. {
  112. MessageUtil.ShowTips("此炉【" + heatNo + "】已进行结转,不允许调整结转年月!");
  113. return;
  114. }
  115. list.Add(mothYear);
  116. list.Add(mothYear + "02 12:00:00");
  117. list.Add(inDoc);
  118. }
  119. }
  120. if (isUpdate == 0) { MessageUtil.ShowTips("请勾选要调整结转年月的数据!"); return; }
  121. int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmPipeEnter.updateYear", new object[] { list }, ob);
  122. if (count > 0)
  123. {
  124. getInList();
  125. MessageUtil.ShowTips("修改成功");
  126. }
  127. }
  128. /// <summary>
  129. /// 导出
  130. /// </summary>
  131. private void exportData()
  132. {
  133. GridHelper.ulGridToExcel(ultraGrid4, "红冲实绩总汇");
  134. }
  135. /// <summary>
  136. /// 库存查询
  137. /// </summary>
  138. private void QueryMat()
  139. {
  140. ArrayList pram = new ArrayList();
  141. string intimeStart = ""; //缴库起始时间
  142. string intimeEnd = ""; //缴库结束时间
  143. string stoveno = ""; //炉号
  144. string order = "";
  145. string stroage = "";
  146. if (ultraCheckEditor5.Checked)
  147. {
  148. intimeStart = StartTime.Value.ToString();
  149. intimeEnd = EndTime.Value.ToString();
  150. }
  151. //else
  152. //{
  153. // intimeStart = DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00";;
  154. // intimeEnd = DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).AddHours(-24).ToString("yyyy-MM-dd") + " 23:59:59";
  155. //}
  156. if (chkJudge.Checked)
  157. {
  158. if (cmbJudge.Text.Trim() == "")
  159. {
  160. MessageUtil.ShowTips("炉号不能为空,请选择!");
  161. return;
  162. }
  163. stoveno = cmbJudge.Text.Trim();
  164. }
  165. if (chkOrder.Checked)
  166. {
  167. if (cmbOrder.Text.Trim() == "")
  168. {
  169. MessageUtil.ShowTips("合同号不能为空,请选择!");
  170. return;
  171. }
  172. order = cmbOrder.Text.Trim();
  173. }
  174. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  175. {
  176. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  177. return;
  178. }
  179. if (chkStrong.Checked)
  180. {
  181. if (cmbStorager.Text.Trim() == "")
  182. {
  183. MessageUtil.ShowTips("仓库不能为空,请选择!");
  184. return;
  185. }
  186. stroage = cmbStorager.Value.ToString();
  187. }
  188. pram.Add(stoveno);
  189. pram.Add(order);
  190. pram.Add(stroage);
  191. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
  192. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipStoreRed.getMat", new object[] { pram, arr, intimeStart, intimeEnd }, this.ob);//MatData
  193. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  194. }
  195. /// <summary>
  196. /// 查询入库实绩
  197. /// </summary>
  198. /// <param name="heatNo"></param>
  199. /// <param name="bacthNo"></param>
  200. /// <param name="groupNo"></param>
  201. private void getInList()
  202. {
  203. string heatNo = "";
  204. string orderNo = "";
  205. string storgeNo = "";
  206. string startTim = "";
  207. string endTim = "";
  208. if (ultraCheckEditor5.Checked)
  209. {
  210. startTim = StartTime.Value.ToString();
  211. endTim = EndTime.Value.ToString();
  212. }
  213. //else
  214. //{
  215. // startTim = DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00"; ;
  216. // endTim = DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).AddHours(-24).ToString("yyyy-MM-dd") + " 23:59:59";
  217. //}
  218. if (chkJudge.Checked)
  219. {
  220. if (this.cmbJudge.Text == "")
  221. {
  222. MessageUtil.ShowTips("请选择炉号!");
  223. return;
  224. }
  225. else
  226. {
  227. heatNo = this.cmbJudge.Text.Trim();
  228. }
  229. }
  230. if (chkOrder.Checked)
  231. {
  232. if (this.cmbOrder.Text == "")
  233. {
  234. MessageUtil.ShowTips("请选择合同号!");
  235. return;
  236. }
  237. else
  238. {
  239. orderNo = this.cmbOrder.Text.Trim();
  240. }
  241. }
  242. if (chkStrong.Checked)
  243. {
  244. if (this.cmbStorager.Text == "")
  245. {
  246. MessageUtil.ShowTips("请选择仓库!");
  247. return;
  248. }
  249. else
  250. {
  251. storgeNo = this.cmbStorager.Value.ToString();
  252. }
  253. }
  254. ArrayList list = new ArrayList();
  255. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  256. list.Add(heatNo);
  257. list.Add(orderNo);
  258. list.Add(storgeNo);
  259. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipStoreRed.getInList", new object[] { list, arr, startTim, endTim }, this.ob);
  260. GridHelper.CopyDataToDatatable(ref dt, ref dataTable4, true);
  261. }
  262. /// <summary>
  263. /// 库存红冲
  264. /// </summary>
  265. private void pipRedStore()
  266. {
  267. this.ultraGrid2.UpdateData();
  268. UltraGridRow ugr = ultraGrid2.ActiveRow;
  269. int count = 0;
  270. string strInMemo = "";
  271. ArrayList matParm = new ArrayList();
  272. ArrayList plnSpale = new ArrayList();
  273. ArrayList statusUpdate = new ArrayList();
  274. MatZcMEntity1 matzcMEntity = new MatZcMEntity1();
  275. foreach (UltraGridRow row in ultraGrid2.Rows)
  276. {
  277. if (Convert.ToBoolean(row.Cells["CHOOSE"].Text) == true)
  278. {
  279. ArrayList sList = new ArrayList();
  280. sList.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
  281. sList.Add(row.Cells["BATCH_NO"].Value.ToString());
  282. sList.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
  283. sList.Add(row.Cells["MAT_STATUS"].Value.ToString());
  284. sList.Add(row.Cells["PLINE_CODE"].Value.ToString());
  285. sList.Add(row.Cells["STD_CODE"].Value.ToString2());
  286. sList.Add(row.Cells["STORAGE_NO"].Value.ToString());
  287. sList.Add(row.Cells["BAL_YEAR_MONTH"].Value.ToString().Replace("-",""));
  288. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipStoreRed.getStaueCount", new object[] { sList }, ob);
  289. if (int.Parse(row.Cells["REDCOUNT"].Text.Trim()) < 0)
  290. {
  291. if (dt.Rows[0]["ACOUNT"].ToString() == "")
  292. {
  293. MessageUtil.ShowTips("该炉已无库存信息,无法红冲!");
  294. return;
  295. }
  296. }
  297. if (dt.Rows[0]["ACOUNT"].ToString() != row.Cells["UNIT"].Text)
  298. {
  299. MessageUtil.ShowTips("该炉状态已改变或者无库存信息,请刷新界面!");
  300. return;
  301. }
  302. if (!StringUtil.IsInt(Math.Abs(double.Parse(row.Cells["REDCOUNT"].Text)).ToString()))
  303. {
  304. MessageUtil.ShowTips("支数请输入整数!");
  305. return;
  306. }
  307. //if (double.Parse(row.Cells["REDWEIGHT"].Value.ToString2()) <= 0)
  308. //{
  309. // MessageUtil.ShowTips("红冲重量不能为零或者空!");
  310. // return;
  311. //}
  312. if (Math.Abs(int.Parse((row.Cells["REDCOUNT"].Value.ToString2()))) == 0)
  313. {
  314. MessageUtil.ShowTips("红冲支数不能为零或者空!");
  315. return;
  316. }
  317. if (int.Parse(row.Cells["REDCOUNT"].Text) < 0)
  318. {
  319. if (int.Parse(row.Cells["REDCOUNT"].Text) > int.Parse(row.Cells["UNIT"].Text) || double.Parse(row.Cells["REDWEIGHT"].Text) > double.Parse(row.Cells["WEIGHT"].Text) || double.Parse(row.Cells["LENGTH"].Text) > double.Parse(row.Cells["ACT_LEN"].Text))
  320. {
  321. MessageUtil.ShowTips("冲销支数/重量/长度不能大于库存数量,输入正确冲销的支数、重量、长度!");
  322. return;
  323. }
  324. }
  325. //if (int.Parse(row.Cells["REDCOUNT"].Text) == int.Parse(row.Cells["UNIT"].Text))
  326. //{
  327. // if (row.Cells["REDWEIGHT"].Text == "" || row.Cells["REDWEIGHT"].Text == "0")
  328. // {
  329. // MessageUtil.ShowTips("红冲重量不能为空!");
  330. // return;
  331. // }
  332. //}
  333. if (!(double.Parse(row.Cells["REDWEIGHT"].Text.Replace("_", "")) >= 0) || !(double.Parse(row.Cells["LENGTH"].Text) >= 0))
  334. {
  335. MessageUtil.ShowTips("红冲重量和长度都需大于0,红冲正负以支数正负区分!");
  336. return;
  337. }
  338. DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getLockFlag", new object[] { row.Cells["JUDGE_STOVE_NO"].Text, row.Cells["BATCH_NO"].Text, row.Cells["BATCH_GROUD_NO"].Text }, ob);
  339. if (int.Parse(dd.Rows[0]["ACOUNT"].ToString()) > 0)
  340. {
  341. MessageUtil.ShowTips("炉号:" + row.Cells["JUDGE_STOVE_NO"].Text + "、批号:" + row.Cells["BATCH_NO"].Text + "的数据有被封锁的,不能进行红冲!");
  342. return;
  343. }
  344. ArrayList matList = new ArrayList();
  345. matList.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString()); //炉号
  346. matList.Add(row.Cells["BATCH_NO"].Value.ToString());//批号
  347. matList.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());//组号
  348. matList.Add(row.Cells["UNIT"].Value.ToString());//库存支数
  349. matList.Add(row.Cells["REDCOUNT"].Value.ToString());//红冲支数
  350. matList.Add(row.Cells["WEIGHT"].Value.ToString());//库存重量
  351. matList.Add(row.Cells["REDWEIGHT"].Value.ToString().Replace("_", ""));//红冲重量
  352. matList.Add(this.UserInfo.GetUserName());//操作人
  353. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  354. if (dtMemo.Rows.Count >= 1)
  355. {
  356. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  357. }
  358. matList.Add(strInMemo);
  359. matList.Add(strInbound);
  360. matList.Add(row.Cells["ACT_LEN"].Value.ToString());//库存长度//10
  361. matList.Add(row.Cells["LENGTH"].Value.ToString().Replace("_", ""));//红冲长度
  362. matList.Add(row.Cells["ORD_LN_PK"].Value.ToString());//合同行键
  363. matList.Add(row.Cells["ORD_PK"].Value.ToString());
  364. matList.Add(row.Cells["ORD_LN_DLY_PK"].Value.ToString());
  365. matList.Add(row.Cells["ORDER_NO"].Value.ToString());//合同号
  366. matList.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  367. matList.Add(row.Cells["ORDER_SEQ_NO"].Value.ToString());
  368. matList.Add(row.Cells["STORAGE_NO"].Value.ToString());//仓库号//18
  369. matList.Add(this.UserInfo.GetDeptid());
  370. matList.Add(this.UserInfo.GetDepartment());
  371. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  372. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  373. matList.Add(row.Cells["PRODUCCODE"].Value.ToString());//品名代码//23
  374. matList.Add(row.Cells["PRODUCNAME"].Value.ToString());//品名名称
  375. matList.Add(row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
  376. matList.Add(row.Cells["STEELNAME"].Value.ToString());//钢级名称
  377. matList.Add(row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
  378. matList.Add(row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
  379. matList.Add(row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
  380. matList.Add(row.Cells["MODEL_DESC"].Value.ToString());//扣型描述
  381. matList.Add(row.Cells["STD_CODE"].Value.ToString());//标准代码//31
  382. matList.Add(row.Cells["STD_NAME"].Value.ToString());//标准名称
  383. matList.Add(row.Cells["BELONG_CODE"].Value.ToString());//所属单位代码
  384. matList.Add(row.Cells["BELONG_NAME"].Value.ToString());//所属单位
  385. matList.Add(row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
  386. matList.Add(row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述//36
  387. matList.Add(row.Cells["ACT_DIMATER"].Value.ToString());// 外径
  388. matList.Add(row.Cells["ACT_HEIGHT"].Value.ToString());//壁厚
  389. matList.Add(row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
  390. matList.Add(row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
  391. matList.Add(row.Cells["LEN_UNIT"].Value.ToString());//长度单位
  392. matList.Add(row.Cells["ACT_LEN_MIN"].Value.ToString());
  393. matList.Add(row.Cells["ACT_LEN_MAX"].Value.ToString());
  394. matList.Add(row.Cells["MEMO"].Value.ToString());//备注
  395. if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "成品")
  396. {
  397. matList.Add("801402");//材料类别
  398. }
  399. else if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "商品")
  400. {
  401. matList.Add("801403");//材料类别
  402. }
  403. else
  404. {
  405. matList.Add("801401");//材料类别
  406. }
  407. matList.Add(row.Cells["MAT_STATUS"].Value.ToString());//材料状态
  408. matList.Add(row.Cells["JUDGE_STD_NAME"].Value.ToString());//判定标准//47
  409. if (this.cmbSource.Text != "" && this.cmbFactory.Text != "")
  410. {
  411. matList.Add(this.cmbFactory.Value.ToString());
  412. matList.Add(this.cmbFactory.Text);
  413. }
  414. else
  415. {
  416. matList.Add(row.Cells["PLINE_CODE"].Value.ToString());//产线代码
  417. matList.Add(row.Cells["PLINE_NAME"].Value.ToString());//产线
  418. }
  419. matList.Add(row.Cells["GRADECODE"].Value.ToString());//钢种代码
  420. matList.Add(row.Cells["GRADENAME"].Value.ToString());//钢种
  421. matList.Add(row.Cells["PIPMEMO"].Value.ToString());//入库备注
  422. if (this.cmbSource.Text != "" && this.cmbFactory.Text != "")
  423. {
  424. matList.Add(this.cmbSource.Value.ToString());
  425. matList.Add(this.cmbSource.Text);
  426. matList.Add(this.cmbFactory.Value.ToString());
  427. matList.Add(this.cmbFactory.Text);
  428. }
  429. else
  430. {
  431. matList.Add(row.Cells["MAT_ORIGIN_CODE"].Value.ToString());//材料来源类别
  432. matList.Add(row.Cells["MAT_ORIGIN_NAME"].Value.ToString());
  433. matList.Add(row.Cells["SOURE_CODE"].Value.ToString());//材料来源地
  434. matList.Add(row.Cells["SOURE_NAME"].Value.ToString());
  435. }
  436. matList.Add(row.Cells["MATERIAL_NO"].Value.ToString());//物料码//57
  437. matList.Add(row.Cells["MATERIAL_NAME"].Value.ToString());
  438. matList.Add(row.Cells["BAL_YEAR_MONTH"].Value.ToString().Replace("-", ""));
  439. matList.Add(row.Cells["BELONG_CODE"].Value.ToString());
  440. matParm.Add(matList);
  441. ArrayList plnList = new ArrayList();
  442. plnList.Add(row.Cells["REDWEIGHT"].Text.Replace("_", ""));
  443. plnList.Add(row.Cells["REDCOUNT"].Text);
  444. plnList.Add(this.UserInfo.GetUserName());
  445. plnList.Add(row.Cells["ORDER_NO"].Value.ToString());
  446. plnList.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  447. plnList.Add(row.Cells["ORDER_SEQ_NO"].Value.ToString());
  448. plnList.Add(row.Cells["JUDGE_STOVE_NO"].Text.Trim());
  449. plnList.Add(row.Cells["BATCH_NO"].Text.Trim());
  450. plnList.Add(row.Cells["BATCH_GROUD_NO"].Text);
  451. plnSpale.Add(plnList);
  452. count++;
  453. }
  454. }
  455. if (count < 1)
  456. {
  457. MessageUtil.ShowTips("请选择需要红冲的库存数据!");
  458. return;
  459. }
  460. CoreClientParam ccp = new CoreClientParam();
  461. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipStoreRed";
  462. ccp.MethodName = "pipRedStore";
  463. ccp.ServerParams = new object[] { matParm, plnSpale };
  464. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  465. if (ccp.ReturnCode != -1)
  466. {
  467. if (ccp.ReturnInfo.Equals("库存红冲成功!"))
  468. {
  469. QueryMat();
  470. getInList();
  471. MessageUtil.ShowTips("库存红冲成功!");
  472. }
  473. else
  474. {
  475. MessageUtil.ShowTips(ccp.ReturnInfo);
  476. }
  477. }
  478. }
  479. /// <summary>
  480. /// 撤销库存红冲
  481. /// </summary>
  482. private void DoCanclePipeIn()
  483. {
  484. this.ultraGrid4.UpdateData();
  485. UltraGridRow ugr = ultraGrid4.ActiveRow;
  486. int count = 0;
  487. ArrayList matList = new ArrayList();
  488. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  489. string moth = "";
  490. foreach (UltraGridRow row in ultraGrid4.Rows)
  491. {
  492. if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  493. {
  494. ArrayList parm = new ArrayList();
  495. moth = DateTime.Parse(row.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
  496. parm.Add(moth);
  497. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { parm, arr }, ob);
  498. if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  499. {
  500. MessageUtil.ShowTips("此炉【" + row.Cells["JUDGE_STOVE_NO"].Text + "】已进行结转,不允许撤销!");
  501. return;
  502. }
  503. matList.Add(row.Cells["ACT_WEIGHT"].Text);
  504. matList.Add(row.Cells["ACT_COUNT"].Text);
  505. matList.Add(this.UserInfo.GetUserName());
  506. matList.Add(row.Cells["ORDER_NO"].Value.ToString());
  507. matList.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  508. matList.Add(row.Cells["DELIVERY_NO"].Value.ToString());
  509. matList.Add(row.Cells["JUDGE_STOVE_NO"].Text.Trim());
  510. matList.Add(row.Cells["BATCH_NO"].Text.Trim());
  511. matList.Add(row.Cells["BATCH_GROUD_NO"].Text);
  512. matList.Add(row.Cells["INSTOCK_DOC"].Text.ToString());
  513. matList.Add(row.Cells["ACT_LEN"].Text);
  514. matList.Add(row.Cells["ORD_LN_PK"].Text);
  515. matList.Add(row.Cells["ORD_LN_DLY_PK"].Text);
  516. matList.Add(row.Cells["BELONG_CODE"].Text.Trim());
  517. matList.Add(row.Cells["BELONG_NAME"].Text.Trim());
  518. count++;
  519. }
  520. }
  521. if (count < 1)
  522. {
  523. MessageUtil.ShowTips("请选择需要撤销的数据!");
  524. return;
  525. }
  526. CoreClientParam ccp = new CoreClientParam();
  527. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipStoreRed";
  528. ccp.MethodName = "pipCancelRedStore";
  529. ccp.ServerParams = new object[] { matList };
  530. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  531. if (ccp.ReturnCode != -1)
  532. {
  533. if (ccp.ReturnInfo.Equals("库存红冲撤销成功!"))
  534. {
  535. QueryMat();
  536. getInList();
  537. MessageUtil.ShowTips("库存红冲撤销成功!");
  538. }
  539. }
  540. else
  541. {
  542. MessageUtil.ShowTips(ccp.ReturnInfo);
  543. }
  544. }
  545. private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
  546. {
  547. StartTime.Enabled = this.ultraCheckEditor5.Checked;
  548. this.EndTime.Enabled = this.ultraCheckEditor5.Checked;
  549. }
  550. private void chkJudge_CheckedChanged(object sender, EventArgs e)
  551. {
  552. cmbJudge.Enabled = chkJudge.Checked;
  553. }
  554. private void chkOrder_CheckedChanged(object sender, EventArgs e)
  555. {
  556. cmbOrder.Enabled = chkOrder.Checked;
  557. }
  558. private void chkStrong_CheckedChanged(object sender, EventArgs e)
  559. {
  560. cmbStorager.Enabled = this.chkStrong.Checked;
  561. }
  562. int iSelectG3Row = -1;
  563. int iSelectG2Row = -1;
  564. private void ultraGrid2_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  565. {
  566. ultraGrid2.UpdateData();
  567. if (ultraGrid2.Rows.Count == 1)
  568. {
  569. ultraGrid2.Rows[0].Cells["CHOOSE"].Value = true;
  570. }
  571. else
  572. {
  573. if (e.Cell.Column.Key.ToString().ToUpper() == "CHOOSE")
  574. {
  575. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  576. {
  577. if (iSelectG2Row != -1)
  578. ultraGrid2.Rows[iSelectG2Row].Cells["CHOOSE"].Value = false;
  579. iSelectG2Row = e.Cell.Row.Index;
  580. }
  581. else
  582. {
  583. iSelectG2Row = -1;
  584. }
  585. }
  586. }
  587. }
  588. private void ultraGrid4_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  589. {
  590. ultraGrid4.UpdateData();
  591. if (ultraGrid4.Rows.Count == 1)
  592. {
  593. ultraGrid4.Rows[0].Cells["CHK"].Value = true;
  594. }
  595. else
  596. {
  597. if (e.Cell.Column.Key.ToString().ToUpper() == "CHK")
  598. {
  599. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  600. {
  601. if (iSelectG3Row != -1)
  602. ultraGrid4.Rows[iSelectG3Row].Cells["CHK"].Value = false;
  603. iSelectG3Row = e.Cell.Row.Index;
  604. }
  605. else
  606. {
  607. iSelectG3Row = -1;
  608. }
  609. }
  610. }
  611. }
  612. private void cmbJudge_KeyDown(object sender, KeyEventArgs e)
  613. {
  614. if (e.KeyValue == 13)
  615. {
  616. QueryMat();
  617. }
  618. }
  619. private void cmbOrder_KeyDown(object sender, KeyEventArgs e)
  620. {
  621. if (e.KeyValue == 13)
  622. {
  623. QueryMat();
  624. }
  625. }
  626. private void cmbSource_ValueChanged(object sender, EventArgs e)
  627. {
  628. if (this.cmbSource.Text != "")
  629. {
  630. if (this.cmbSource.Value.ToString() == "801302")//产线
  631. {
  632. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
  633. }
  634. else if (this.cmbSource.Value.ToString() == "801301")//外购
  635. {
  636. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWg", "BASE_CODE", this.ob, false);
  637. }
  638. else if (this.cmbSource.Value.ToString() == "801303")//倒库
  639. {
  640. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDk", "BASE_CODE", this.ob, false);
  641. }
  642. else if (this.cmbSource.Value.ToString() == "801304")//外委
  643. {
  644. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWw", "BASE_CODE", this.ob, false);
  645. }
  646. }
  647. }
  648. }
  649. }