浏览代码

特殊装箱界面逻辑修改

Hcsy 7 年之前
父节点
当前提交
259d66ac82

+ 48 - 21
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -23,13 +23,12 @@ namespace UAS_MES.Make
         LogStringBuilder sql = new LogStringBuilder();
         AutoSizeFormClass asc = new AutoSizeFormClass();
         ApplicationClass lbl;
-        Document doc;
         Thread thread;
-        DataTable Dbfind;
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
         string ActWeigh;
+        string oMsStatus = "";
 
         //称量的标准重量
         double Weight;
@@ -61,7 +60,7 @@ namespace UAS_MES.Make
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl();
             }
-            catch (Exception ex)
+            catch (Exception)
             {
                 OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
             }
@@ -145,12 +144,10 @@ namespace UAS_MES.Make
         private void LoadData()
         {
             //加载表单数据
-            string Err = "";
             sql.Clear();
             sql.Append("select pa_prodcode,pr_cartonmaxw,pa_salecode,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype,pa_makecode,pr_cartonunit,pr_code,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
             sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,0)pa_standardqty,nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW,pa_currentqty from package left join ");
             sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
-            Err = "箱号";
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
             {
@@ -225,31 +222,61 @@ namespace UAS_MES.Make
                     dt = (DataTable)dh.ExecuteSql("select ms_id from makeserial where ms_sncode ='" + sn_code.Text + "' and ms_status=2 order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || dt.Rows.Count > 0)
                     {
-                        if (oMsID == "" || oMsID == "null")
+                        if (oMsID == "" || oMsID == "null" || oMsID == "0")
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
+                            oMsStatus = dt.Rows[0]["ms_status"].ToString();
+                            oMakeCode = dt.Rows[0]["ms_makecode"].ToString();
                         }
-                        if (pa_outboxcode.Text == "")
-                        {
-                            LoadData();
-                            if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
-                                LoadGridData();
-                            else
-                                pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", "", pr_code.Text, User.UserCode);
-                        }
+
+                        //获取序列号信息
                         sql.Clear();
-                        sql.Append("select nvl(ms_iostatus,0) ms_iostatus,ms_outno,ms_salecode,ms_makecode,ms_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,");
-                        sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype  from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
+                        sql.Append("select nvl(ms_iostatus,0) ms_iostatus,pa_salecode,ms_salecode,ms_outno,ms_makecode,ms_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,");
+                        sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                        string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
-                        string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
-                        string ms_salecode = dt.Rows[0]["ms_salecode"].ToString();
+                        string ms_makecode = "";
+                        string ms_prodcode = "";
+                        string ms_iostatus = "";
+                        string ms_outno = "";
+                        string ms_salecode_text = "";
                         if (dt.Rows.Count > 0)
                         {
-                            StandardQTY = int.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
+                            ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                            ms_iostatus = dt.Rows[0]["ms_iostatus"].ToString();
+                            ms_outno = dt.Rows[0]["ms_outno"].ToString();
+                            ms_salecode_text = dt.Rows[0]["ms_salecode"].ToString();
                             BaseUtil.SetFormValue(this.Controls, dt);
                         }
+                        //保证箱内容量不会被重置
+                        if (pa_standardqty.Text != "0" && pa_standardqty.Text != "")
+                        {
+                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                        }
+                        if (pa_outboxcode.Text == "")
+                        {
+                            string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
+                            //序列号存在箱号的情况下获取所有的装箱数据
+                            if (boxcode != "")
+                            {
+                                pa_outboxcode.Text = boxcode;
+                                pa_makecode.Text = "";
+                                LoadGridData();
+                            }
+                            else
+                            {
+                                //如果勾选了自动生成箱号,在封箱或者首次
+                                if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == "" || pa_status.Text == "0"))
+                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
+                            }
+                        }
+                        if (pa_outboxcode.Text == "")
+                        {
+                            OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
+                            return;
+                        }
                         //判断箱内总数必须大于0
                         if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
                         {
@@ -660,7 +687,7 @@ namespace UAS_MES.Make
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "la_url";
             PrintLabel.ValueMember = "la_id";
-       
+
         }
     }
 }

+ 48 - 21
UAS_MES_NEW/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -23,13 +23,12 @@ namespace UAS_MES_NEW.Make
         LogStringBuilder sql = new LogStringBuilder();
         AutoSizeFormClass asc = new AutoSizeFormClass();
         ApplicationClass lbl;
-        Document doc;
         Thread thread;
-        DataTable Dbfind;
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
         string ActWeigh;
+        string oMsStatus = "";
 
         //称量的标准重量
         double Weight;
@@ -61,7 +60,7 @@ namespace UAS_MES_NEW.Make
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl();
             }
-            catch (Exception ex)
+            catch (Exception)
             {
                 OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
             }
@@ -145,12 +144,10 @@ namespace UAS_MES_NEW.Make
         private void LoadData()
         {
             //加载表单数据
-            string Err = "";
             sql.Clear();
             sql.Append("select pa_prodcode,pr_cartonmaxw,pa_salecode,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype,pa_makecode,pr_cartonunit,pr_code,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
             sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,0)pa_standardqty,nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW,pa_currentqty from package left join ");
             sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
-            Err = "箱号";
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
             {
@@ -225,31 +222,61 @@ namespace UAS_MES_NEW.Make
                     dt = (DataTable)dh.ExecuteSql("select ms_id from makeserial where ms_sncode ='" + sn_code.Text + "' and ms_status=2 order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || dt.Rows.Count > 0)
                     {
-                        if (oMsID == "" || oMsID == "null")
+                        if (oMsID == "" || oMsID == "null" || oMsID == "0")
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
+                            oMsStatus = dt.Rows[0]["ms_status"].ToString();
+                            oMakeCode = dt.Rows[0]["ms_makecode"].ToString();
                         }
-                        if (pa_outboxcode.Text == "")
-                        {
-                            LoadData();
-                            if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
-                                LoadGridData();
-                            else
-                                pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", "", pr_code.Text, User.UserCode);
-                        }
+
+                        //获取序列号信息
                         sql.Clear();
-                        sql.Append("select nvl(ms_iostatus,0) ms_iostatus,ms_outno,ms_salecode,ms_makecode,ms_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,");
-                        sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype  from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
+                        sql.Append("select nvl(ms_iostatus,0) ms_iostatus,pa_salecode,ms_salecode,ms_outno,ms_makecode,ms_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,");
+                        sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                        string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
-                        string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
-                        string ms_salecode = dt.Rows[0]["ms_salecode"].ToString();
+                        string ms_makecode = "";
+                        string ms_prodcode = "";
+                        string ms_iostatus = "";
+                        string ms_outno = "";
+                        string ms_salecode_text = "";
                         if (dt.Rows.Count > 0)
                         {
-                            StandardQTY = int.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
+                            ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                            ms_iostatus = dt.Rows[0]["ms_iostatus"].ToString();
+                            ms_outno = dt.Rows[0]["ms_outno"].ToString();
+                            ms_salecode_text = dt.Rows[0]["ms_salecode"].ToString();
                             BaseUtil.SetFormValue(this.Controls, dt);
                         }
+                        //保证箱内容量不会被重置
+                        if (pa_standardqty.Text != "0" && pa_standardqty.Text != "")
+                        {
+                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                        }
+                        if (pa_outboxcode.Text == "")
+                        {
+                            string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
+                            //序列号存在箱号的情况下获取所有的装箱数据
+                            if (boxcode != "")
+                            {
+                                pa_outboxcode.Text = boxcode;
+                                pa_makecode.Text = "";
+                                LoadGridData();
+                            }
+                            else
+                            {
+                                //如果勾选了自动生成箱号,在封箱或者首次
+                                if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == "" || pa_status.Text == "0"))
+                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
+                            }
+                        }
+                        if (pa_outboxcode.Text == "")
+                        {
+                            OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
+                            return;
+                        }
                         //判断箱内总数必须大于0
                         if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
                         {
@@ -660,7 +687,7 @@ namespace UAS_MES_NEW.Make
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "la_url";
             PrintLabel.ValueMember = "la_id";
-       
+
         }
     }
 }