Make_PackageCollection.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. using LabelManager2;
  2. using System;
  3. using System.Data;
  4. using System.Text;
  5. using System.Windows.Forms;
  6. using UAS_MES.DataOperate;
  7. using UAS_MES.Entity;
  8. using UAS_MES.PublicMethod;
  9. using System.Drawing;
  10. using System.Threading;
  11. using UAS_MES.PublicForm;
  12. namespace UAS_MES.Make
  13. {
  14. public partial class Make_PackageCollection : Form
  15. {
  16. DataHelper dh;
  17. DataTable dt;
  18. LogStringBuilder sql = new LogStringBuilder();
  19. AutoSizeFormClass asc = new AutoSizeFormClass();
  20. ApplicationClass lbl;
  21. Thread thread;
  22. DataTable Dbfind;
  23. string ErrorMessage = "";
  24. string oMakeCode = "";
  25. string oMsID = "";
  26. string oOutBoxCode = "";
  27. decimal StandardQTY = 0;
  28. System.DateTime[] indate;
  29. public Make_PackageCollection()
  30. {
  31. InitializeComponent();
  32. }
  33. //创建打印进程
  34. private void NewPrint()
  35. {
  36. try
  37. {
  38. lbl = new ApplicationClass();
  39. BaseUtil.WriteLbl(lbl);
  40. }
  41. catch (Exception ex)
  42. {
  43. OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
  44. }
  45. }
  46. private void 包装采集_Load(object sender, EventArgs e)
  47. {
  48. pa_outboxcode.ShowClickIcon = false;
  49. //设置DbFind的必须的数据
  50. PrintNum.Value = 1;
  51. asc.controllInitializeSize(this);
  52. thread = new Thread(NewPrint);
  53. SetLoadingWindow stw = new SetLoadingWindow(thread, "初始化打印程序");
  54. BaseUtil.SetFormCenter(stw);
  55. stw.ShowDialog();
  56. dh = new DataHelper();
  57. }
  58. private void 包装采集_SizeChanged(object sender, EventArgs e)
  59. {
  60. asc.controlAutoSize(this);
  61. }
  62. private void 包装采集_Activated(object sender, EventArgs e)
  63. {
  64. pa_outboxcode.Focus();
  65. }
  66. //刷新表单的数据的数据
  67. private void LoadData()
  68. {
  69. //加载表单数据
  70. string Err = "";
  71. if (pa_outboxcode.Text != "")
  72. {
  73. sql.Clear();
  74. sql.Append("select pr_code,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,pa_status,pr_packrule,pr_detail,pa_packageqty,pr_outboxinnerqty,pa_standardqty,pa_currentqty from package left join product on pa_prodcode=");
  75. sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
  76. Err = "箱号";
  77. }
  78. else
  79. {
  80. sql.Clear();
  81. sql.Append("select ms_makecode,pr_code,pa_status,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,nvl(pa_standardqty,pr_outboxinnerqty) pr_outboxinnerqty,pa_packageqty,pa_currentqty,");
  82. sql.Append("pa_outboxcode from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
  83. sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
  84. Err = "序列号";
  85. }
  86. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  87. if (dt.Rows.Count > 0)
  88. {
  89. if (pr_code.Text != "")
  90. {
  91. dt.Columns.Remove(dt.Columns["pa_standardqty"]);
  92. }
  93. StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
  94. BaseUtil.SetFormValue(this.Controls, dt);
  95. }
  96. else OperateResult.AppendText(">>" + Err + "不存在\n", Color.Red);
  97. }
  98. private void LoadGridData()
  99. {
  100. //加载Grid数据
  101. dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pa_prodcode,pd_barcode,pd_innerqty,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
  102. BaseUtil.FillDgvWithDataTable(PackageDetail, dt);
  103. //更新界面的采集数量
  104. pa_currentqty.Text = dh.getFieldDataByCondition("package", "pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
  105. }
  106. private void InsertDetail()
  107. {
  108. if (dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_id='" + oMsID + "'").ToString() == sn_code.Text)
  109. {
  110. if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) < int.Parse(pr_outboxinnerqty.Text))
  111. {
  112. sql.Clear();
  113. sql.Append("insert into packagedetail(pd_id,pd_paid,pd_outboxcode,pd_innerqty,pd_barcode) ");
  114. sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
  115. dh.ExecuteSql(sql.GetString(), "insert");
  116. dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  117. dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
  118. if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
  119. {
  120. OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
  121. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
  122. //满箱更新状态为1
  123. if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
  124. {
  125. dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  126. if (AutoPrint.Checked)
  127. Print_Click(new object(), new EventArgs());
  128. }
  129. LoadGridData();
  130. sn_code.Clear();
  131. }
  132. }
  133. else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已采集满\n", Color.Red);
  134. }
  135. else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
  136. }
  137. private void Print_Click(object sender, EventArgs e)
  138. {
  139. if (PrintLabel.Items.Count != 0)
  140. {
  141. if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
  142. {
  143. dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
  144. OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
  145. Print.CodeSoft(Tag.ToString(), lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
  146. }
  147. else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "尚未封箱,请封箱后执行打印\n", Color.Red);
  148. }
  149. else OperateResult.AppendText(">>产品" + pr_code.Text + "未维护打印标签\n", Color.Red);
  150. }
  151. //加载工单信息和装箱明细信息
  152. private void pa_code_KeyDown(object sender, KeyEventArgs e)
  153. {
  154. if (e.KeyCode == Keys.Enter)
  155. {
  156. LoadData();
  157. LoadGridData();
  158. }
  159. }
  160. //输入序列号的回车事件
  161. private void barcode_KeyDown(object sender, KeyEventArgs e)
  162. {
  163. //当用户输入回车键的时候
  164. if (e.KeyCode == Keys.Enter)
  165. {
  166. if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
  167. {
  168. if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
  169. {
  170. if (pa_outboxcode.Text == "")
  171. {
  172. LoadData();
  173. if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
  174. LoadGridData();
  175. else
  176. {
  177. if (AutoGenBoxCode.Checked)
  178. pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
  179. }
  180. }
  181. if (pa_outboxcode.Text == "")
  182. {
  183. OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
  184. return;
  185. }
  186. //按工单核对装箱
  187. switch (pr_packrule.Text.ToUpper())
  188. {
  189. case "MAKE":
  190. if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != ms_makecode.Text)
  191. {
  192. OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
  193. return;
  194. }
  195. break;
  196. case "SALE":
  197. if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
  198. {
  199. sql.Clear();
  200. sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
  201. sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
  202. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  203. if (dt.Rows.Count == 0)
  204. {
  205. OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
  206. return;
  207. }
  208. }
  209. break;
  210. case "PROD":
  211. if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
  212. {
  213. OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
  214. return;
  215. }
  216. break;
  217. case "MIX":
  218. break;
  219. case "SPEC":
  220. break;
  221. default:
  222. break;
  223. }
  224. //判断箱内总数必须大于0
  225. if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
  226. {
  227. OperateResult.AppendText(">>箱内容量必须大于0\n", Color.Red);
  228. return;
  229. }
  230. //如果未勾选了取消录入
  231. if (!Cancel.Checked)
  232. {
  233. //判断序列号是否已经装箱
  234. if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
  235. {
  236. OperateResult.AppendText(">>序列号" + sn_code.Text + "已经装箱!\n", Color.Red, sn_code);
  237. }
  238. else
  239. {
  240. //满箱之后采集下一个之前自动清除内容,生成新的箱号
  241. if ((AutoGenBoxCode.Checked && pa_currentqty.Text != "" && pr_outboxinnerqty.Text == pa_currentqty.Text) || pa_status.Text == "1")
  242. {
  243. pa_currentqty.Text = "";
  244. pa_outboxcode.Text = "";
  245. pa_status.Text = "0";
  246. BaseUtil.CleanDGVData(PackageDetail);
  247. pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
  248. }
  249. ////箱号不存在的情况
  250. if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
  251. {
  252. if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
  253. {
  254. OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
  255. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
  256. //满箱更新状态为1
  257. if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == pr_outboxinnerqty.Value)
  258. {
  259. dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  260. if (AutoPrint.Checked)
  261. Print_Click(new object(), new EventArgs());
  262. }
  263. LoadGridData();
  264. sn_code.Clear();
  265. }
  266. }
  267. else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
  268. }
  269. }
  270. //勾选了取消箱号先验证箱号存不存在,存在的话移除掉,重新加载一次数据
  271. else
  272. {
  273. string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
  274. if (outboxcode != "")
  275. {
  276. if (outboxcode == pa_outboxcode.Text)
  277. {
  278. dh.UpdateByCondition("package", "pa_status=0", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  279. //删除明细行的数据
  280. dh.ExecuteSql("delete from packagedetail where pd_barcode='" + sn_code.Text + "' and pd_paid=(select pa_id from package where pa_outboxcode='" + pa_outboxcode.Text + "')", "delete");
  281. //更新已装数
  282. dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty-1,pa_currentqty=pa_currentqty-1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  283. //清除序列号箱号
  284. dh.UpdateByCondition("makeserial", "ms_outboxcode=''", "ms_id='" + oMsID + "'");
  285. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "取消采集成功", sn_code.Text, "");
  286. OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green);
  287. LoadGridData();
  288. }
  289. else OperateResult.AppendText(">>序列号" + sn_code.Text + "不在箱" + pa_outboxcode.Text + "内\n", Color.Red);
  290. }
  291. else OperateResult.AppendText(">>序列号" + sn_code.Text + "尚未装箱\n", Color.Red);
  292. }
  293. }
  294. else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
  295. }
  296. else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
  297. }
  298. }
  299. private void Clean_Click(object sender, EventArgs e)
  300. {
  301. OperateResult.Clear();
  302. }
  303. private void pr_code_TextChanged(object sender, EventArgs e)
  304. {
  305. LoadCheckQTY();
  306. pa_outboxcode.MakeCode = ms_makecode.Text;
  307. pa_outboxcode.ProdCode = pr_code.Text;
  308. pa_outboxcode.Caller = "PACKAGE";
  309. dt = (DataTable)dh.ExecuteSql("select pl_labelcode||':'||pl_labelname pl_laname,pl_labelname,pl_labelcode,pl_labelurl,pl_indate from productlabel where pl_prodcode='" + pr_code.Text + "' order by pl_isdefault desc ", "select");
  310. PrintLabel.DataSource = dt;
  311. PrintLabel.DisplayMember = "pl_laname";
  312. PrintLabel.ValueMember = "pl_labelcode";
  313. ftpOperater ftp = new ftpOperater();
  314. indate = new System.DateTime[dt.Rows.Count];
  315. for (int i = 0; i < dt.Rows.Count; i++)
  316. {
  317. BaseUtil.GetPrintLabel(dt.Rows[i]["pl_labelname"].ToString(), dt.Rows[i]["pl_labelurl"].ToString(), dt.Rows[i]["pl_indate"].ToString());
  318. indate[i] = Convert.ToDateTime(dt.Rows[i]["pl_indate"].ToString());
  319. }
  320. }
  321. private void 包装采集_FormClosing(object sender, FormClosingEventArgs e)
  322. {
  323. BaseUtil.ClosePrint(lbl);
  324. dh.Dispose();
  325. }
  326. private void Packing_Click(object sender, EventArgs e)
  327. {
  328. if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
  329. {
  330. dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  331. pa_status.Text = "1";
  332. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");
  333. OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
  334. }
  335. else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.Red);
  336. }
  337. private void SendCheck_Click(object sender, EventArgs e)
  338. {
  339. if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "0")
  340. {
  341. sql.Clear();
  342. sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
  343. dh.ExecuteSql(sql.GetString(), "select");
  344. ob_nowcheckqty.Text = "";
  345. ob_batchqty.Text = "";
  346. ob_nowcheckqty.ForeColor = Color.Black;
  347. SendCheck.Enabled = false;
  348. OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
  349. LogicHandler.InsertMakeProcess(sn_code.Text, oMakeCode, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
  350. //记录操作日志
  351. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
  352. ob_checkno.Text = "";
  353. }
  354. else OperateResult.AppendText(">>必须封箱才能送检\n", Color.Red);
  355. }
  356. bool AutoCut;
  357. private void LoadCheckQTY()
  358. {
  359. sql.Clear();
  360. string condition = "";
  361. int nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
  362. int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
  363. if (nowcheckqty + 1 == batchqty && AutoCut)
  364. {
  365. condition = "and ob_status='UNCHECK' and ob_checkno='" + ob_checkno.Text + "'";
  366. }
  367. else
  368. {
  369. condition = "and ob_status='ENTERING' ";
  370. }
  371. sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
  372. sql.Append("ob_linecode='" + User.UserLineCode + "' and ob_prodcode='" + pr_code.Text + "' and ");
  373. sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
  374. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  375. if (dt.Rows.Count > 0)
  376. {
  377. ob_batchqty.Text = dt.Rows[0]["ob_batchqty"].ToString();
  378. ob_nowcheckqty.Text = dt.Rows[0]["ob_nowcheckqty"].ToString();
  379. ob_checkno.Text = dt.Rows[0]["ob_checkno"].ToString();
  380. nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
  381. batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
  382. if (nowcheckqty == batchqty)
  383. {
  384. ob_nowcheckqty.ForeColor = Color.Red;
  385. OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
  386. }
  387. }
  388. else
  389. {
  390. ob_batchqty.Text = "";
  391. ob_nowcheckqty.Text = "";
  392. ob_checkno.Text = "";
  393. SendCheck.Enabled = false;
  394. }
  395. if (ob_batchqty.Text != "")
  396. {
  397. SendCheck.Enabled = true;
  398. }
  399. else
  400. {
  401. SendCheck.Enabled = false;
  402. }
  403. }
  404. private void ob_checkno_TextChanged(object sender, EventArgs e)
  405. {
  406. if (ob_checkno.Text != "")
  407. {
  408. string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
  409. if (Cut == "" || Cut == "0")
  410. AutoCut = false;
  411. else
  412. AutoCut = true;
  413. SendCheck.Enabled = true;
  414. }
  415. }
  416. private void pr_outboxinnerqty_KeyDown(object sender, KeyEventArgs e)
  417. {
  418. if (e.KeyCode == Keys.Enter)
  419. ResetPackQTY();
  420. }
  421. private void pr_outboxinnerqty_Leave(object sender, EventArgs e)
  422. {
  423. ResetPackQTY();
  424. }
  425. private void ResetPackQTY()
  426. {
  427. //数据不符合限制的时候保持原有值
  428. int curretnqty = int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text);
  429. if (!(pr_outboxinnerqty.Value >= curretnqty))
  430. {
  431. pr_outboxinnerqty.Value = StandardQTY;
  432. }
  433. else
  434. {
  435. if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
  436. {
  437. string checknostatus = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno='" + pa_checkno.Text + "'").ToString();
  438. if (checknostatus == "" || checknostatus == "ENTERING")
  439. {
  440. if (pa_downstatus.Text == "0")
  441. {
  442. if (dh.CheckExist("source", "sc_code='" + pa_sccode.Text + "' and sc_stepcode='" + User.CurrentStepCode + "'"))
  443. {
  444. dh.UpdateByCondition("package", "pa_standardqty='" + pr_outboxinnerqty.Value + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
  445. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "修改箱内容量", "原容量" + StandardQTY + ",修改为" + pr_outboxinnerqty.Value + "'", pa_outboxcode.Text, pa_checkno.Text);
  446. return;
  447. }
  448. else
  449. OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "当前所在工序不是登录岗位资源所在工序,不允许修改数量\n", Color.Red);
  450. }
  451. else
  452. OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "处于下地状态,不允许修改标准容量\n", Color.Red);
  453. }
  454. else
  455. OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "处于送检中,不允许修改标准容量\n", Color.Red);
  456. }
  457. else
  458. OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在,修改容量无效\n", Color.Red);
  459. pr_outboxinnerqty.Value = StandardQTY;
  460. }
  461. }
  462. }
  463. }