Make_PositionStockQuery.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Text;
  6. using System.Windows.Forms;
  7. using UAS_MES_NEW.DataOperate;
  8. using UAS_MES_NEW.Entity;
  9. using UAS_MES_NEW.PublicMethod;
  10. namespace UAS_MES_NEW.Make
  11. {
  12. public partial class Make_PositionStockQuery : Form
  13. {
  14. AutoSizeFormClass asc = new AutoSizeFormClass();
  15. DataHelper dh;
  16. DataTable dt;
  17. LogStringBuilder sql = new LogStringBuilder();
  18. DataTable Dbfind;
  19. string ma_id;
  20. //上一次查询的工单号
  21. string last_macoe = "";
  22. string craftcode_condition = "";
  23. public Make_PositionStockQuery()
  24. {
  25. InitializeComponent();
  26. }
  27. private void Make_PositionStock_Load(object sender, EventArgs e)
  28. {
  29. asc.controllInitializeSize(this);
  30. ma_code.TableName = "make left join product on ma_prodcode=pr_code ";
  31. ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,pr_orispeccode # 型号,ma_qty # 工单数量,ma_craftcode # 工艺路线,pr_detail # 产品名称";
  32. ma_code.FormName = Name;
  33. ma_code.DBTitle = "工单查询";
  34. ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "pr_detail||'-'||pr_orispeccode pr_detail", "ma_craftcode","ma_qty" };
  35. ma_code.Condition = "ma_statuscode='STARTED' order by ma_auditdate desc ";
  36. ma_code.DbChange += Ma_code_DbChange;
  37. sc_stepcode.Text = User.CurrentStepCode;
  38. ma_code.SetLockCheckBox(Lock);
  39. Lock.GetMakeCodeCtl(ma_code);
  40. dh = SystemInf.dh;
  41. }
  42. private void Ma_code_DbChange(object sender, EventArgs e)
  43. {
  44. Dbfind = ma_code.ReturnData;
  45. BaseUtil.SetFormValue(this.Controls, Dbfind);
  46. FillDataGridView();
  47. }
  48. private void Make_PositionStock_SizeChanged(object sender, EventArgs e)
  49. {
  50. asc.controlAutoSize(this);
  51. }
  52. private void Clean_Click(object sender, EventArgs e)
  53. {
  54. OperateResult.Clear();
  55. }
  56. //物料批号Enter事件
  57. private void pr_batchnum_KeyDown(object sender, KeyEventArgs e)
  58. {
  59. if (e.KeyCode == Keys.Enter)
  60. {
  61. if (pr_batchnum.Text != "")
  62. {
  63. if (ma_code.Text != "")
  64. {
  65. sql.Clear();
  66. sql.Append("select cr_code from craft left join craftdetail on cd_crid=cr_id where cr_code in (" + craftcode_condition + ") ");
  67. sql.Append("and cr_prodcode='" + ma_prodcode.Text + "' and cr_statuscode='AUDITED' and (cd_stepcode='" + User.CurrentStepCode + "'or '" + User.CurrentStepCode + "' in ('CT1','CT2') )");
  68. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  69. if (dt.Rows.Count > 0)
  70. {
  71. //输入的是条码号的时候
  72. dt = (DataTable)dh.ExecuteSql("select nvl(bar_remain,0) bar_remain,bar_prodcode from barcode inner join product on pr_code=bar_prodcode where bar_code ='" + pr_batchnum.Text + "' order by bar_id desc", "select");
  73. if (dt.Rows.Count > 0)
  74. {
  75. string bar_remain = dt.Rows[0]["bar_remain"].ToString();
  76. string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
  77. sql.Clear();
  78. sql.Append("select ma_id sp_id,mm_oneuseqty sp_oneuseqty,mm_prodcode sp_fsoncode, mm_repprodcode sp_soncode,''sp_prefix from make left join makematerial on mm_maid=ma_id left join Product on mm_prodcode=pr_code ");
  79. sql.Append("where ma_code='" + ma_code.Text + "' and ma_prodcode='" + ma_prodcode.Text + "' and ");
  80. sql.Append("pr_mncode='" + User.CurrentStepCode + "' and (mm_prodcode ='" + bar_prodcode + "' or mm_repprodcode like '%" + bar_prodcode + "%') ");
  81. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  82. if (dt.Rows.Count > 0)
  83. {
  84. sql.Clear();
  85. sql.Append("select mss_makecode,mss_linecode from makesourcestock where mss_barcode = '" + pr_batchnum.Text + "'");
  86. DataTable BARCODE = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  87. if (BARCODE.Rows.Count > 0)
  88. {
  89. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "已经被工单:" + BARCODE.Rows[0]["mss_makecode"] + ",线别:" + BARCODE.Rows[0]["mss_linecode"] + "备料\n", Color.Red, pr_batchnum);
  90. return;
  91. }
  92. InsertMakeSourceStock(dt, int.Parse(bar_remain));
  93. }
  94. else OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
  95. }
  96. else
  97. {
  98. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料条码未找到库存信息\n", Color.Red, pr_batchnum);
  99. ////是否包含备料的批管控物料号
  100. //sql.Clear();
  101. //sql.Append("select sp_id,sp_oneuseqty,sp_fsoncode,sp_soncode,sp_prefix from stepbom left join stepproduct on sp_sbid=sb_id ");
  102. //sql.Append("where sb_craftcode='" + ma_craftcode.Text + "' and sb_prodcode='" + ma_prodcode.Text + "' and ");
  103. //sql.Append("sb_bomversion='" + ma_bomversion.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 ");
  104. //sql.Append("and (instr('" + pr_batchnum.Text + "',SP_SONCODE) > 0 or instr('" + pr_batchnum.Text + "',SP_FSONCODE)>0)");
  105. //dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  106. //if (dt.Rows.Count > 0)
  107. //{
  108. // InsertMakeSourceStock(dt, 0);
  109. //}
  110. //else
  111. //{
  112. // //匹配批管控物料中的前缀和长度
  113. // sql.Clear();
  114. // sql.Append("select sp_id,sp_fsoncode,sp_oneuseqty,sp_soncode,sp_prefix from stepbom left join stepproduct on sp_sbid=sb_id ");
  115. // sql.Append("where sb_craftcode='" + ma_craftcode.Text + "' and sb_prodcode='" + ma_prodcode.Text + "' and ");
  116. // sql.Append("sb_bomversion='" + ma_bomversion.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 ");
  117. // sql.Append("and instr('" + pr_batchnum.Text + "',sp_prefix) > 0 and ((nvl(SP_LENGTH,0)>0 and sp_length ");
  118. // sql.Append("= length('" + pr_batchnum.Text + "')) or nvl(SP_LENGTH,0)=0)");
  119. // dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  120. // if (dt.Rows.Count > 0)
  121. // {
  122. // InsertMakeSourceStock(dt, 0);
  123. // }
  124. // else OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
  125. //}
  126. }
  127. }
  128. else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
  129. }
  130. else OperateResult.AppendText(">>工单号不能为空\n", Color.Red, pr_batchnum);
  131. }
  132. else { };
  133. }
  134. }
  135. private void InsertMakeSourceStock(DataTable dt, int Barremain)
  136. {
  137. string sp_oneuseqty = dt.Rows[0]["sp_oneuseqty"].ToString();
  138. string sp_fsoncode = dt.Rows[0]["sp_fsoncode"].ToString();
  139. string sp_soncode = dt.Rows[0]["sp_soncode"].ToString();
  140. // string sp_prefix = dt.Rows[0]["sp_prefix"].ToString();
  141. sql.Clear();
  142. sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
  143. sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
  144. sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid,mss_sourcecode) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
  145. sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + sp_fsoncode + "',");
  146. sql.Append("sysdate,'" + User.UserCode + "','" + Barremain + "','" + Barremain + "','" + sp_oneuseqty + "','" + sp_soncode + "','" + ma_id + "','" + User.UserSourceCode + "')");
  147. dh.ExecuteSql(sql.GetString(), "insert");
  148. dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "' and bar_remain = "+ Barremain + "");
  149. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "上料物料" + pr_batchnum.Text, "", "");
  150. //数据插入成功后加载Grid的数据
  151. FillDataGridView();
  152. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
  153. }
  154. //加载Grid数据
  155. private void FillDataGridView()
  156. {
  157. //if (!show_all_check.Checked)
  158. //{
  159. sql.Clear();
  160. sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,mm_prodcode sp_fsoncode,mm_repprodcode sp_soncode,mss_prodcode,mm_oneuseqty sp_oneuseqty,sum(nvl(mss_qty,0)) mss_qty ,sum(nvl(mss_remain,0))mss_remain,");
  161. sql.Append("pr_detail,pr_orispeccode,sum(nvl(mss_useqty,0)) mss_useqty from make left join makematerial on mm_maid=ma_id left join Product on mm_prodcode=pr_code ");
  162. sql.Append(" left join makesourcestock on mss_craftcode=ma_craftcode and mss_makecode=ma_code and mss_linecode = '" + User.UserLineCode + "' ");
  163. sql.Append("and mss_stepcode=pr_mncode and nvl(mm_repprodcode,' ')=nvl(mss_prodcode,' ') and mm_prodcode=mss_fprodcode where ma_prodcode='" + ma_prodcode.Text + "' and ma_craftcode='" + ma_craftcode.Text + "' ");
  164. sql.Append("and pr_mncode='" + User.CurrentStepCode + "' and ma_code='" + ma_code.Text + "' group by nvl(mss_makecode,' ') ,mss_linecode,mm_prodcode ,mm_repprodcode ,mss_prodcode,mm_oneuseqty ,pr_detail,pr_orispeccode order by mm_prodcode");
  165. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  166. BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  167. //}
  168. //else
  169. //{
  170. // //sql.Clear();
  171. // //sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,sp_fsoncode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
  172. // //sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
  173. // //sql.Append("pr_code=sp_mothercode left join makesourcestock on mss_craftcode=sb_craftcode ");
  174. // //sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode where ");
  175. // //sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '" + User.UserLineCode + "' order by sp_soncode");
  176. // //DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  177. // //BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  178. // sql.Clear();
  179. // sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,mm_prodcode sp_fsoncode,nvl(mss_id,0) mss_id,mm_repprodcode sp_soncode,mss_prodcode,mm_oneuseqty sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
  180. // sql.Append("pr_detail,pr_orispeccode,nvl(mss_useqty,0) mss_useqty from make left join makematerial on mm_maid=ma_id left join Product on mm_prodcode=pr_code ");
  181. // sql.Append(" left join makesourcestock on mss_craftcode=ma_craftcode and mss_makecode=ma_code and mss_linecode = '" + User.UserLineCode + "' ");
  182. // sql.Append("and mss_stepcode=pr_mncode and nvl(mm_repprodcode,' ')=nvl(mss_prodcode,' ') and mm_prodcode=mss_fprodcode where nvl(ma_prodcode,' ')<>' ' and nvl(ma_craftcode,' ')<> ' ' and ");
  183. // sql.Append(" pr_mncode='" + User.CurrentStepCode + "' order by mm_prodcode");
  184. // DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  185. // BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  186. //}
  187. }
  188. private void Confirm_Click(object sender, EventArgs e)
  189. {
  190. pr_batchnum_KeyDown(sender, new KeyEventArgs(Keys.Enter));
  191. }
  192. private void Screen_Click(object sender, EventArgs e)
  193. {
  194. FillDataGridView();
  195. }
  196. private void ma_prodcode_TextChanged(object sender, EventArgs e)
  197. {
  198. if (ma_code.Text != "")
  199. {
  200. dt = (DataTable)dh.ExecuteSql("select ma_id,ma_craftcode,ma_statuscode,ma_code,ma_prodcode,pr_spec,pr_detail||'-'||pr_orispeccode pr_detail,ma_bomversion from make left join product on ma_prodcode=pr_code where ma_code='" + ma_code.Text + "'", "select");
  201. if (dt.Rows.Count > 0)
  202. {
  203. ma_id = dt.Rows[0]["ma_id"].ToString();
  204. string craftcode = dt.Rows[0]["ma_craftcode"].ToString();
  205. BaseUtil.SetFormValue(this.Controls, dt);
  206. }
  207. else OperateResult.AppendText(">>工单号不存在\n", Color.Red);
  208. }
  209. else OperateResult.AppendText(">>工单号不允许为空\n", Color.Red);
  210. }
  211. private void BatchProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
  212. {
  213. //if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
  214. //{
  215. // if (e.RowIndex >= 0)
  216. // {
  217. // string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
  218. // string useqty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_useqty"].Value.ToString();
  219. // string soncode = BatchProductDGV.Rows[e.RowIndex].Cells["sp_soncode"].Value.ToString();
  220. // if (id != "0")
  221. // {
  222. // dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
  223. // LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
  224. // OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
  225. // FillDataGridView();
  226. // }
  227. // }
  228. //}
  229. }
  230. private void ma_code_UserControlTextChanged(object sender, EventArgs e)
  231. {
  232. if (ma_code.Text.Length > 4)
  233. {
  234. string ErrMessage = "";
  235. if (LogicHandler.CheckMakeStatus(ma_code.Text, out ErrMessage))
  236. {
  237. craftcode_condition = "";
  238. DataTable dt = (DataTable)dh.ExecuteSql("select ma_craftcode from make where ma_code='" + ma_code.Text + "'", "select");
  239. string craftcode = "";
  240. if (dt.Rows.Count > 0)
  241. {
  242. craftcode = dt.Rows[0]["ma_craftcode"].ToString();
  243. }
  244. sql.Clear();
  245. sql.Append("select distinct ms_craftcode ma_craftcode from makeserial left join craft on cr_code=ms_craftcode ");
  246. sql.Append("where ms_makecode='" + ma_code.Text + "' and ms_craftcode<>'" + craftcode + "'");
  247. dt.Merge((DataTable)dh.ExecuteSql(sql.GetString(), "select"));
  248. ma_craftcode.DisplayMember = "ma_craftcode";
  249. ma_craftcode.ValueMember = "ma_craftcode";
  250. ma_craftcode.DataSource = dt;
  251. for (int i = 0; i < dt.Rows.Count; i++)
  252. {
  253. if (dt.Rows.Count - 1 == i)
  254. craftcode_condition += "'" + dt.Rows[i]["ma_craftcode"].ToString() + "'";
  255. else
  256. craftcode_condition += "'" + dt.Rows[i]["ma_craftcode"].ToString() + "',";
  257. }
  258. }
  259. }
  260. }
  261. private void BatchProductDGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
  262. {
  263. //if (BatchProductDGV.Columns[e.ColumnIndex].Name == "mss_qty")
  264. //{
  265. // string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
  266. // string qty = "0";
  267. // if (id != "0")
  268. // {
  269. // try
  270. // {
  271. // if (int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) > 0)
  272. // {
  273. // qty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString();
  274. // }
  275. // else
  276. // {
  277. // OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
  278. // return;
  279. // }
  280. // }
  281. // catch (Exception)
  282. // {
  283. // OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
  284. // return;
  285. // }
  286. // dh.UpdateByCondition("makesourcestock", "mss_qty='" + qty + "'", "mss_id='" + id + "'");
  287. // BatchProductDGV.Rows[e.RowIndex].Cells["mss_remain"].Value = int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) - int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_useqty"].Value.ToString());
  288. // dh.UpdateByCondition("makesourcestock", "mss_remain=mss_qty-nvl(mss_useqty,0)", "mss_id='" + id + "'");
  289. // }
  290. //}
  291. }
  292. private void BatchProductDGV_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
  293. {
  294. //if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
  295. //{
  296. // if (BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString() == "0")
  297. // e.Value = Properties.Resources.WhiteImage;
  298. // else
  299. // e.Value = Properties.Resources.bindingNavigatorDeleteItem_Image;
  300. //}
  301. }
  302. private void ma_craftcode_SelectedIndexChanged(object sender, EventArgs e)
  303. {
  304. Screen.PerformClick();
  305. }
  306. private void BatchProductDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  307. {
  308. //bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
  309. //if (e.ColumnIndex > 0)
  310. //{
  311. // if (BatchProductDGV.Columns[e.ColumnIndex].Name == "mss_remain")
  312. // {
  313. // SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  314. // e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
  315. // Rectangle border = e.CellBounds;
  316. // border.Width -= 1;
  317. // e.Graphics.DrawRectangle(Pens.White, border);
  318. // e.PaintContent(e.CellBounds);
  319. // e.Handled = true;
  320. // }
  321. //}
  322. }
  323. private void pi_type_check_CheckedChanged(object sender, EventArgs e)
  324. {
  325. if (show_all_check.Checked)
  326. {
  327. pr_batchnum.Enabled = false;
  328. FillDataGridView();
  329. }
  330. else
  331. {
  332. pr_batchnum.Enabled = true;
  333. FillDataGridView();
  334. }
  335. }
  336. private void normalButton1_Click(object sender, EventArgs e)
  337. {
  338. bool makesources = false;
  339. for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
  340. {
  341. string id_1 = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
  342. if (id_1 != "0")
  343. {
  344. makesources = true;
  345. }
  346. }
  347. if (makesources)
  348. {
  349. String dialog = MessageBox.Show("是否确认全部下料", "提示", MessageBoxButtons.OKCancel).ToString();
  350. if (dialog != "OK")
  351. {
  352. OperateResult.AppendText("取消全部下料\n", Color.Black);
  353. return;
  354. }
  355. else
  356. {
  357. List<string> idcol = new List<string>();
  358. List<string> makecodecol = new List<string>();
  359. List<string> soncodecol = new List<string>();
  360. for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
  361. {
  362. string id = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
  363. string useqty = BatchProductDGV.Rows[i].Cells["mss_useqty"].Value.ToString();
  364. string soncode = BatchProductDGV.Rows[i].Cells["sp_soncode"].Value.ToString();
  365. string makecode = BatchProductDGV.Rows[i].Cells["mss_makecode"].Value.ToString();
  366. if (id != "0")
  367. {
  368. idcol.Add(id);
  369. makecodecol.Add(makecode);
  370. soncodecol.Add("删除物料" + soncode);
  371. OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
  372. }
  373. }
  374. sql.Clear();
  375. sql.Append("insert into commandlog(cl_id,cl_caller,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
  376. sql.Append("cl_result,cl_sncode,cl_code) values( commandlog_seq.nextval,'" + Tag.ToString() + "','" + User.UserCode + "',sysdate,'" + User.UserLineCode + "' ,");
  377. sql.Append("'" + User.UserSourceCode + " ' ,:iMakeCode,'岗位备料',:iResult,' ',' ')");
  378. dh.BatchInsert(sql.GetString(), new String[] { "iMakeCode", "iResult" }, makecodecol.ToArray(), soncodecol.ToArray());
  379. dh.BatchInsert("delete from makesourcestock where mss_id=:id", new String[] { "id" }, idcol.ToArray());
  380. FillDataGridView();
  381. }
  382. }
  383. else
  384. {
  385. OperateResult.AppendText(">>没有上料记录,无需全部下料\n", Color.Red);
  386. }
  387. }
  388. }
  389. }