Warehouse_ProductMakeIn.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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 UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. using UAS_MES_NEW.PublicMethod;
  12. namespace UAS_MES_NEW.Warehouse
  13. {
  14. public partial class Warehouse_ProductMakeIn : Form
  15. {
  16. DataTable dbfind;
  17. AutoSizeFormClass asc = new AutoSizeFormClass();
  18. LogStringBuilder sql = new LogStringBuilder();
  19. DataTable dt;
  20. DataHelper dh;
  21. DataTable dta;
  22. DataTable dtpi;
  23. DataTable dtform;
  24. DataTable dtms;
  25. int getcount;
  26. public Warehouse_ProductMakeIn()
  27. {
  28. InitializeComponent();
  29. }
  30. private void input_KeyDown(object sender, KeyEventArgs e)
  31. {
  32. if (e.KeyCode == Keys.Enter)
  33. {
  34. if (input.Text == "")
  35. {
  36. OperateResult.AppendText("录入信息不能为空\n", Color.Red, input);
  37. return;
  38. }
  39. if (!cancel.Checked)
  40. {
  41. if (palletBtn.Checked)
  42. {
  43. sql.Clear();
  44. sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
  45. sql.Append("pa_outno,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
  46. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  47. if (dt.Rows.Count > 0)
  48. {
  49. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  50. string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
  51. string pa_status = dt.Rows[0]["pa_status"].ToString();
  52. string pa_outno = dt.Rows[0]["pa_outno"].ToString();
  53. string pa_id = dt.Rows[0]["pa_id"].ToString();
  54. string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
  55. if (!CheckStatus(pa_downstatus, pa_status, pa_iostatus, pa_outno, "栈板"))
  56. return;
  57. insertprodiomac(pa_id, pa_makecode, "PALLET");
  58. OperateResult.AppendText("栈板" + input.Text + "完工入库成功\n", Color.Green);
  59. }
  60. else
  61. {
  62. OperateResult.AppendText("栈板号" + input.Text + "不存在,重新输入栈板号\n", Color.Red, input);
  63. return;
  64. }
  65. }
  66. else if (bigboxBtn.Checked)
  67. {
  68. string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
  69. if (outboxcode != "")
  70. {
  71. input.Text = outboxcode;
  72. }
  73. sql.Clear();
  74. sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
  75. sql.Append("pa_outno,pa_mothercode,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type in (1,2)");
  76. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  77. if (dt.Rows.Count > 0)
  78. {
  79. string pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
  80. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  81. string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
  82. string pa_status = dt.Rows[0]["pa_status"].ToString();
  83. string pa_outno = dt.Rows[0]["pa_outno"].ToString();
  84. string pa_id = dt.Rows[0]["pa_id"].ToString();
  85. string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
  86. if (pa_mothercode != "")
  87. {
  88. OperateResult.AppendText("箱号" + input.Text + "已经装大箱或者栈板" + pa_mothercode + ",不允许单独操作\n", Color.Red, input);
  89. return;
  90. }
  91. if (!CheckStatus(pa_downstatus, pa_status, pa_iostatus, pa_outno, "箱"))
  92. return;
  93. insertprodiomac(pa_id, pa_makecode, "BOX");
  94. OperateResult.AppendText("箱号" + input.Text + "完工入库成功\n", Color.Green);
  95. }
  96. else
  97. {
  98. OperateResult.AppendText("箱号" + input.Text + "不存在,重新输入箱号\n", Color.Red, input);
  99. return;
  100. }
  101. }
  102. else if (serBtn.Checked)
  103. {
  104. string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)ms_id", "ms_sncode='" + input.Text + "'").ToString();
  105. if (ms_id == "")
  106. {
  107. OperateResult.AppendText("序列号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
  108. return;
  109. }
  110. else
  111. {
  112. sql.Clear();
  113. sql.Append("select ms_status,nvl(ms_downstatus,0)ms_downstatus,ms_outboxcode,ms_makecode,nvl(ms_iostatus,0)ms_iostatus,ms_prodcode,ms_outno from makeserial where ms_id='" + ms_id + "'");
  114. dtms = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  115. string ms_downstatus = dtms.Rows[0]["ms_downstatus"].ToString();
  116. string ms_status = dtms.Rows[0]["ms_status"].ToString();
  117. string ms_outboxcode = dtms.Rows[0]["ms_outboxcode"].ToString();
  118. string ms_iostatus = dtms.Rows[0]["ms_iostatus"].ToString();
  119. string ms_outno = dtms.Rows[0]["ms_outno"].ToString();
  120. string ms_prodcode = dtms.Rows[0]["ms_prodcode"].ToString();
  121. string ms_makecode = dtms.Rows[0]["ms_makecode"].ToString();
  122. if (ms_status != "2")
  123. {
  124. OperateResult.AppendText("序列号" + input.Text + "未完工,不允许出货\n", Color.Red, input);
  125. return;
  126. }
  127. if (ms_outboxcode != "")
  128. {
  129. OperateResult.AppendText("序列号" + input.Text + "有外箱号" + ms_outboxcode + ",不允许单独操作\n", Color.Red, input);
  130. return;
  131. }
  132. if (ms_downstatus != "0")
  133. {
  134. OperateResult.AppendText("序列号" + input.Text + "处于下地状态,不允许出货\n", Color.Red, input);
  135. return;
  136. }
  137. if (ms_iostatus == "1")
  138. {
  139. OperateResult.AppendText("序列号" + input.Text + "已经入库,不允许重复入库\n", Color.Red, input);
  140. return;
  141. }
  142. if (ms_iostatus == "2")
  143. {
  144. OperateResult.AppendText("序列号" + input.Text + "已经出库,出库单号:" + ms_outno + "\n", Color.Red, input);
  145. return;
  146. }
  147. if (ms_iostatus == "3")
  148. {
  149. OperateResult.AppendText("序列号" + input.Text + "处于售后退货状态\n", Color.Red, input);
  150. return;
  151. }
  152. sql.Clear();
  153. sql.Append("insert into prodiomac(pim_id,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_inorout,pim_class) ");
  154. sql.Append("values(prodiomac_seq.nextval,'" + ms_prodcode + "','" + input.Text + "',sysdate,'" + User.UserCode + "',' ','IN','完工入库')");
  155. dh.ExecuteSql(sql.GetString(), "insert");
  156. dh.UpdateByCondition("makeserial", "ms_iostatus=1", " ms_id='" + ms_id + "'");
  157. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "序列号" + input.Text + "完工入库", "序列号" + input.Text + "完工入库成功", input.Text, "");
  158. OperateResult.AppendText("序列号" + input.Text + "完工入库成功\n", Color.Green);
  159. }
  160. }
  161. else
  162. {
  163. OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
  164. return;
  165. }
  166. LoadGridData();
  167. input.Clear();
  168. }
  169. else
  170. {
  171. if (palletBtn.Checked)
  172. {
  173. sql.Clear();
  174. sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
  175. sql.Append("pa_outno,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
  176. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  177. if (dt.Rows.Count > 0)
  178. {
  179. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  180. string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
  181. string pa_status = dt.Rows[0]["pa_status"].ToString();
  182. string pa_outno = dt.Rows[0]["pa_outno"].ToString();
  183. string pa_id = dt.Rows[0]["pa_id"].ToString();
  184. string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
  185. if (pa_iostatus != "1")
  186. {
  187. OperateResult.AppendText("栈板号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
  188. return;
  189. }
  190. if (pa_outno != "")
  191. {
  192. OperateResult.AppendText("栈板号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
  193. return;
  194. }
  195. DeleteData();
  196. deleteprodiomac(pa_id, pa_makecode, "PALLET");
  197. OperateResult.AppendText("栈板" + input.Text + "取消完工入库成功\n", Color.Green, input);
  198. }
  199. else
  200. {
  201. OperateResult.AppendText("栈板号" + input.Text + "不存在,重新输入栈板号\n", Color.Red, input);
  202. return;
  203. }
  204. }
  205. else if (bigboxBtn.Checked)
  206. {
  207. string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
  208. if (outboxcode != "")
  209. {
  210. input.Text = outboxcode;
  211. }
  212. sql.Clear();
  213. sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
  214. sql.Append("pa_outno,pa_mothercode,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type in (1,2)");
  215. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  216. if (dt.Rows.Count > 0)
  217. {
  218. string pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
  219. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  220. string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
  221. string pa_status = dt.Rows[0]["pa_status"].ToString();
  222. string pa_outno = dt.Rows[0]["pa_outno"].ToString();
  223. string pa_id = dt.Rows[0]["pa_id"].ToString();
  224. string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
  225. if (pa_mothercode != "")
  226. {
  227. OperateResult.AppendText("箱号" + input.Text + "已经装大箱或者栈板" + pa_mothercode + ",不允许单独操作\n", Color.Red, input);
  228. return;
  229. }
  230. if (pa_iostatus != "1")
  231. {
  232. OperateResult.AppendText("箱号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
  233. return;
  234. }
  235. if (pa_outno != "")
  236. {
  237. OperateResult.AppendText("箱号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
  238. return;
  239. }
  240. DeleteData();
  241. deleteprodiomac(pa_id, pa_makecode, "BOX");
  242. OperateResult.AppendText("箱号" + input.Text + "取消完工入库成功\n", Color.Green, input);
  243. }
  244. else
  245. {
  246. OperateResult.AppendText("箱号" + input.Text + "不存在,重新输入箱号\n", Color.Red, input);
  247. return;
  248. }
  249. }
  250. else if (serBtn.Checked)
  251. {
  252. string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)ms_id", "ms_sncode='" + input.Text + "'").ToString();
  253. if (ms_id == "")
  254. {
  255. OperateResult.AppendText("序列号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
  256. return;
  257. }
  258. else
  259. {
  260. sql.Clear();
  261. sql.Append("select ms_status,nvl(ms_downstatus,0)ms_downstatus,ms_outboxcode,ms_makecode,nvl(ms_iostatus,0)ms_iostatus,ms_prodcode,ms_outno from makeserial where ms_id='" + ms_id + "'");
  262. dtms = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  263. string ms_downstatus = dtms.Rows[0]["ms_downstatus"].ToString();
  264. string ms_status = dtms.Rows[0]["ms_status"].ToString();
  265. string ms_outboxcode = dtms.Rows[0]["ms_outboxcode"].ToString();
  266. string ms_iostatus = dtms.Rows[0]["ms_iostatus"].ToString();
  267. string ms_outno = dtms.Rows[0]["ms_outno"].ToString();
  268. string ms_prodcode = dtms.Rows[0]["ms_prodcode"].ToString();
  269. string ms_makecode = dtms.Rows[0]["ms_makecode"].ToString();
  270. if (ms_outboxcode != "")
  271. {
  272. OperateResult.AppendText("序列号" + input.Text + "有外箱号" + ms_outboxcode + ",不允许单独操作\n", Color.Red, input);
  273. return;
  274. }
  275. if (ms_outno != "")
  276. {
  277. OperateResult.AppendText("序列号" + input.Text + "已被出货单单号:" + ms_outno + "锁定\n", Color.Red, input);
  278. return;
  279. }
  280. if (ms_iostatus != "1")
  281. {
  282. OperateResult.AppendText("序列号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
  283. return;
  284. }
  285. DeleteData();
  286. sql.Clear();
  287. sql.Append("delete from prodiomac where pim_id =(select max(pim_id) from prodiomac where ");
  288. sql.Append(" pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库' )");
  289. dh.ExecuteSql(sql.GetString(), "delete");
  290. dh.UpdateByCondition("makeserial", "ms_iostatus=0", " ms_id='" + ms_id + "'");
  291. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "序列号" + input.Text + "取消完工入库", "序列号" + input.Text + "取消完工入库成功", input.Text, "");
  292. OperateResult.AppendText("序列号" + input.Text + "取消完工入库成功\n", Color.Green, input);
  293. }
  294. }
  295. else
  296. {
  297. OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
  298. return;
  299. }
  300. }
  301. getqty.Text = ((DataTable)bindingSource1.DataSource).Rows.Count.ToString();
  302. }
  303. }
  304. private Boolean CheckStatus(string pa_downstatus, string pa_status, string pa_iostatus, string pa_outno, string type)
  305. {
  306. if (pa_status == "0")
  307. {
  308. OperateResult.AppendText(type + "号" + input.Text + "未封装\n", Color.Red, input);
  309. return false;
  310. }
  311. if (pa_downstatus != "0")
  312. {
  313. OperateResult.AppendText(type + "号" + input.Text + "处于下地状态,如需完工入库,请先取消下地\n", Color.Red, input);
  314. return false;
  315. }
  316. if (pa_iostatus == "1")
  317. {
  318. OperateResult.AppendText(type + "号" + input.Text + "已经入库,不允许重复入库\n", Color.Red, input);
  319. return false;
  320. }
  321. if (pa_iostatus == "2")
  322. {
  323. OperateResult.AppendText(type + "号" + input.Text + "已经出库,出库单号:" + pa_outno + "\n", Color.Red, input);
  324. return false;
  325. }
  326. if (pa_iostatus == "3")
  327. {
  328. OperateResult.AppendText(type + "号" + input.Text + "处于售后退货状态\n", Color.Red, input);
  329. return false;
  330. }
  331. sql.Clear();
  332. sql.Append("select wm_concat(v_barcode)data,count(1)cn from mes_package_view left join ");
  333. sql.Append("makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode ");
  334. sql.Append("where v_outboxcode='" + input.Text + "' and nvl(ms_status,0)<>2 and rownum<20");
  335. dta = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  336. string CN = dta.Rows[0]["CN"].ToString();
  337. string DATA = dta.Rows[0]["DATA"].ToString();
  338. if (int.Parse(CN) > 0)
  339. {
  340. OperateResult.AppendText(type + "号" + input.Text + "内的序列号尚未完工,不允许进行完工入库,序列号:" + DATA + "\n", Color.Red, input);
  341. return false;
  342. }
  343. return true;
  344. }
  345. private void insertprodiomac(string pa_id, string pa_makecode, string type)
  346. {
  347. sql.Clear();
  348. sql.Append("insert into prodiomac(pim_id,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode,pim_inorout,pim_class) ");
  349. sql.Append("select prodiomac_seq.nextval,v_prodcode,v_barcode,sysdate,'" + User.UserCode + "','" + type + "','" + input.Text + "','IN','完工入库' from mes_package_view where v_outboxcode='" + input.Text + "'");
  350. dh.ExecuteSql(sql.GetString(), "update");
  351. dh.UpdateByCondition("package", "pa_iostatus=1", "pa_id='" + pa_id + "'");
  352. if (type == "BOX")
  353. {
  354. type = "箱";
  355. }
  356. else
  357. type = "栈板";
  358. //dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_id in (select max(ms_id) from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '"+input.Text+"') GROUP BY ms_sncode)");
  359. List<string> v_barcode = new List<string>();
  360. List<string> v_makecode = new List<string>();
  361. DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
  362. for (int i = 0; i < datatable.Rows.Count; i++)
  363. {
  364. v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
  365. v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
  366. }
  367. dh.BatchInsert("update makeserial set ms_iostatus=1 where ms_sncode = :v_barcode and ms_makecode = :v_makecode", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
  368. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, type + "号" + input.Text + "完工入库", type + "号" + input.Text + "完工入库成功", "", input.Text);
  369. return;
  370. }
  371. /// <summary>
  372. /// 加载Grid数据
  373. /// </summary>
  374. private void LoadGridData()
  375. {
  376. if (palletBtn.Checked || bigboxBtn.Checked)
  377. {
  378. sql.Clear();
  379. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  380. sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "'and pim_inorout='IN' AND pim_class='完工入库'");
  381. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  382. (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
  383. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
  384. }
  385. else
  386. {
  387. sql.Clear();
  388. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  389. sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
  390. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  391. (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
  392. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
  393. }
  394. }
  395. /// <summary>
  396. /// 去除重复Grid数据
  397. /// </summary>
  398. private void DeleteData()
  399. {
  400. if (palletBtn.Checked || bigboxBtn.Checked)
  401. {
  402. sql.Clear();
  403. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  404. sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
  405. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  406. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource, dt, "pim_id"));
  407. }
  408. else
  409. {
  410. sql.Clear();
  411. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  412. sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
  413. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  414. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource, dt, "pim_id"));
  415. }
  416. }
  417. private void deleteprodiomac(string pa_id, string pa_makecode, string type)
  418. {
  419. sql.Clear();
  420. sql.Append("delete from prodiomac where pim_id in (select pim_id from prodiomac where ");
  421. sql.Append(" pim_outboxcode='" + input.Text + "' and pim_type='" + type + "' and pim_inorout='IN' AND pim_class='完工入库' )");
  422. dh.ExecuteSql(sql.GetString(), "delete");
  423. dh.UpdateByCondition("package", "pa_iostatus=0", "pa_id='" + pa_id + "'");
  424. List<string> v_barcode = new List<string>();
  425. List<string> v_makecode = new List<string>();
  426. DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
  427. for (int i = 0; i < datatable.Rows.Count; i++)
  428. {
  429. v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
  430. v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
  431. }
  432. dh.BatchInsert("update makeserial set ms_iostatus=0 where ms_sncode = :v_barcode and ms_makecode = :v_makecode", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
  433. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, type + "号" + input.Text + "取消完工入库", type + "号" + input.Text + "取消完工入库成功", "", input.Text);
  434. //dh.UpdateByCondition("makeserial", "ms_iostatus=0", "ms_id in (select max(ms_id) from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "') GROUP BY ms_sncode)");
  435. return;
  436. }
  437. private void Warehouse_ProductMakeIn_Load(object sender, EventArgs e)
  438. {
  439. asc.controllInitializeSize(this);
  440. getcount = 0;
  441. getqty.Text = getcount.ToString();
  442. dh = SystemInf.dh;
  443. sql.Clear();
  444. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  445. sql.Append("left join product on pr_code=pim_prodcode where pim_id is null");
  446. bindingSource1.DataSource = dh.ExecuteSql(sql.GetString(), "select");
  447. input.Focus();
  448. OperateResult.AppendText("请输入栈板进行采集\n", Color.Black, input);
  449. }
  450. private void Warehouse_ProductMakeIn_SizeChanged(object sender, EventArgs e)
  451. {
  452. asc.controlAutoSize(this);
  453. }
  454. private void serBtn_Click(object sender, EventArgs e)
  455. {
  456. if (((RadioButton)sender).Checked == true)
  457. {
  458. if (((RadioButton)sender).Name == "serBtn")
  459. {
  460. input.Focus();
  461. OperateResult.AppendText("请输入序列号进行采集\n", Color.Black, input);
  462. }
  463. else if (((RadioButton)sender).Name == "bigboxBtn")
  464. {
  465. input.Focus();
  466. OperateResult.AppendText("请输入箱号进行采集\n", Color.Black, input);
  467. }
  468. else if (((RadioButton)sender).Name == "palletBtn")
  469. {
  470. input.Focus();
  471. OperateResult.AppendText("请输入栈板进行采集\n", Color.Black, input);
  472. }
  473. }
  474. }
  475. private void textBoxWithPlaceHolder1_UserControlTextChanged(object sender, EventArgs e)
  476. {
  477. if (pallecode.Text.Length == 0)
  478. {
  479. input.Enabled = true;
  480. if (bindingSource1.DataSource != null)
  481. {
  482. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
  483. }
  484. }
  485. }
  486. private void Search_Click(object sender, EventArgs e)
  487. {
  488. if (pallecode.Text.Length >= 1)
  489. {
  490. sql.Clear();
  491. sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
  492. sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode like '%" + pallecode.Text + "%' and pim_inorout='IN' AND pim_class='完工入库'");
  493. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  494. BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
  495. input.Enabled = false;
  496. }
  497. else
  498. OperateResult.AppendText("查询栏为空\n", Color.Black);
  499. }
  500. private void InOutDetailDGV_DataSourceChanged(object sender, EventArgs e)
  501. {
  502. getqty.Text = InOutDetailDGV.Rows.Count.ToString();
  503. }
  504. }
  505. }