Make_PositionStockNew.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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_PositionStockNew : 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_PositionStockNew()
  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,bar_status 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. string bar_status = dt.Rows[0]["bar_status"].ToString();
  78. if (bar_status != "2")
  79. {
  80. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "未出库,不允许采集\n", Color.Red, pr_batchnum);
  81. return;
  82. }
  83. sql.Clear();
  84. 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 ");
  85. sql.Append("where ma_code='" + ma_code.Text + "' and ma_prodcode='" + ma_prodcode.Text + "' and ");
  86. sql.Append("pr_mncode='" + User.CurrentStepCode + "' and (mm_prodcode ='" + bar_prodcode + "' or mm_repprodcode like '%" + bar_prodcode + "%') ");
  87. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  88. if (dt.Rows.Count > 0)
  89. {
  90. sql.Clear();
  91. sql.Append("select mss_makecode,mss_linecode from makesourcestock where mss_barcode = '" + pr_batchnum.Text + "'");
  92. DataTable BARCODE = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  93. if (BARCODE.Rows.Count > 0)
  94. {
  95. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "已经被工单:" + BARCODE.Rows[0]["mss_makecode"] + ",线别:" + BARCODE.Rows[0]["mss_linecode"] + "备料\n", Color.Red, pr_batchnum);
  96. return;
  97. }
  98. InsertMakeSourceStock(dt, Double.Parse(bar_remain));
  99. }
  100. else OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
  101. }
  102. else
  103. {
  104. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料条码未找到库存信息\n", Color.Red, pr_batchnum);
  105. ////是否包含备料的批管控物料号
  106. //sql.Clear();
  107. //sql.Append("select sp_id,sp_oneuseqty,sp_fsoncode,sp_soncode,sp_prefix from stepbom left join stepproduct on sp_sbid=sb_id ");
  108. //sql.Append("where sb_craftcode='" + ma_craftcode.Text + "' and sb_prodcode='" + ma_prodcode.Text + "' and ");
  109. //sql.Append("sb_bomversion='" + ma_bomversion.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 ");
  110. //sql.Append("and (instr('" + pr_batchnum.Text + "',SP_SONCODE) > 0 or instr('" + pr_batchnum.Text + "',SP_FSONCODE)>0)");
  111. //dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  112. //if (dt.Rows.Count > 0)
  113. //{
  114. // InsertMakeSourceStock(dt, 0);
  115. //}
  116. //else
  117. //{
  118. // //匹配批管控物料中的前缀和长度
  119. // sql.Clear();
  120. // sql.Append("select sp_id,sp_fsoncode,sp_oneuseqty,sp_soncode,sp_prefix from stepbom left join stepproduct on sp_sbid=sb_id ");
  121. // sql.Append("where sb_craftcode='" + ma_craftcode.Text + "' and sb_prodcode='" + ma_prodcode.Text + "' and ");
  122. // sql.Append("sb_bomversion='" + ma_bomversion.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 ");
  123. // sql.Append("and instr('" + pr_batchnum.Text + "',sp_prefix) > 0 and ((nvl(SP_LENGTH,0)>0 and sp_length ");
  124. // sql.Append("= length('" + pr_batchnum.Text + "')) or nvl(SP_LENGTH,0)=0)");
  125. // dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  126. // if (dt.Rows.Count > 0)
  127. // {
  128. // InsertMakeSourceStock(dt, 0);
  129. // }
  130. // else OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
  131. //}
  132. }
  133. }
  134. else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
  135. }
  136. else OperateResult.AppendText(">>工单号不能为空\n", Color.Red, pr_batchnum);
  137. }
  138. else { };
  139. }
  140. }
  141. private void InsertMakeSourceStock(DataTable dt, Double Barremain)
  142. {
  143. string sp_oneuseqty = dt.Rows[0]["sp_oneuseqty"].ToString();
  144. string sp_fsoncode = dt.Rows[0]["sp_fsoncode"].ToString();
  145. string sp_soncode = dt.Rows[0]["sp_soncode"].ToString();
  146. // string sp_prefix = dt.Rows[0]["sp_prefix"].ToString();
  147. sql.Clear();
  148. sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
  149. sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
  150. sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid,mss_sourcecode) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
  151. sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + sp_fsoncode + "',");
  152. sql.Append("sysdate,'" + User.UserCode + "','" + Barremain + "','" + Barremain + "','" + sp_oneuseqty + "','" + sp_soncode + "','" + ma_id + "','" + User.UserSourceCode + "')");
  153. dh.ExecuteSql(sql.GetString(), "insert");
  154. dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "' and bar_remain = "+ Barremain + "");
  155. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "上料物料" + pr_batchnum.Text, "", "");
  156. //数据插入成功后加载Grid的数据
  157. FillDataGridView();
  158. OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
  159. }
  160. //加载Grid数据
  161. private void FillDataGridView()
  162. {
  163. if (!show_all_check.Checked)
  164. {
  165. sql.Clear();
  166. 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,");
  167. 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 ");
  168. sql.Append(" left join makesourcestock on mss_craftcode=ma_craftcode and mss_makecode=ma_code and mss_linecode = '" + User.UserLineCode + "' ");
  169. 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 + "' ");
  170. sql.Append("and pr_mncode='" + User.CurrentStepCode + "' and ma_code='" + ma_code.Text + "' order by mm_prodcode");
  171. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  172. BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  173. }
  174. else
  175. {
  176. //sql.Clear();
  177. //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,");
  178. //sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
  179. //sql.Append("pr_code=sp_mothercode left join makesourcestock on mss_craftcode=sb_craftcode ");
  180. //sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode where ");
  181. //sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '" + User.UserLineCode + "' order by sp_soncode");
  182. //DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  183. //BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  184. sql.Clear();
  185. 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,");
  186. 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 ");
  187. sql.Append(" left join makesourcestock on mss_craftcode=ma_craftcode and mss_makecode=ma_code and mss_linecode = '" + User.UserLineCode + "' ");
  188. 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 ");
  189. sql.Append(" pr_mncode='" + User.CurrentStepCode + "' order by mm_prodcode");
  190. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  191. BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  192. }
  193. }
  194. private void Confirm_Click(object sender, EventArgs e)
  195. {
  196. pr_batchnum_KeyDown(sender, new KeyEventArgs(Keys.Enter));
  197. }
  198. private void Screen_Click(object sender, EventArgs e)
  199. {
  200. FillDataGridView();
  201. }
  202. private void ma_prodcode_TextChanged(object sender, EventArgs e)
  203. {
  204. if (ma_code.Text != "")
  205. {
  206. 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");
  207. if (dt.Rows.Count > 0)
  208. {
  209. ma_id = dt.Rows[0]["ma_id"].ToString();
  210. string craftcode = dt.Rows[0]["ma_craftcode"].ToString();
  211. BaseUtil.SetFormValue(this.Controls, dt);
  212. }
  213. else OperateResult.AppendText(">>工单号不存在\n", Color.Red);
  214. }
  215. else OperateResult.AppendText(">>工单号不允许为空\n", Color.Red);
  216. }
  217. private void BatchProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
  218. {
  219. if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
  220. {
  221. if (e.RowIndex >= 0)
  222. {
  223. string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
  224. string useqty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_useqty"].Value.ToString();
  225. string soncode = BatchProductDGV.Rows[e.RowIndex].Cells["sp_soncode"].Value.ToString();
  226. if (id != "0")
  227. {
  228. dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
  229. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
  230. OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
  231. FillDataGridView();
  232. }
  233. }
  234. }
  235. }
  236. private void ma_code_UserControlTextChanged(object sender, EventArgs e)
  237. {
  238. if (ma_code.Text.Length > 4)
  239. {
  240. string ErrMessage = "";
  241. if (LogicHandler.CheckMakeStatus(ma_code.Text, out ErrMessage))
  242. {
  243. craftcode_condition = "";
  244. DataTable dt = (DataTable)dh.ExecuteSql("select ma_craftcode from make where ma_code='" + ma_code.Text + "'", "select");
  245. string craftcode = "";
  246. if (dt.Rows.Count > 0)
  247. {
  248. craftcode = dt.Rows[0]["ma_craftcode"].ToString();
  249. }
  250. sql.Clear();
  251. sql.Append("select distinct ms_craftcode ma_craftcode from makeserial left join craft on cr_code=ms_craftcode ");
  252. sql.Append("where ms_makecode='" + ma_code.Text + "' and ms_craftcode<>'" + craftcode + "'");
  253. dt.Merge((DataTable)dh.ExecuteSql(sql.GetString(), "select"));
  254. ma_craftcode.DisplayMember = "ma_craftcode";
  255. ma_craftcode.ValueMember = "ma_craftcode";
  256. ma_craftcode.DataSource = dt;
  257. for (int i = 0; i < dt.Rows.Count; i++)
  258. {
  259. if (dt.Rows.Count - 1 == i)
  260. craftcode_condition += "'" + dt.Rows[i]["ma_craftcode"].ToString() + "'";
  261. else
  262. craftcode_condition += "'" + dt.Rows[i]["ma_craftcode"].ToString() + "',";
  263. }
  264. }
  265. }
  266. }
  267. private void BatchProductDGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
  268. {
  269. if (BatchProductDGV.Columns[e.ColumnIndex].Name == "mss_qty")
  270. {
  271. string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
  272. string qty = "0";
  273. if (id != "0")
  274. {
  275. try
  276. {
  277. if (Double.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) > 0)
  278. {
  279. qty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString();
  280. }
  281. else
  282. {
  283. OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
  284. return;
  285. }
  286. }
  287. catch (Exception)
  288. {
  289. OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
  290. return;
  291. }
  292. dh.UpdateByCondition("makesourcestock", "mss_qty='" + qty + "'", "mss_id='" + id + "'");
  293. BatchProductDGV.Rows[e.RowIndex].Cells["mss_remain"].Value = Double.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) - int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_useqty"].Value.ToString());
  294. dh.UpdateByCondition("makesourcestock", "mss_remain=mss_qty-nvl(mss_useqty,0)", "mss_id='" + id + "'");
  295. }
  296. }
  297. }
  298. private void BatchProductDGV_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
  299. {
  300. if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
  301. {
  302. if (BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString() == "0")
  303. e.Value = Properties.Resources.WhiteImage;
  304. else
  305. e.Value = Properties.Resources.bindingNavigatorDeleteItem_Image;
  306. }
  307. }
  308. private void ma_craftcode_SelectedIndexChanged(object sender, EventArgs e)
  309. {
  310. Screen.PerformClick();
  311. }
  312. private void BatchProductDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  313. {
  314. bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
  315. if (e.ColumnIndex > 0)
  316. {
  317. if (BatchProductDGV.Columns[e.ColumnIndex].Name == "mss_remain")
  318. {
  319. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  320. e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
  321. Rectangle border = e.CellBounds;
  322. border.Width -= 1;
  323. e.Graphics.DrawRectangle(Pens.White, border);
  324. e.PaintContent(e.CellBounds);
  325. e.Handled = true;
  326. }
  327. }
  328. }
  329. private void pi_type_check_CheckedChanged(object sender, EventArgs e)
  330. {
  331. if (show_all_check.Checked)
  332. {
  333. pr_batchnum.Enabled = false;
  334. FillDataGridView();
  335. }
  336. else
  337. {
  338. pr_batchnum.Enabled = true;
  339. FillDataGridView();
  340. }
  341. }
  342. private void normalButton1_Click(object sender, EventArgs e)
  343. {
  344. bool makesources = false;
  345. for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
  346. {
  347. string id_1 = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
  348. if (id_1 != "0")
  349. {
  350. makesources = true;
  351. }
  352. }
  353. if (makesources)
  354. {
  355. String dialog = MessageBox.Show("是否确认全部下料", "提示", MessageBoxButtons.OKCancel).ToString();
  356. if (dialog != "OK")
  357. {
  358. OperateResult.AppendText("取消全部下料\n", Color.Black);
  359. return;
  360. }
  361. else
  362. {
  363. List<string> idcol = new List<string>();
  364. List<string> makecodecol = new List<string>();
  365. List<string> soncodecol = new List<string>();
  366. for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
  367. {
  368. string id = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
  369. string useqty = BatchProductDGV.Rows[i].Cells["mss_useqty"].Value.ToString();
  370. string soncode = BatchProductDGV.Rows[i].Cells["sp_soncode"].Value.ToString();
  371. string makecode = BatchProductDGV.Rows[i].Cells["mss_makecode"].Value.ToString();
  372. if (id != "0")
  373. {
  374. idcol.Add(id);
  375. makecodecol.Add(makecode);
  376. soncodecol.Add("删除物料" + soncode);
  377. OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
  378. }
  379. }
  380. sql.Clear();
  381. sql.Append("insert into commandlog(cl_id,cl_caller,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
  382. sql.Append("cl_result,cl_sncode,cl_code) values( commandlog_seq.nextval,'" + Tag.ToString() + "','" + User.UserCode + "',sysdate,'" + User.UserLineCode + "' ,");
  383. sql.Append("'" + User.UserSourceCode + " ' ,:iMakeCode,'岗位备料',:iResult,' ',' ')");
  384. dh.BatchInsert(sql.GetString(), new String[] { "iMakeCode", "iResult" }, makecodecol.ToArray(), soncodecol.ToArray());
  385. dh.BatchInsert("delete from makesourcestock where mss_id=:id", new String[] { "id" }, idcol.ToArray());
  386. FillDataGridView();
  387. }
  388. }
  389. else
  390. {
  391. OperateResult.AppendText(">>没有上料记录,无需全部下料\n", Color.Red);
  392. }
  393. }
  394. }
  395. }