Browse Source

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 years ago
parent
commit
6e8fb78c42

+ 6 - 1
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -259,7 +259,7 @@ namespace UAS_MES.Make
         {
             //将录入框的值给序列号
             sql.Clear();
-            sql.Append("select ma_prodcode,ma_bomversion,ma_qty,ma_code,pr_detail,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
+            sql.Append("select ma_prodcode,ma_craftcode,ma_bomversion,ma_qty,ma_code,pr_detail,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
             sql.Append(",ms_prodcode,ms_makecode,ms_code,ms_stepname  from makeserial left join make on ma_code=ms_makecode ");
             sql.Append("left join product on ms_prodcode=pr_code where ms_sncode='" + code.Text + "' order by ms_id desc");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -273,6 +273,11 @@ namespace UAS_MES.Make
                 nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                 ms_status = dt.Rows[0]["ms_status"].ToString();
                 BaseUtil.SetFormValue(this.Controls, dt);
+                string ifforsn = dh.getFieldDataByCondition("make left join stepbom on ma_prodcode=sb_prodcode left join stepproduct on sb_id=sp_sbid", "nvl(sp_ifforsn,0) sp_ifforsn", "ma_code='" + ma_code.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sb_bomversion='" + ma_bomversion.Text + "' order by sp_detno").ToString();
+                if (ifforsn != "" && ifforsn != "0")
+                    iflastsn.Checked = true;
+                else
+                    iflastsn.Checked = false;
                 LockMakeCode.Checked = true;
                 string oMakeCode = "";
                 string oMsID = "";

+ 25 - 28
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -87,7 +87,7 @@ namespace UAS_MES.Make
                 sql.Clear();
                 sql.Append("select ms_makecode,pa_status,pr_packrule,pr_code,pr_detail,pr_outboxinnerqty,pa_standardqty,pa_packageqty,pa_currentqty,");
                 sql.Append("pa_outboxcode 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+"'");
+                sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                 Err = "序列号";
             }
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -114,31 +114,35 @@ namespace UAS_MES.Make
 
         private void InsertDetail()
         {
-            if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) < int.Parse(pr_outboxinnerqty.Text))
+            if (dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_id='" + oMsID + "'").ToString() == sn_code.Text)
             {
-                sql.Clear();
-                sql.Append("insert into packagedetail(pd_id,pd_paid,pd_outboxcode,pd_innerqty,pd_barcode) ");
-                sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
-                dh.ExecuteSql(sql.GetString(), "insert");
-                dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
-                if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
+                if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) < int.Parse(pr_outboxinnerqty.Text))
                 {
-                    LoadCheckQTY();
-                    OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
-                    //满箱更新状态为1
-                    if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
+                    sql.Clear();
+                    sql.Append("insert into packagedetail(pd_id,pd_paid,pd_outboxcode,pd_innerqty,pd_barcode) ");
+                    sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.ExecuteSql(sql.GetString(), "insert");
+                    dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
+                    if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
                     {
-                        dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                        if (AutoPrint.Checked)
-                            Print_Click(new object(), new EventArgs());
+                        LoadCheckQTY();
+                        OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
+                        //满箱更新状态为1
+                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
+                        {
+                            dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                            if (AutoPrint.Checked)
+                                Print_Click(new object(), new EventArgs());
+                        }
+                        LoadGridData();
+                        sn_code.Clear();
                     }
-                    LoadGridData();
-                    sn_code.Clear();
                 }
+                else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已采集满\n", Color.Red);
             }
-            else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已采集满\n", Color.Red);
+            else OperateResult.AppendText(">>序列号"+sn_code.Text+"不存在\n", Color.Red,sn_code);
         }
 
         private void Print_Click(object sender, EventArgs e)
@@ -268,15 +272,8 @@ namespace UAS_MES.Make
                                     sql.Append("sysdate,'" + oMakeCode + "', ma_prodcode,ma_salecode,ma_custcode,1,'" + pr_packrule.Text + "' from make where ma_code = '" + oMakeCode + "'");
                                     dh.ExecuteSql(sql.GetString(), "insert");
                                     OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集成功!\n", Color.Green);
-                                    InsertDetail();
-                                }
-                                else
-                                {
-                                    if (dh.getRowCount("makeserial", "ms_sncode='" + sn_code.Text + "'") > 0)
-                                        InsertDetail();
-                                    else
-                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
                                 }
+                                InsertDetail();
                             }
                         }
                         //勾选了取消箱号先验证箱号存不存在,存在的话移除掉,重新加载一次数据

+ 27 - 23
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -151,7 +151,7 @@ namespace UAS_MES.Make
                 sql.Clear();
                 sql.Append("select ms_makecode,pr_cartonunit,pa_status,pr_packrule,pr_code,pr_detail,pr_outboxinnerqty,pa_standardqty,pa_packageqty,pa_currentqty,");
                 sql.Append("pa_outboxcode,pr_cartonminw,pr_cartonmaxw,pr_cartongw from makeserial left join product on ms_prodcode=pr_code left ");
-                sql.Append("join packagedetail on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='"+oMsID+"'");
+                sql.Append("join packagedetail on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                 Err = "序列号";
             }
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -189,35 +189,39 @@ namespace UAS_MES.Make
 
         private void InsertDetail()
         {
-            if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) < int.Parse(pr_outboxinnerqty.Text))
+            if (dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_id='" + oMsID + "'").ToString() == sn_code.Text)
             {
-                sql.Clear();
-                sql.Append("insert into packagedetail(pd_id,pd_paid,pd_outboxcode,pd_innerqty,pd_barcode) ");
-                sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
-                dh.ExecuteSql(sql.GetString(), "insert");
-                dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
-                if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
+                if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) < int.Parse(pr_outboxinnerqty.Text))
                 {
-                    LoadCheckQTY();
-                    OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
-                    //满箱更新状态为1
-                    if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
+                    sql.Clear();
+                    sql.Append("insert into packagedetail(pd_id,pd_paid,pd_outboxcode,pd_innerqty,pd_barcode) ");
+                    sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.ExecuteSql(sql.GetString(), "insert");
+                    dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
+                    if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
                     {
-                        //检查重量合格
-                        if (float.Parse(weight.Text) > MinWeight && float.Parse(weight.Text) < MaxWeight)
+                        LoadCheckQTY();
+                        OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
+                        //满箱更新状态为1
+                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
                         {
-                            dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                            if (AutoPrint.Checked)
-                                Print_Click(new object(), new EventArgs());
+                            //检查重量合格
+                            if (float.Parse(weight.Text) > MinWeight && float.Parse(weight.Text) < MaxWeight)
+                            {
+                                dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                if (AutoPrint.Checked)
+                                    Print_Click(new object(), new EventArgs());
+                            }
+                            else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
                         }
-                        else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
+                        LoadGridData();
+                        sn_code.Clear();
                     }
-                    LoadGridData();
-                    sn_code.Clear();
                 }
+                else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已采集满\n", Color.Red);
             }
-            else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已采集满\n", Color.Red);
+            else OperateResult.AppendText("序列号" + sn_code.Text + "不存在", Color.Red, sn_code);
         }
 
         private void Print_Click(object sender, EventArgs e)
@@ -442,7 +446,7 @@ namespace UAS_MES.Make
                 OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
                 LogicHandler.InsertMakeProcess(sn_code.Text, oMakeCode, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
                 //记录操作日志
-                LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
                 ob_checkno.Text = "";
             }
             else OperateResult.AppendText(">>必须封箱才能送检\n", Color.Red);

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs

@@ -294,7 +294,7 @@ namespace UAS_MES.Make
             LogicHandler.GetSerialNumByCaller("MakeDown", out md_code);
             sql.Clear();
             sql.Append("INSERT INTO MAKEDOWN (MD_ID,MD_LINECODE,MD_SCCODE,MD_STEPCODE,");
-            sql.Append(CartonBox.Checked ? "MD_OUTBOXCODE" : "MD_SNCODE" + ",MD_PRODCODE,MD_MACODE, MD_DOWNREASON, MD_CODE,");
+            sql.Append((CartonBox.Checked ? "MD_OUTBOXCODE" : "MD_SNCODE") + ",MD_PRODCODE,MD_MACODE, MD_DOWNREASON, MD_CODE,");
             sql.Append("MD_DOWNDATE,MD_DOWNMAN,MD_STATUS) values (MAKEDOWN_seq.nextval,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
             sql.Append("'" + User.CurrentStepCode + "','" + inputValue.Text + "','" + pr_code.Text + "','" + ms_makecode.Text + "','补打标签','" + md_code + "',sysdate,'" + User.UserCode + "','-1')");
             dh.ExecuteSql(sql.GetString(), "insert");