Make_SpecialCartonPack.cs 25 KB

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