Make_GetReMakeSN.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. using LabelManager2;
  2. using Seagull.BarTender.Print;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Windows.Forms;
  12. using UAS_MES_NEW.DataOperate;
  13. using UAS_MES_NEW.Entity;
  14. using UAS_MES_NEW.PublicForm;
  15. using UAS_MES_NEW.PublicMethod;
  16. namespace UAS_MES_NEW.Make
  17. {
  18. public partial class Make_GetReMakeSN : Form
  19. {
  20. //打印进程
  21. ApplicationClass lbl;
  22. //初始化打印进程
  23. Thread InitPrint;
  24. LogStringBuilder sql = new LogStringBuilder();
  25. AutoSizeFormClass asc = new AutoSizeFormClass();
  26. DataHelper dh;
  27. DataTable dt;
  28. Document doc;
  29. private System.DateTime[] indate;
  30. string ErrMessage;
  31. public Make_GetReMakeSN()
  32. {
  33. InitializeComponent();
  34. }
  35. Engine engine;
  36. private void InPrint()
  37. {
  38. try
  39. {
  40. engine = new Engine(true);
  41. BaseUtil.WriteLbl();
  42. }
  43. catch (Exception ex)
  44. {
  45. OperateResult.AppendText("未正确安装BarTender软件\n", Color.Red);
  46. }
  47. }
  48. private void Make_GetReMakeSN_Load(object sender, EventArgs e)
  49. {
  50. ma_code.TableName = "make left join product on ma_prodcode=pr_code";
  51. ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,ma_qty # 工单数量,pr_detail # 产品名称,pr_spec # 产品规格,ma_craftcode # 途程编号";
  52. ma_code.FormName = Name;
  53. ma_code.SetValueField = new string[] { "ma_code", "pr_code", "ma_qty", "pr_detail", "pr_spec", "ma_craftcode" };
  54. ma_code.Condition = "ma_kind='返工' and ma_statuscode='STARTED'";
  55. ma_code.DbChange += Ma_code_DbChange;
  56. ma_code.SetLockCheckBox(LockCheckBox);
  57. LockCheckBox.GetMakeCodeCtl(ma_code);
  58. OperateResult.AppendText(">>请输入返工工单号\n", Color.Black);
  59. asc.controllInitializeSize(this);
  60. InitPrint = new Thread(InPrint);
  61. SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
  62. BaseUtil.SetFormCenter(stw);
  63. stw.ShowDialog();
  64. sn_code.Focus();
  65. dh = SystemInf.dh;
  66. }
  67. private void Ma_code_DbChange(object sender, EventArgs e)
  68. {
  69. DataTable dt = ma_code.ReturnData;
  70. BaseUtil.SetFormValue(this.Controls, dt);
  71. }
  72. private void Make_GetReMakeSN_SizeChanged(object sender, EventArgs e)
  73. {
  74. asc.controlAutoSize(this);
  75. }
  76. private void pr_code_TextChanged(object sender, EventArgs e)
  77. {
  78. DataTable _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='SN标签' and la_statuscode='AUDITED' order by la_isdefault", "select");
  79. PrintLabel.DataSource = _dt;
  80. PrintLabel.DisplayMember = "la_url";
  81. PrintLabel.ValueMember = "la_id";
  82. }
  83. private void sn_code_KeyDown(object sender, KeyEventArgs e)
  84. {
  85. if (e.KeyCode == Keys.Enter)
  86. {
  87. if (ma_code.Text != "")
  88. {
  89. //判断是否是途程第一道工序
  90. sql.Clear();
  91. sql.Append("select cd_id from craft left join craftdetail on cd_crid=cr_id where cr_code='" + ma_craftcode.Text + "' ");
  92. sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(cd_firststep,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'");
  93. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  94. if (dt.Rows.Count > 0)
  95. {
  96. if (sn_code.Text != "")
  97. {
  98. //判断序列号是否有效
  99. string Msid = dh.getFieldDataByCondition("makeserial ", "max(ms_id)", "(ms_sncode='" + sn_code.Text + "' or ms_imei1='" + sn_code.Text + "' or ms_imei2='" + sn_code.Text + "' or ms_imei3='" + sn_code.Text + "' ) and ms_makecode<>'" + ma_code.Text + "' ").ToString();
  100. if (Msid != "")
  101. {
  102. //序列号信息
  103. sql.Clear();
  104. sql.Append("select ms_beforesn,ms_sncode,ms_status,ms_makecode,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
  105. sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei3,ms_othid1,ms_othid2,ms_othid3");
  106. sql.Append(",MS_OTHCODE3,MS_OTHCODE2,MS_OTHCODE1,ms_bt from makeserial where ms_id='" + Msid + "'");
  107. DataTable SnInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  108. string ms_prodcode = SnInf.Rows[0]["ms_prodcode"].ToString();
  109. string ms_salecode = SnInf.Rows[0]["ms_salecode"].ToString();
  110. string ms_beforesn = SnInf.Rows[0]["ms_beforesn"].ToString();
  111. string ms_makecode = SnInf.Rows[0]["ms_makecode"].ToString();
  112. string Sn = SnInf.Rows[0]["ms_sncode"].ToString();
  113. string ms_status = SnInf.Rows[0]["ms_status"].ToString();
  114. string ms_outboxcode = SnInf.Rows[0]["ms_outboxcode"].ToString();
  115. //判断序列号是否已经被使用
  116. if (SnInf.Rows[0]["ms_nextmacode"].ToString() != "")
  117. {
  118. OperateResult.AppendText(">>序列号已经被工单号:" + SnInf.Rows[0]["ms_nextmacode"].ToString() + "使用\n", Color.Red, sn_code);
  119. return;
  120. }
  121. //工单信息
  122. sql.Clear();
  123. sql.Append("select ma_salecode,nvl(ma_checksacode,0)ma_checksacode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
  124. sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode,NVL(re_autodecom,0)");
  125. sql.Append("re_autodecom,nvl(re_ifsnok,0)re_ifsnok,re_code from make left join rework on ma_screcode=re_code where ");
  126. sql.Append("ma_code='" + ma_code.Text + "'and ma_kind='返工' and ma_statuscode='STARTED'");
  127. DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  128. string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
  129. string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
  130. string re_autodecom = MaInf.Rows[0]["re_autodecom"].ToString();
  131. string re_ifsnok = MaInf.Rows[0]["re_ifsnok"].ToString();
  132. string ma_checksacode = MaInf.Rows[0]["ma_checksacode"].ToString();
  133. string re_code = MaInf.Rows[0]["re_code"].ToString();
  134. int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
  135. int ma_inqty = int.Parse(MaInf.Rows[0]["ma_inqty"].ToString());
  136. int ma_scrapqty = int.Parse(MaInf.Rows[0]["ma_scrapqty"].ToString());
  137. int ma_qty = int.Parse(MaInf.Rows[0]["ma_qty"].ToString());
  138. if (ma_prodcode != ms_prodcode)
  139. {
  140. OperateResult.AppendText(">>序列号所属产品" + ms_prodcode + "与返工工单产品不一致\n", Color.Red, sn_code);
  141. return;
  142. }
  143. if (ma_checksacode != "0")
  144. {
  145. if (ms_salecode != "" && ma_salecode != "" && ms_salecode != ma_salecode)
  146. {
  147. OperateResult.AppendText(">>序列号所属合同" + ms_salecode + "与返工工单合同不一致\n", Color.Red, sn_code);
  148. return;
  149. }
  150. }
  151. if (ma_unlimitin == 0 && ma_inqty - ma_scrapqty + 1 > ma_qty)
  152. {
  153. OperateResult.AppendText(">>工单不允许超数投产\n", Color.Red, sn_code);
  154. return;
  155. }
  156. if (re_ifsnok != "0")
  157. {
  158. if (ms_status == "3" && dh.CheckExist("makebad", "mb_sncode = '" + sn_code.Text + "'and mb_makecode = '" + ms_makecode + "' and mb_status = '0'"))
  159. {
  160. OperateResult.AppendText(">>序列号:" + sn_code.Text + "处于不良状态,完成维修后才能归属至返工工单\n", Color.Red, sn_code);
  161. return;
  162. }
  163. }
  164. //if (ReWorkAsRelateTSN.Checked)
  165. //{
  166. // if (ms_beforesn != "")
  167. // {
  168. // Sn = ms_beforesn;
  169. // }
  170. // else
  171. // {
  172. // OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
  173. // return;
  174. // }
  175. //}
  176. string netcode = "";
  177. string imeid = "";
  178. string imei1 = "";
  179. string imei2 = "";
  180. string imei3 = "";
  181. string othid1 = "";
  182. string othid2 = "";
  183. string othid3 = "";
  184. string mac = "";
  185. string bt = "";
  186. string othcode1 = "";
  187. string othcode2 = "";
  188. string othcode3 = "";
  189. if (ma_saveimei.Checked)
  190. {
  191. netcode = SnInf.Rows[0]["MS_NETCODE"].ToString();
  192. imeid = SnInf.Rows[0]["MS_MEID"].ToString();
  193. imei1 = SnInf.Rows[0]["MS_IMEI1"].ToString();
  194. imei2 = SnInf.Rows[0]["ms_imei2"].ToString();
  195. imei3 = SnInf.Rows[0]["ms_imei3"].ToString();
  196. othid1 = SnInf.Rows[0]["ms_othid1"].ToString();
  197. othid2 = SnInf.Rows[0]["ms_othid2"].ToString();
  198. othid3 = SnInf.Rows[0]["ms_othid3"].ToString();
  199. }
  200. if (ma_savemacbt.Checked)
  201. {
  202. mac = SnInf.Rows[0]["ms_mac"].ToString();
  203. bt = SnInf.Rows[0]["ms_bt"].ToString();
  204. othcode1 = SnInf.Rows[0]["MS_OTHCODE1"].ToString();
  205. othcode2 = SnInf.Rows[0]["MS_OTHCODE2"].ToString();
  206. othcode3 = SnInf.Rows[0]["MS_OTHCODE3"].ToString();
  207. }
  208. string craftcode = MaInf.Rows[0]["ma_craftcode"].ToString();
  209. string craftname = MaInf.Rows[0]["ma_craftname"].ToString();
  210. string firstsn = SnInf.Rows[0]["ms_firstsn"].ToString();
  211. //工作中心为空的时候取工单的工作中心
  212. string workcenter = User.WorkCenter;
  213. if (workcenter == "")
  214. workcenter = MaInf.Rows[0]["ma_wccode"].ToString();
  215. //工单合同为空的时候取序列号合同,更新合同回工单
  216. string salecode = MaInf.Rows[0]["ma_salecode"].ToString();
  217. List<string> SQLS = new List<string>();
  218. if (salecode == "")
  219. {
  220. salecode = SnInf.Rows[0]["ms_salecode"].ToString();
  221. SQLS.Add("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'");
  222. }
  223. //插入返工工单
  224. sql.Clear();
  225. sql.Append("insert into MakeSerial(ms_id,ms_code,ms_sncode,ms_prodcode,ms_indate,ms_wccode");
  226. sql.Append(",ms_craftcode,ms_craftname,ms_nextstepcode,ms_status,ms_makecode,ms_linecode");
  227. sql.Append(",ms_sourcecode,ms_maid,ms_firstsn,ms_salecode,ms_mac,ms_bt,ms_othcode1,ms_othcode2,");
  228. sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei3,ms_meid,ms_othid1,ms_othid2,ms_othid3)");
  229. sql.Append("values(MakeSerial_seq.nextval,'" + Sn + "','" + Sn + "','" + pr_code.Text + "',");
  230. sql.Append("sysdate,'" + workcenter + "','" + craftcode + "','" + craftname + "','" + User.CurrentStepCode + "',");
  231. sql.Append("'0','" + ma_code.Text + "','" + User.UserLineCode + "','" + User.UserSourceCode + "','" + ma_id.Text + "',");
  232. sql.Append("'" + firstsn + "','" + salecode + "','" + mac + "','" + bt + "','" + othcode1 + "','" + othcode2 + "','" + othcode3 + "',");
  233. sql.Append("'" + netcode + "','" + imei1 + "','" + imei2 + "','" + imei3 + "','" + imeid + "','" + othid1 + "','" + othid2 + "','" + othid3 + "')");
  234. SQLS.Add(sql.GetString());
  235. //更新工单数量+1
  236. SQLS.Add("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'");
  237. //更新该序列号的所属工单为返工工单
  238. SQLS.Add("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'");
  239. if (ms_outboxcode != "")
  240. {
  241. string pamothercode = dh.getFieldDataByCondition("package", "pa_mothercode", "pa_outboxcode='" + ms_outboxcode + "'").ToString();
  242. //如果已装栈板从栈板解除
  243. if (pamothercode != "")
  244. {
  245. sql.Clear();
  246. sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
  247. sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
  248. sql.Append("pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
  249. SQLS.Add(sql.GetString());
  250. SQLS.Add("delete from packagedetail where pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
  251. DataTable dt = dh.getFieldsDatasByCondition("packagedetail left join package on pa_id=pd_paid", new string[] { "nvl(sum(pd_innerqty),0)", "count(1)" }, "pa_outboxcode='" + pamothercode + "'");
  252. string totalqty = dt.Rows[0][0].ToString();
  253. string currentqty = dt.Rows[0][1].ToString();
  254. SQLS.Add("update package set PA_TOTALQTY='" + totalqty + "',pa_packageqty='" + currentqty + "',pa_currentqty='" + currentqty + "' where pa_outboxcode='" + pamothercode + "'");
  255. }
  256. //备份和删除卡通箱明细
  257. sql.Clear();
  258. sql.Append("insert into packagebackup(pab_id,pab_prodcode,pab_outboxcode,pab_packdate,pab_level,pab_packageqty,pab_totalqty,pab_makecode,pab_status,pab_indate,pab_salecode,pab_printcount,pab_custcode,pab_type,");
  259. sql.Append("pab_weight,pab_currentqty,pab_standardqty,pab_packtype,pab_checkno,pab_downstatus,pab_sccode,pab_ymd,pab_mothercode,pab_currentstep,pab_nextstep,pab_outno,pab_iostatus,pab_remark) ");
  260. sql.Append("select pa_id,pa_prodcode,pa_outboxcode,pa_packdate,pa_level,pa_packageqty,pa_totalqty,pa_makecode,pa_status,pa_indate,pa_salecode,pa_printcount,pa_custcode,pa_type,pa_weight,pa_currentqty,");
  261. sql.Append("pa_standardqty,pa_packtype,pa_checkno,pa_downstatus,pa_sccode,pa_ymd,pa_mothercode,pa_currentstep,pa_nextstep,pa_outno,pa_iostatus,pa_remark from package where pa_outboxcode='" + ms_outboxcode + "'");
  262. SQLS.Add(sql.GetString());
  263. SQLS.Add("delete from package where pa_outboxcode='" + ms_outboxcode + "'");
  264. sql.Clear();
  265. sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
  266. sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
  267. sql.Append("pd_outboxcode='" + ms_outboxcode + "'");
  268. SQLS.Add(sql.GetString());
  269. SQLS.Add("delete from packagedetail where pd_outboxcode='" + ms_outboxcode + "' ");
  270. }
  271. sql.Clear();
  272. sql.Append("update makebad set mb_makecode='" + ms_makecode + "' where mb_sncode ='" + sn_code.Text + "' and mb_status=0");
  273. SQLS.Add(sql.GetString());
  274. if (re_autodecom != "0")
  275. {
  276. //sql.Clear();
  277. //sql.Append("select cm_makecode,cm_soncode,cm_barcode from craftmaterial left join makeserial on ms_makecode=");
  278. //sql.Append("cm_makecode and ms_sncode=cm_sncode and ms_prodcode=cm_maprodcode where ms_id='" + Msid + "'");
  279. //DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  280. //string cm_makecode = "";
  281. //string cm_soncode = "";
  282. //string cm_barcode = "";
  283. //if (dt.Rows.Count > 0)
  284. //{
  285. // cm_makecode = dt.Rows[0]["cm_makecode"].ToString();
  286. // cm_soncode = dt.Rows[0]["cm_soncode"].ToString();
  287. // cm_barcode = dt.Rows[0]["cm_barcode"].ToString();
  288. //}
  289. sql.Clear();
  290. sql.Append("update craftmaterial set cm_status=-1,cm_dropcode='" + re_code + "',cm_dropman='" + User.UserCode + "',cm_dropdate=sysdate where ");
  291. sql.Append("cm_firstsn='" + firstsn + "' and nvl(cm_status,0)=0 and exists (select 1 from makesndecompose ");
  292. sql.Append("where msd_recode='" + re_code + "' and msd_fsoncode=cm_fsoncode and msd_stepcode=cm_stepcode)");
  293. SQLS.Add(sql.GetString());
  294. //TSN失效
  295. //sql.Clear();
  296. //sql.Append("update makeserial set ms_nextmacode='' where ms_nextmacode='" + cm_makecode + "'");
  297. //sql.Append(" and ms_sncode='" + cm_barcode + "' and ms_prodcode='" + cm_soncode + "' ");
  298. sql.Clear();
  299. sql.Append("update makeserial set ms_nextmacode='' where ms_id in (select a.ms_id from makeserial B INNER JOIN CRAFTMATERIAL ON cm_firstsn=B.ms_firstsn");
  300. sql.Append("inner join makeserial a on cm_barcode=A.ms_sncode and cm_soncode=A.ms_prodcode inner join makesndecompose on msd_fsoncode=cm_fsoncode and msd_stepcode=cm_stepcode ");
  301. sql.Append("AND A.MS_NEXTMACODE=cm_makecode where b.ms_id='" + Msid + "' and msd_recode='" + re_code + "')");
  302. SQLS.Add(sql.GetString());
  303. }
  304. dh.ExecuteSQLTran(SQLS.ToArray());
  305. //if (ReWorkAsRelateTSN.Checked)
  306. //{
  307. // dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_sncode='" + ms_beforesn + "' and ms_nextmacode='" + ms_makecode + "'", "update");
  308. //}
  309. OperateResult.AppendText(">>序列号" + sn_code.Text + "归属工单" + ma_code.Text + "成功。\n", Color.Green);
  310. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "返工信息采集", "序列号归属成功", sn_code.Text, "");
  311. getsnqty.Text = dh.getFieldDataByCondition("makeserial ", "count(1)", "ms_makecode='" + ma_code.Text + "'").ToString();
  312. if (AutoPrint.Checked)
  313. {
  314. if (PrintLabel.Items.Count != 0)
  315. {
  316. OperateResult.AppendText(">>打印序列号" + sn_code.Text + "\n", Color.Black);
  317. //doc = lbl.Documents.Open(PrintLabel.Text);
  318. if (!Print.BarTenderS(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sn_code.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "SN标签", "0", out ErrMessage))
  319. {
  320. OperateResult.AppendText(ErrMessage + "\n", Color.Red);
  321. return;
  322. }
  323. dh.UpdateByCondition("makeserial", "ms_printcount=nvl(ms_printcount,0)+1", "ms_sncode='" + sn_code.Text + "'");
  324. }
  325. else OperateResult.AppendText(">>" + pr_code.Text + "未维护标签\n", Color.Black);
  326. }
  327. sn_code.Clear();
  328. }
  329. else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在或者已绑定工单\n", Color.Red, sn_code);
  330. }
  331. else OperateResult.AppendText(">>序列号不允许为空\n", Color.Red, sn_code);
  332. }
  333. else OperateResult.AppendText(">>该岗位资源对应的工序不是当前返工工单途程中的第一道工序,请切换资源编号\n", Color.Red, sn_code);
  334. }
  335. else OperateResult.AppendText(">>工单号不允许为空\n", Color.Red, sn_code);
  336. }
  337. }
  338. private void ma_code_UserControlTextChanged(object sender, EventArgs e)
  339. {
  340. if (ma_code.Text.Length >= 5)
  341. {
  342. if (dh.CheckExist("make", "ma_kind='返工' and ma_statuscode='STARTED' and ma_code='" + ma_code.Text + "'"))
  343. {
  344. sql.Clear();
  345. sql.Append("select ma_id,ma_craftcode,ma_code,pr_code,pr_detail,pr_spec,ma_qty,nvl(ma_savemacbt,0) ma_savemacbt,nvl(ma_saveimei, 0)");
  346. sql.Append("ma_saveimei from make left join product on ma_prodcode=pr_code where ma_code='" + ma_code.Text + "'");
  347. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  348. BaseUtil.SetFormValue(this.Controls, dt);
  349. if (dt.Rows[0]["ma_saveimei"].ToString() != "0")
  350. {
  351. ma_saveimei.Checked = true;
  352. }
  353. if (dt.Rows[0]["ma_savemacbt"].ToString() != "0")
  354. {
  355. ma_savemacbt.Checked = true;
  356. }
  357. }
  358. }
  359. }
  360. private void PrintLabel_SelectedValueChanged(object sender, EventArgs e)
  361. {
  362. if (PrintLabel.SelectedValue != null && PrintLabel.SelectedValue.ToString() != "System.Data.DataRowView")
  363. {
  364. string PrintNums = dh.getFieldDataByCondition("label", "la_printnos", "la_id='" + PrintLabel.SelectedValue.ToString() + "'").ToString();
  365. PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
  366. }
  367. }
  368. }
  369. }