frmPipeManualIn.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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.Entity;
  12. using Core.Mes.Client.Comm.Tool;
  13. using System.Collections;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Core.Mes.Client.Comm.Server;
  16. using Core.Mes.Client.Comm.Control;
  17. namespace Core.StlMes.Client.YdmPipeManage
  18. {
  19. public partial class frmPipeManualIn : FrmBase
  20. {
  21. public frmPipeManualIn()
  22. {
  23. this.IsLoadUserView = true;
  24. InitializeComponent();
  25. }
  26. /// <summary>
  27. /// 重写基类方法
  28. /// </summary>
  29. /// <param name="sender"></param>
  30. /// <param name="ToolbarKey"></param>
  31. public override void ToolBar_Click(object sender, string ToolbarKey)
  32. {
  33. switch (ToolbarKey)
  34. {
  35. case "Query":
  36. QueryManualIn();
  37. break;
  38. case "Add":
  39. Add();
  40. break;
  41. case "Update":
  42. break;
  43. case "Delete":
  44. break;
  45. case"Export":
  46. exportDat();
  47. break;
  48. case "Close":
  49. this.Close();
  50. break;
  51. }
  52. }
  53. private void exportDat()
  54. {
  55. GridHelper.ulGridToExcel(ultraGrid2, "钢管起初总汇");
  56. }
  57. private void Add()
  58. {
  59. if (ultraTabControl1.SelectedTab.Key == "0")
  60. {
  61. AddMatZc();
  62. }else
  63. {
  64. updateMat();
  65. }
  66. }
  67. private void frmPipeManualIn_Load(object sender, EventArgs e)
  68. {
  69. dteInStartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
  70. //YdmBaseClass.InitComboEditor(cmbBelog, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  71. EntityHelper.ShowGridCaption<YdmZcInitialEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  72. EntityHelper.ShowGridCaption<YdmZcInitialEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  73. this.txtHeatNo.Enabled = false;
  74. this.txtBatchNo.Enabled = false;
  75. this.cmbBelog.Enabled = false;
  76. //this.checkBox1.Visible = false;
  77. this.ultraTabControl1.Tabs["0"].Visible = false;
  78. }
  79. /// <summary>
  80. /// 查询期初数据
  81. /// </summary>
  82. private void QueryManualIn()
  83. {
  84. string time = dteInStartTime.Value.ToString("yyyyMM");
  85. string heatNo = "";
  86. string batchNo = "";
  87. string storeNo = "";
  88. string ss = "";
  89. string supplyUnit = this.CustomInfo;
  90. ArrayList parm = new ArrayList();
  91. if(chkHeatNo.Checked)
  92. {
  93. heatNo = this.txtHeatNo.Text.Trim();
  94. }
  95. if (chkBacthNo.Checked)
  96. {
  97. batchNo = this.txtBatchNo.Text.Trim();
  98. }
  99. if (chkStoreNo.Checked)
  100. {
  101. storeNo = this.cmbBelog.Value.ToString();
  102. }
  103. parm.Add(time);
  104. parm.Add(heatNo);
  105. parm.Add(batchNo);
  106. parm.Add(storeNo);
  107. if (ultraTabControl1.SelectedTab.Key == "0")
  108. {
  109. ss = "0";
  110. List<YdmZcInitialEntity> listSource = EntityHelper.GetData<YdmZcInitialEntity>("com.steering.pss.ydm.pipemanage.FrmPipeManualIn.queryManualIn", new object[] { parm, ss, supplyUnit }, this.ob);
  111. YdmZcInitialEntitybindingSource.DataSource = listSource;
  112. }
  113. if (ultraTabControl1.SelectedTab.Key == "1")
  114. {
  115. ss = "1";
  116. List<YdmZcInitialEntity> listSource = EntityHelper.GetData<YdmZcInitialEntity>("com.steering.pss.ydm.pipemanage.FrmPipeManualIn.queryManualIn", new object[] { parm,ss, supplyUnit }, this.ob);
  117. bindingSource1.DataSource = listSource;
  118. }
  119. }
  120. /// <summary>
  121. /// 增加库存
  122. /// </summary>
  123. private void AddMatZc()
  124. {
  125. int m = 0;
  126. ArrayList parm = new ArrayList();
  127. foreach (UltraGridRow row in ultraGrid1.Rows)
  128. {
  129. if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  130. {
  131. m++;
  132. }
  133. }
  134. if (m < 1)
  135. {
  136. MessageUtil.ShowTips("请勾选你需要操作的数据!");
  137. return;
  138. }
  139. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  140. {
  141. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  142. {
  143. ArrayList list = new ArrayList();
  144. list.Add(uRow.Cells["judgeStoveNo"].Text.ToString());
  145. list.Add(uRow.Cells["batchNo"].Value.ToString());
  146. list.Add(uRow.Cells["batchGroudNo"].Value.ToString());
  147. list.Add(uRow.Cells["produccode"].Value.ToString());
  148. list.Add(uRow.Cells["producname"].Value.ToString());
  149. list.Add(uRow.Cells["STEELCODE"].Value.ToString());
  150. list.Add(uRow.Cells["STEELNAME"].Value.ToString());
  151. list.Add(uRow.Cells["specCode"].Value.ToString());
  152. list.Add(uRow.Cells["specName"].Value.ToString());
  153. list.Add(uRow.Cells["modelCode"].Value.ToString());
  154. list.Add(uRow.Cells["modelDesc"].Value.ToString());//10
  155. list.Add(uRow.Cells["stdCode"].Value.ToString());
  156. list.Add(uRow.Cells["stdName"].Value.ToString());
  157. list.Add(uRow.Cells["stdStyle"].Value.ToString());
  158. list.Add(uRow.Cells["stdStyleDesc"].Value.ToString());
  159. list.Add(uRow.Cells["DIMATER"].Value.ToString()); //15
  160. list.Add(uRow.Cells["HEIGHT"].Value.ToString());
  161. list.Add(uRow.Cells["LEN"].Value.ToString());
  162. list.Add(uRow.Cells["lenMin"].Value.ToString());
  163. list.Add(uRow.Cells["lenMax"].Value.ToString());
  164. list.Add(uRow.Cells["actCount"].Value.ToString());//20
  165. list.Add(uRow.Cells["actWeight"].Value.ToString());
  166. list.Add(uRow.Cells["actTheoryWeight"].Value.ToString());
  167. list.Add(uRow.Cells["judgeResultCode"].Value.ToString());
  168. list.Add(uRow.Cells["judgeResult"].Value.ToString());
  169. list.Add(uRow.Cells["storageNo"].Value.ToString());
  170. list.Add(uRow.Cells["storageName"].Value.ToString());
  171. list.Add(uRow.Cells["locationNo"].Value.ToString());
  172. list.Add(uRow.Cells["orderNo"].Value.ToString());//28
  173. list.Add(uRow.Cells["orderSeq"].Value.ToString().PadLeft(3,'0'));
  174. //if (uRow.Cells["OrderSeqNo"].Value.ToString() == "")
  175. //{
  176. // list.Add("001");
  177. //}
  178. //else
  179. //{
  180. // list.Add(uRow.Cells["OrderSeqNo"].Value.ToString().PadLeft(3,'0'));
  181. //}
  182. list.Add(uRow.Cells["OrderSeqNo"].Value.ToString());
  183. list.Add(uRow.Cells["MEMO"].Value.ToString());
  184. list.Add(dteInStartTime.Value.ToString("yyyyMM"));
  185. list.Add(uRow.Cells["GRADECODE"].Value.ToString());
  186. list.Add(uRow.Cells["GRADENAME"].Value.ToString());
  187. list.Add(uRow.Cells["plineCode"].Value.ToString());
  188. list.Add(uRow.Cells["plineName"].Value.ToString());
  189. list.Add(this.UserInfo.GetUserName());//37
  190. list.Add(uRow.Cells["initialId"].Value.ToString());
  191. list.Add(this.UserInfo.GetDeptid());
  192. list.Add(this.UserInfo.GetDepartment());
  193. list.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  194. list.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  195. list.Add(uRow.Cells["JUDGEGRADE"].Value.ToString());
  196. list.Add(uRow.Cells["instockTime"].Value.ToString());
  197. list.Add(uRow.Cells["belongCode"].Value.ToString());
  198. list.Add(uRow.Cells["belongName"].Value.ToString());
  199. parm.Add(list);
  200. }
  201. }
  202. CoreClientParam ccp = new CoreClientParam();
  203. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeManualIn";
  204. ccp.MethodName = "addMatZc";
  205. ccp.ServerParams = new object[] { parm };
  206. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  207. if (ccp.ReturnCode != -1)
  208. {
  209. MessageUtil.ShowTips(ccp.ReturnInfo);
  210. if (ccp.ReturnInfo.Equals("期初库存维护成功!"))
  211. {
  212. QueryManualIn();
  213. }
  214. }
  215. }
  216. /// <summary>
  217. /// 修改材料表
  218. /// </summary>
  219. private void updateMat()
  220. {
  221. int m = 0;
  222. ArrayList parm = new ArrayList();
  223. foreach (UltraGridRow row in ultraGrid2.Rows)
  224. {
  225. if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  226. {
  227. m++;
  228. }
  229. }
  230. if (m < 1)
  231. {
  232. MessageUtil.ShowTips("请勾选你需要操作的数据!");
  233. return;
  234. }
  235. foreach (UltraGridRow uRow in ultraGrid2.Rows)
  236. {
  237. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  238. {
  239. ArrayList list = new ArrayList();
  240. list.Add(uRow.Cells["judgeStoveNo"].Text.ToString());
  241. list.Add(uRow.Cells["batchNo"].Value.ToString());
  242. list.Add(uRow.Cells["batchGroudNo"].Value.ToString());
  243. list.Add(uRow.Cells["orderNo"].Value.ToString());
  244. list.Add(uRow.Cells["orderSeq"].Value.ToString().PadLeft(3, '0'));
  245. list.Add(uRow.Cells["OrderSeqNo"].Value.ToString());
  246. list.Add(uRow.Cells["initialId"].Value.ToString());
  247. parm.Add(list);
  248. }
  249. }
  250. CoreClientParam ccp = new CoreClientParam();
  251. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeManualIn";
  252. ccp.MethodName = "updateMat";
  253. ccp.ServerParams = new object[] { parm };
  254. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  255. if (ccp.ReturnCode != -1)
  256. {
  257. MessageUtil.ShowTips(ccp.ReturnInfo);
  258. if (ccp.ReturnInfo.Equals("修改成功!"))
  259. {
  260. QueryManualIn();
  261. //this.checkBox1.Checked = false;
  262. }
  263. }
  264. }
  265. private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
  266. {
  267. this.txtHeatNo.Enabled = this.chkHeatNo.Checked;
  268. }
  269. private void chkBacthNo_CheckedChanged(object sender, EventArgs e)
  270. {
  271. this.txtBatchNo.Enabled = this.chkBacthNo.Checked;
  272. }
  273. private void chkStoreNo_CheckedChanged(object sender, EventArgs e)
  274. {
  275. this.cmbBelog.Enabled = this.chkStoreNo.Checked;
  276. }
  277. /// <summary>
  278. /// ultraGrid1拖选
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. private void ultraGrid1_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
  283. {
  284. foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
  285. {
  286. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  287. {
  288. uRow.Cells["CHK"].Value = true;
  289. }
  290. }
  291. }
  292. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  293. {
  294. foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
  295. {
  296. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  297. {
  298. uRow.Cells["CHK"].Value = true;
  299. }
  300. }
  301. }
  302. //private void checkBox1_CheckedChanged(object sender, EventArgs e)
  303. //{
  304. // int chkint = 0;
  305. // if (this.checkBox1.Checked)
  306. // {
  307. // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  308. // {
  309. // //if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
  310. // //{
  311. // chkint += 1;
  312. // if (chkint > 500) return;
  313. // uRow.Cells["CHK"].Value = true;
  314. // //}
  315. // }
  316. // }
  317. // else
  318. // {
  319. // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  320. // {
  321. // uRow.Cells["CHK"].Value = false;
  322. // }
  323. // }
  324. //}
  325. }
  326. }