FrmXiaXianOffLine.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Format;
  4. using Core.Mes.Client.Comm.Server;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.ZGMil.Entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.ZGMil.NodeResultQuery
  19. {
  20. public partial class FrmXiaXianOffLine : FrmBase
  21. {
  22. private OpeBase ob;
  23. public OpeBase Ob
  24. {
  25. get { return ob; }
  26. set { ob = value; }
  27. }
  28. //工序状态:01-矫直1#,02-矫直2#,03-矫直3#,11-ET探伤,12-MT探伤,13-UT探伤
  29. private string node="";
  30. private string test = "";
  31. private string colno = "0";//探伤台号
  32. //可下线支数
  33. private int ScrapNumBefore = 0;
  34. //剔除支数
  35. private int DelNum = 0;
  36. //产线代码
  37. string PlineCod = "";
  38. //点击主计划的炉号
  39. private string heatno = "";
  40. private string stoveno = "";
  41. private string lotno = "";
  42. private string proPlanId = "";//轧管订单编号
  43. private string gxPlanNo = "";//工序排产序号
  44. //工序
  45. private string process = "";
  46. private string labtext = "";
  47. private string qualifiedNum = "";//上倒工序合格支数
  48. //下线实绩表实体类
  49. MilOfflineReslutEntity2 milofflineresult = new MilOfflineReslutEntity2();
  50. /// <summary>
  51. /// 构造函数
  52. /// </summary>
  53. public FrmXiaXianOffLine()
  54. {
  55. }
  56. public FrmXiaXianOffLine(string node, OpeBase _ob, string PlineCode, string stoveno, string lotno, string qualifiedNumS, string proPlanId, string gxPlanNo)
  57. {
  58. InitializeComponent();
  59. EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraRack.DisplayLayout.Bands[0]);
  60. process = node;
  61. this.Ob = _ob;
  62. this.PlineCod = PlineCode;
  63. this.stoveno = stoveno;
  64. this.lotno = lotno;
  65. this.proPlanId = proPlanId;
  66. this.gxPlanNo = gxPlanNo;
  67. qualifiedNum = qualifiedNumS;
  68. this.TxtHeatNo.Text = this.stoveno;
  69. Query();
  70. }
  71. private void Query()
  72. {
  73. string jugeNo = this.TxtHeatNo.Text.Trim();
  74. //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetMILPlan", new object[] { PlineCod,process }, this.ob);
  75. List<MilPlanEntity3> listSource = EntityHelper.GetData<MilPlanEntity3>(
  76. "com.steering.mes.zgmil.coup.FrmOffLine.GetMILPlan", new object[] { PlineCod, process, jugeNo, proPlanId, gxPlanNo }, this.ob);
  77. MilPlanEntity3bindingSource.DataSource = listSource;
  78. if (listSource ==null)
  79. {
  80. dtPlan.Rows.Clear();
  81. MessageBox.Show("未查询到可下线计划", "提示:", MessageBoxButtons.OK);
  82. this.TxtHeatNo.Text = "";
  83. //this.TxtHeatNo.Enabled = false;
  84. this.TxtTotalNum.Text = "0";
  85. this.TxtTotalNum.Enabled = false;
  86. this.TxtOfflineNumhas.Text = "0";
  87. this.TxtOfflineNumhas.Enabled = false;
  88. this.TxtOfflinNum.Text = "0";
  89. this.Dispose();
  90. this.Close();
  91. }
  92. }
  93. /// <summary>
  94. /// 表格单击事件
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void ultraRack_AfterRowActivate(object sender, EventArgs e)
  99. {
  100. UltraGridRow ugr = this.ultraRack.ActiveRow;
  101. this.TxtTotalNum.Text = "0";
  102. this.TxtOfflinNumBack.Text = "0";
  103. heatno = ugr.Cells["JudgeStoveNo"].Value.ToString();
  104. this.TxtHeatNo.Text = heatno;
  105. //this.TxtHeatNo.Enabled = false;
  106. string s = "";
  107. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.getOfflineXXCount", new object[] { heatno, PlineCod, proPlanId, gxPlanNo }, ob);
  108. if (ds.Rows.Count > 0)
  109. {
  110. s = ds.Rows[0]["QUALIFIEDNUM"].ToString();
  111. }
  112. this.TxtTotalNum.Text = s;
  113. this.TxtTotalNum.Enabled = false;
  114. DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.getXXCountHAS", new object[] { heatno, proPlanId, gxPlanNo }, this.ob);
  115. if (dthas.Rows.Count > 0)
  116. {
  117. this.TxtOfflineNumhas.Text = dthas.Rows[0]["OFFLINE_COUNT"].ToString();
  118. this.TxtOfflineNumhas.Enabled = false;
  119. }
  120. else
  121. {
  122. this.TxtOfflineNumhas.Text = "0";
  123. this.TxtOfflineNumhas.Enabled = false;
  124. }
  125. }
  126. /// <summary>
  127. /// 下线操作
  128. /// </summary>
  129. public void Offline()
  130. {
  131. string strInbound = "800707";//入库类型
  132. string strInMemo = "";
  133. if (string.IsNullOrEmpty(heatno)||ultraRack.ActiveRow==null)
  134. {
  135. MessageBox.Show("未选择计划行,不允许进行下线操作","提示:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
  136. return;
  137. }
  138. if (!string.IsNullOrEmpty(TxtOfflinNum.Text.ToString().Replace("_","")))
  139. {
  140. if (int.Parse(this.TxtOfflinNum.Text.ToString().Replace("_", "")) - int.Parse(this.TxtTotalNum.Text.Trim()) > 0)
  141. {
  142. MessageBox.Show("输入的下线支数超过了可下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  143. return;
  144. }
  145. if (int.Parse(TxtOfflinNum.Text.ToString3().Replace("_", "")) <= 0)
  146. {
  147. MessageBox.Show("下线支数不能为零支,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  148. return;
  149. }
  150. }
  151. else
  152. {
  153. MessageBox.Show("未输入下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  154. return;
  155. }
  156. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  157. if (dtMemo.Rows.Count >= 1)
  158. {
  159. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  160. }
  161. NativeMethodNew na = new NativeMethodNew(this.ob);
  162. string plinCode = this.ultraRack.ActiveRow.Cells["PlineCode"].Value.ToString();
  163. //na.GetPCode(this.UserInfo.GetDepartment());
  164. ArrayList list = new ArrayList();
  165. DataTable ds = getStoreNo(plinCode);
  166. if (ds == null)
  167. {
  168. MessageUtil.ShowTips("无轧管在线库基础信息,请维护!");
  169. return;
  170. }
  171. list.Add(ds.Rows[0]["STORAGE_NO"].ToString());
  172. list.Add(ds.Rows[0]["STORAGE_NO"].ToString() + "10101");
  173. list.Add(ds.Rows[0]["STORAGE_TYPE_NO"].ToString());
  174. list.Add(ds.Rows[0]["STORAGE_TYPE_NAME"].ToString());
  175. list.Add(this.UserInfo.GetUserName());
  176. list.Add(this.UserInfo.GetDeptid());
  177. list.Add(this.UserInfo.GetDepartment());
  178. list.Add(this.UserInfo.GetDeptid());
  179. list.Add(this.UserInfo.GetDepartment());
  180. //list.Add(PipeManageClass.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  181. //list.Add(PipeManageClass.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  182. list.Add(UserInfo.GetUserOrder());
  183. list.Add(UserInfo.GetUserGroup());
  184. UltraGridRow uRow = this.ultraRack.ActiveRow;
  185. //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryResult", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString2() }, this.ob);
  186. //if (int.Parse(dt.Rows[0]["ACOUNT"].ToString2()) < 1)
  187. //{
  188. // MessageUtil.ShowTips("部分下线之前,请先录入实绩!");
  189. // return;
  190. //}
  191. MilPlanEntity3 milPlan = (MilPlanEntity3)uRow.ListObject;
  192. String milPlanTity = JSONFormat.Format(milPlan);
  193. CoreClientParam ccp = new CoreClientParam();
  194. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
  195. ccp.MethodName = "offLineXX";
  196. ccp.ServerParams = new object[] { milPlanTity, TxtOfflinNum.Text.ToString().Replace("_", ""), this.UserInfo.GetUserName(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserOrder(), "0", list, strInbound, strInMemo, plinCode };
  197. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  198. if (ccp.ReturnCode != -1)
  199. {
  200. if (ccp.ReturnInfo.Equals("离线成功!"))
  201. {
  202. Query();
  203. MessageUtil.ShowTips(ccp.ReturnInfo);
  204. }
  205. else
  206. {
  207. MessageUtil.ShowTips(ccp.ReturnInfo);
  208. }
  209. }
  210. foreach (UltraGridRow ugr in ultraRack.Rows)
  211. {
  212. if (ugr.Cells["JudgeStoveNo"].Value.ToString().Equals(heatno))
  213. {
  214. ultraRack.ActiveRow = ugr;
  215. }
  216. }
  217. }
  218. /// <summary>
  219. /// 查询仓库信息
  220. /// </summary>
  221. /// <param name="plineCode"></param>
  222. /// <returns></returns>
  223. private DataTable getStoreNo(string plineCode)
  224. {
  225. DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmInOnlineStore.doQueryStoreNo", new object[] { plineCode }, ob);
  226. if (ds.Rows.Count > 0)
  227. {
  228. return ds;
  229. }
  230. else
  231. {
  232. return null;
  233. }
  234. }
  235. public void offlineAll()
  236. {
  237. string strInbound = "800707";//入库类型
  238. string strInMemo = "";
  239. if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null)
  240. {
  241. MessageBox.Show("未选择计划行,不允许进行下线操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  242. return;
  243. }
  244. UltraGridRow uRow = this.ultraRack.ActiveRow;
  245. //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryResult", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString2() }, this.ob);
  246. //if (int.Parse(dt.Rows[0]["ACOUNT"].ToString2()) < 1)
  247. //{
  248. // MessageUtil.ShowTips("部分下线之前,请先录入实绩!");
  249. // return;
  250. //}
  251. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  252. if (dtMemo.Rows.Count >= 1)
  253. {
  254. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  255. }
  256. NativeMethodNew na = new NativeMethodNew(this.ob);
  257. string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
  258. ArrayList list = new ArrayList();
  259. DataTable ds = getStoreNo(plinCode);
  260. if (ds == null)
  261. {
  262. MessageUtil.ShowTips("无轧管在线库基础信息,请维护!");
  263. return;
  264. }
  265. list.Add(ds.Rows[0]["STORAGE_NO"].ToString());
  266. list.Add(ds.Rows[0]["STORAGE_NO"].ToString() + "10101");
  267. list.Add(ds.Rows[0]["STORAGE_TYPE_NO"].ToString());
  268. list.Add(ds.Rows[0]["STORAGE_TYPE_NAME"].ToString());
  269. list.Add(this.UserInfo.GetUserName());
  270. list.Add(this.UserInfo.GetDeptid());
  271. list.Add(this.UserInfo.GetDepartment());
  272. list.Add(PipeManageClass.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  273. list.Add(PipeManageClass.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  274. list.Add(UserInfo.GetUserOrder());
  275. list.Add(UserInfo.GetUserGroup());
  276. MilPlanEntity milPlan = (MilPlanEntity)uRow.ListObject;
  277. String milPlanTity = JSONFormat.Format(milPlan);
  278. CoreClientParam ccp = new CoreClientParam();
  279. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
  280. ccp.MethodName = "offLineXX";
  281. ccp.ServerParams = new object[] { milPlanTity, TxtTotalNum.Text.ToString().Replace("_", ""), this.UserInfo.GetUserName(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserOrder(),"1",list };
  282. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  283. if (ccp.ReturnCode != -1)
  284. {
  285. if (ccp.ReturnInfo.Equals("下线成功!"))
  286. {
  287. Query();
  288. MessageUtil.ShowTips(ccp.ReturnInfo);
  289. }
  290. else
  291. {
  292. MessageUtil.ShowTips(ccp.ReturnInfo);
  293. }
  294. }
  295. }
  296. public void offlineBack()
  297. {
  298. if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null)
  299. {
  300. MessageBox.Show("未选择计划行,不允许进行下线回退操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  301. return;
  302. }
  303. if (!string.IsNullOrEmpty(this.TxtOfflineNumhas.Text.ToString().Replace("_", "")))
  304. {
  305. if (int.Parse(this.TxtOfflineNumhas.Text.ToString().Replace("_","")) == 0)
  306. {
  307. MessageBox.Show("已下线支数为0,不允许进行下线回退操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  308. return;
  309. }
  310. }
  311. else
  312. {
  313. MessageBox.Show("未进行下线操作,不允许进行下线回退", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  314. return;
  315. }
  316. int offlinehas=int.Parse(this.TxtOfflineNumhas.Text.ToString().Replace("_",""));
  317. if (!string.IsNullOrEmpty(this.TxtOfflinNumBack.Text.ToString().Replace("_", "")))
  318. {
  319. if (int.Parse(this.TxtOfflinNumBack.Text.ToString().Replace("_", "")) - offlinehas > 0)
  320. {
  321. MessageBox.Show("输入的下线回退支数超过了已下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  322. return;
  323. }
  324. }
  325. else
  326. {
  327. MessageBox.Show("未输入下线回退支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  328. return;
  329. }
  330. UltraGridRow uRow = this.ultraRack.ActiveRow;
  331. MilPlanEntity3 milPlan = (MilPlanEntity3)uRow.ListObject;
  332. String milPlanTity = JSONFormat.Format(milPlan);
  333. CoreClientParam ccp = new CoreClientParam();
  334. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
  335. ccp.MethodName = "newXXOfflineBack";
  336. ccp.ServerParams = new object[] { milPlanTity,this.TxtOfflinNumBack.Text.ToString().Replace("_", ""),"XX" };
  337. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  338. if (ccp.ReturnCode != -1)
  339. {
  340. if (ccp.ReturnInfo.Equals("回退成功!"))
  341. {
  342. Query();
  343. MessageUtil.ShowTips(ccp.ReturnInfo);
  344. }
  345. else
  346. {
  347. MessageUtil.ShowTips(ccp.ReturnInfo);
  348. }
  349. }
  350. }
  351. /// <summary>
  352. /// 是否要插入下线实绩表
  353. /// </summary>
  354. /// <returns></returns>
  355. public bool isInsert()
  356. {
  357. bool result = true;
  358. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.isInsertOfflineResult", new object[] { heatno, process, proPlanId, gxPlanNo }, this.ob);
  359. if (dt.Rows.Count > 0)
  360. {
  361. result = false;
  362. }
  363. return result;
  364. }
  365. //查询
  366. private void FrmStraighteningOffLine_Load(object sender, EventArgs e)
  367. {
  368. Query();
  369. }
  370. private void FrmStraighteningOffLine_FormClosed(object sender, FormClosedEventArgs e)
  371. {
  372. this.DialogResult = DialogResult.OK;
  373. }
  374. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  375. {
  376. switch (e.Tool.Key)
  377. {
  378. case "doquery":
  379. Query();
  380. break;
  381. case "offline":
  382. Offline();
  383. break;
  384. case "offlineall":
  385. offlineAll();
  386. break;
  387. case "OfflineBack":
  388. offlineBack();
  389. break;
  390. case "Close":
  391. this.Close();
  392. break;
  393. }
  394. }
  395. private void TxtOfflineNumhas_TextChanged(object sender, EventArgs e)
  396. {
  397. if (int.Parse(TxtOfflineNumhas.Text.ToString()) > 0)
  398. {
  399. this.TxtOfflinNumBack.Enabled = true;
  400. }
  401. else
  402. {
  403. this.TxtOfflinNumBack.Enabled = false;
  404. }
  405. }
  406. }
  407. }