frmPipRedDashed.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Core.Mes.Client.Comm.Tool;
  14. using System.Collections;
  15. using Core.StlMes.Client.YdmPipeManage.Controls;
  16. using Core.StlMes.Client.YdmBase;
  17. using Infragistics.Win.UltraWinEditors;
  18. namespace Core.StlMes.Client.YdmPipeManage
  19. {
  20. public partial class frmPipRedDashed : FrmBase
  21. {
  22. public frmPipRedDashed(OpeBase ob)
  23. {
  24. this.ob = ob;
  25. InitializeComponent();
  26. }
  27. string strInbound = "800704";//入库类型(缴库红冲)
  28. //质保ID
  29. private string rccid;
  30. public string Rccid
  31. {
  32. get { return rccid; }
  33. set { rccid = value; }
  34. }
  35. //钢种id
  36. private string gradeCode;
  37. public string GradeCode
  38. {
  39. get { return gradeCode; }
  40. set { gradeCode = value; }
  41. }
  42. //钢种名称
  43. private string gradeName;
  44. public string GradeName
  45. {
  46. get { return gradeName; }
  47. set { gradeName = value; }
  48. }
  49. //产线代码
  50. private string plineCode;
  51. public string PlineCode
  52. {
  53. get { return plineCode; }
  54. set { plineCode = value; }
  55. }
  56. //产线名称
  57. private string plineName;
  58. public string PlineName
  59. {
  60. get { return plineName; }
  61. set { plineName = value; }
  62. }
  63. UltraComboEditor ucePro = new UltraComboEditor();
  64. UltraComboEditor uceSpec = new UltraComboEditor();
  65. UltraComboEditor uceSteel = new UltraComboEditor();
  66. UltraComboEditor uceModel = new UltraComboEditor();
  67. public string buttonValue;
  68. private void frmPipRedDashed_Load(object sender, EventArgs e)
  69. {
  70. querySqlServerData(Rccid);
  71. InitStorage();
  72. }
  73. /// <summary>
  74. /// 下拉框绑定数据
  75. /// </summary>
  76. private void InitStorage()
  77. {
  78. //YdmBaseClass.InitComboEditor(cmbSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGradeDetail", "GRADECODE", this.ob, false);
  79. //YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
  80. //YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  81. //YdmBaseClass.InitComboEditor(cmbStorage, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  82. //YdmBaseClass.InitComboEditorWithParm(cmbJudge, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStoveNo", "lcode", this.ob, false, new object[] { time1, time });
  83. //YdmBaseClass.InitComboEditor(cmbOrder, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderNo", "ORDER_NO", this.ob, false);
  84. YdmBaseClass.InitComboEditor(ucePro, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getKind", "PRODUCCODE", this.ob, true);
  85. YdmBaseClass.InitComboEditor(uceSpec, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSpec", "SPEC_CODE", this.ob, true);
  86. YdmBaseClass.InitComboEditor(uceSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSteel", "STEELCODE", this.ob, true);
  87. YdmBaseClass.InitComboEditor(uceModel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getModel", "MODEL_CODE", this.ob, true);
  88. YdmBaseClass.BindColumn(ucePro, "CXKIND", this.Controls, ultraGrid1, 0);
  89. YdmBaseClass.BindColumn(uceSpec, "CXGG", this.Controls, ultraGrid1, 0);
  90. YdmBaseClass.BindColumn(uceSteel, "CXSTEELLEVEL", this.Controls, ultraGrid1, 0);
  91. YdmBaseClass.BindColumn(uceModel, "CXTYPEOFTHREAD", this.Controls, ultraGrid1, 0);
  92. }
  93. private void ultraToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  94. {
  95. switch (e.Tool.Key)
  96. {
  97. case"pipRedDashed":
  98. pipRedDashed();
  99. break;
  100. case"Close":
  101. this.Close();
  102. buttonValue = "0";
  103. break;
  104. default:
  105. break;
  106. }
  107. }
  108. /// <summary>
  109. /// 缴库红冲
  110. /// </summary>
  111. private void pipRedDashed()
  112. {
  113. string instockDoc = "";
  114. string instockDocList = "";
  115. string strInMemo = "";
  116. int count = 0;
  117. UltraGridRow row = ultraGrid1.ActiveRow;
  118. ArrayList matParm = new ArrayList();//材料表
  119. ArrayList statusUpdate = new ArrayList();//质保
  120. ArrayList plnSpale = new ArrayList();//销售合同提报
  121. int pipNum = 0;
  122. double pipWgt = 0.0;
  123. double pipLength = 0.0;
  124. int m = 0;
  125. int mun = 0;
  126. int n = 0;
  127. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
  128. {
  129. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  130. {
  131. mun = int.Parse(uRow.Cells["ACT_COUNT"].Text);
  132. if (mun + int.Parse(row.Cells["hgunit"].Text.Trim()) > 0)
  133. {
  134. n++;
  135. }
  136. }
  137. }
  138. if (n > 1)
  139. {
  140. MessageUtil.ShowTips("已缴库记录有多条支数大于红冲支数,你到底要冲哪条记录,请选择相应缴库记录!");
  141. return;
  142. }
  143. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
  144. {
  145. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  146. {
  147. //instockDocList = uRow.Cells["INSTOCK_DOC"].Text.Trim();
  148. //if (instockDoc != instockDocList)
  149. //{
  150. // MessageUtil.ShowTips("您选择的入库单号不一致,请重新选择!");
  151. // uRow.Cells["CHK"].Value = false;
  152. // return;
  153. //}
  154. pipNum += int.Parse(uRow.Cells["ACT_COUNT"].Text.Trim());
  155. pipWgt += double.Parse(uRow.Cells["ACT_WEIGHT"].Text.Trim());
  156. pipLength += double.Parse(uRow.Cells["ACT_LEN"].Text.Trim());
  157. }
  158. }
  159. if (int.Parse(row.Cells["hgunit"].Text) + pipNum < 0)
  160. {
  161. MessageUtil.ShowTips("缴库红冲支数大于已缴库支数,不允许红冲!");
  162. return;
  163. }
  164. else if (int.Parse(row.Cells["hgunit"].Text) + pipNum > 0)
  165. {
  166. if (pipWgt + double.Parse(row.Cells["hgweight"].Text.Trim()) < 0)
  167. {
  168. MessageUtil.ShowTips("缴库红冲支数小于已缴库支数,红冲重量大于已缴库重量不允许红冲!");
  169. return;
  170. }
  171. else if (pipWgt + double.Parse(row.Cells["hgweight"].Text.Trim()) > 0)
  172. {
  173. if (pipLength + double.Parse(row.Cells["hgm"].Text.Trim()) < 0)
  174. {
  175. MessageUtil.ShowTips("缴库红冲支数小于已缴库支数,红冲长度大于已缴库长度不允许红冲!");
  176. }
  177. }
  178. }
  179. else if (int.Parse(row.Cells["hgunit"].Text) + pipNum == 0)
  180. {
  181. }
  182. if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库红冲?") == DialogResult.No) return;
  183. foreach (UltraGridRow gridRow in ultraGrid4.Rows)
  184. {
  185. if (Convert.ToBoolean(gridRow.Cells["CHK"].Text) == true)
  186. {
  187. ArrayList matList = new ArrayList();
  188. #region 要缴库的每一炉重量小于要缴库的重量
  189. matList.Add(row.Cells["lcode"].Value.ToString()); //炉号
  190. matList.Add(row.Cells["lotno"].Value.ToString());//批号
  191. matList.Add(row.Cells["hgunit"].Value.ToString());//支数
  192. matList.Add(row.Cells["cxkind"].Value.ToString());//品名代码
  193. matList.Add(row.Cells["cxkind"].Text.ToString());//品名名称
  194. matList.Add(row.Cells["cxsteellevel"].Value.ToString());//钢级(牌号)代码
  195. matList.Add(row.Cells["cxsteellevel"].Text.ToString());//钢级名称
  196. matList.Add(row.Cells["cxgg"].Value.ToString());//产品规格代码
  197. matList.Add(row.Cells["cxgg"].Text.ToString());//产品规格描述
  198. matList.Add(row.Cells["cxtypeofthread"].Value.ToString());//扣型代码
  199. matList.Add(row.Cells["cxtypeofthread"].Text.ToString());//扣型描述 10
  200. matList.Add(gridRow.Cells["STD_CODE"].Value.ToString());//标准代码
  201. matList.Add(gridRow.Cells["STD_NAME"].Value.ToString());//标准名称
  202. matList.Add("");
  203. matList.Add("");
  204. matList.Add("");//标准类别代码
  205. matList.Add(row.Cells["STDSTYLE"].Value.ToString());//标准类别描述
  206. matList.Add(gridRow.Cells["ORDER_NO"].Value.ToString());//合同号
  207. matList.Add(gridRow.Cells["ORDER_SEQ"].Value.ToString());//合同行号
  208. matList.Add(gridRow.Cells["DELIVERY_NO"].Value.ToString());//交货行号
  209. matList.Add(gridRow.Cells["ORD_PK"].Value.ToString());//合同主键
  210. matList.Add(gridRow.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
  211. matList.Add(gridRow.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
  212. matList.Add(gridRow.Cells["ACT_DIMATER"].Value.ToString());// 外径
  213. matList.Add(gridRow.Cells["ACT_HEIGHT"].Value.ToString());//壁厚
  214. matList.Add("");//长度编码(订货)
  215. matList.Add("");//长度描述(订货)
  216. matList.Add("");//长度单位 27
  217. matList.Add(gridRow.Cells["ACT_LEN_MIN"].Value.ToString());//下限
  218. matList.Add(gridRow.Cells["ACT_LEN_MAX"].Value.ToString());//上限
  219. matList.Add(this.UserInfo.GetUserName());//操作人
  220. matList.Add("0");
  221. matList.Add("1");
  222. matList.Add(row.Cells["testidea"].Value.ToString());//备注
  223. matList.Add(row.Cells["hgweight"].Value.ToString());//重量
  224. //double weight = Convert.ToDouble(row.Cells["HGWEIGHT"].Value.ToString());
  225. //double unit = Convert.ToDouble(row.Cells["HGUNIT"].Value.ToString());
  226. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  227. if (dtMemo.Rows.Count >= 1)
  228. {
  229. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  230. }
  231. matList.Add(strInMemo);
  232. matList.Add(this.UserInfo.GetDeptid());
  233. matList.Add(this.UserInfo.GetDepartment());//37
  234. matList.Add(strInbound);
  235. matList.Add(gridRow.Cells["STORAGE_NO"].Value.ToString());//仓库号
  236. matList.Add(gridRow.Cells["BELONG_CODE"].Value.ToString());//所属单位代码
  237. matList.Add(gridRow.Cells["BELONG_NAME"].Value.ToString());// 所属单位
  238. matList.Add(row.Cells["hgunit"].Value.ToString());
  239. matList.Add(row.Cells["rcdid"].Value.ToString());
  240. matList.Add(row.Cells["hgm"].Value.ToString());//长度
  241. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  242. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  243. matList.Add(row.Cells["standard"].Value.ToString());//判定标准
  244. matList.Add(row.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
  245. matList.Add(plineCode);
  246. matList.Add(plineName);//50
  247. matList.Add(gradeCode);
  248. matList.Add(gradeName);
  249. matList.Add(gridRow.Cells["PRODUCT_FLAG"].Value.ToString());//勾选入库记录的材料类别
  250. matList.Add(gridRow.Cells["BATCH_GROUD_NO"].Value.ToString());//组号
  251. matList.Add((double.Parse(gridRow.Cells["ACT_WEIGHT"].Text) + double.Parse(row.Cells["hgweight"].Text.Trim())).ToString());
  252. matList.Add((int.Parse(gridRow.Cells["ACT_COUNT"].Text) + int.Parse(row.Cells["hgunit"].Text.Trim())).ToString());
  253. if (gridRow.Cells["ACT_LEN"].Text != "" && row.Cells["hgm"].Text.Trim() != "")
  254. {
  255. matList.Add((double.Parse(gridRow.Cells["ACT_LEN"].Text) + double.Parse(row.Cells["hgm"].Text.Trim())).ToString());
  256. }
  257. else
  258. {
  259. matList.Add("");
  260. }
  261. matList.Add("AI" + gridRow.Cells["INSTOCK_DOC"].Text.ToString().Substring(2));//红冲单号
  262. matParm.Add(matList);
  263. #endregion
  264. ArrayList plnList = new ArrayList();
  265. plnList.Add(gridRow.Cells["ACT_WEIGHT"].Text);
  266. plnList.Add(gridRow.Cells["ACT_COUNT"].Text);
  267. plnList.Add(this.UserInfo.GetUserName());
  268. plnList.Add(gridRow.Cells["ORDER_NO"].Value.ToString());
  269. plnList.Add(gridRow.Cells["ORDER_SEQ"].Value.ToString());
  270. plnList.Add(gridRow.Cells["DELIVERY_NO"].Value.ToString());
  271. plnList.Add(row.Cells["lcode"].Text.Trim());
  272. plnList.Add(row.Cells["lotno"].Text.Trim());
  273. plnList.Add(gridRow.Cells["BATCH_GROUD_NO"].Text);
  274. plnList.Add(gridRow.Cells["PRODUCT_FLAG"].Value.ToString());
  275. plnSpale.Add(plnList);
  276. ArrayList statusList = new ArrayList();
  277. statusList.Add(row.Cells["RCDID"].Value.ToString());
  278. statusUpdate.Add(statusList);
  279. }
  280. }
  281. CoreClientParam ccp = new CoreClientParam();
  282. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  283. ccp.MethodName = "pipRedDashed";
  284. ccp.ServerParams = new object[] { matParm, plnSpale, statusUpdate };
  285. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  286. if (ccp.ReturnCode != -1)
  287. {
  288. // MessageUtil.ShowTips(ccp.ReturnInfo);
  289. if (ccp.ReturnInfo.Equals("缴库红冲成功!"))
  290. {
  291. buttonValue = "1";
  292. this.Close();
  293. }
  294. }
  295. }
  296. /// <summary>
  297. /// 查询质保红冲数据
  298. /// </summary>
  299. /// <param name="rcid"></param>
  300. private void querySqlServerData(string rccid)
  301. {
  302. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerData", new object[] { rccid }, this.ob);
  303. GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
  304. }
  305. /// <summary>
  306. /// 查询已缴库记录
  307. /// </summary>
  308. private void queryInList(string heatNo,string bacthNo)
  309. {
  310. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getInListData", new object[] { heatNo, bacthNo }, this.ob);
  311. GridHelper.CopyDataToDatatable(ref dt, ref dataTable4, true);
  312. }
  313. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  314. {
  315. ultraGrid1.UpdateData();
  316. string heatNo = this.ultraGrid1.ActiveRow.Cells["lcode"].Text;//炉号
  317. string bacthNo = this.ultraGrid1.ActiveRow.Cells["lotno"].Text;//批号
  318. queryInList(heatNo, bacthNo);
  319. }
  320. }
  321. }