Browse Source

限制转换前序列号不能采集

章政 8 years ago
parent
commit
e5f6558e6d

+ 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);