Make_PackageCollectionWeigh.cs 24 KB

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