Przeglądaj źródła

卡通箱与彩盒称重重量检测增加是否需要检测状态校验

Hcsy 8 lat temu
rodzic
commit
fee1a2a0d0

+ 26 - 18
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -107,7 +107,7 @@ namespace UAS_MES.Make
                 //根据箱号查询表单数据
                 sql.Clear();
                 sql.Append("select pa_totalqty,ma_code,mcd_inqty,ma_qty,ma_qty-mcd_inqty as mcd_waitqty,ma_salecode,pr_detail,pr_cartonunit,pr_code,pr_cartongw,");
-                sql.Append("pr_cartonmaxw,pr_cartonminw from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code ");
+                sql.Append("pr_cartonmaxw,pr_cartonminw,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code ");
                 sql.Append("left join makecraftdetail on mcd_macode=ma_code where pa_outboxcode='" + outboxcode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 //填充Form的值
@@ -117,6 +117,7 @@ namespace UAS_MES.Make
                 {
                     string ErrorMessage;
                     //重量的临时变量
+                    string PR_CHECKCARTONW = dt.Rows[0]["PR_CHECKCARTONW"].ToString();
                     string _weight = dt.Rows[0]["pr_cartongw"].ToString();
                     string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
                     string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
@@ -134,34 +135,41 @@ namespace UAS_MES.Make
                         weight.Text = (float.Parse(weight.Text) / 1000).ToString();
                     }
                     double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
-                    //称量合格或不合格都记录重量
-                    if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
+                    //需要检查称重重量
+                    if (PR_CHECKCARTONW != "0")
                     {
-                        if (AutoPrint.Checked)
+                        //称量合格或不合格都记录重量
+                        if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
                         {
-                            if (PrintLabel.Items.Count > 0)
-                            {
-                                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                                Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
-                            }
-                            else
-                            {
-                                OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Green);
-                            }
+                        
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格", outboxcode.Text, "");
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green,outboxcode);
+                        }
+                        else
+                        {
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不合格", outboxcode.Text, "");
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red,outboxcode);
+                            return;
                         }
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格", outboxcode.Text, "");
-                        OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
                     }
-                    else
+                    if (AutoPrint.Checked)
                     {
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不合格", outboxcode.Text, "");
-                        OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red);
+                        if (PrintLabel.Items.Count > 0)
+                        {
+                            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
+                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+                        }
+                        else
+                        {
+                            OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Green);
+                        }
                     }
                     ListViewItem lsi = new ListViewItem();
                     lsi.SubItems.Add(outboxcode.Text);
                     lsi.SubItems.Add(ActualWeight.ToString() + pr_cartonunit.Text);
                     lsi.SubItems.Add(System.DateTime.Now.ToString());
                     WeighRecord.Items.Add(lsi);
+                    OperateResult.AppendText(">>箱号" + outboxcode.Text + "称重完成\n", Color.Green,outboxcode);
                     dh.ExecuteSql("update package set pa_weight='" + weight.Text + "', pa_printcount= nvl(pa_printcount,0)+1 where pa_outboxcode='" + outboxcode.Text + "'", "update");
                     outboxcode.Clear();
                 }

+ 36 - 24
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -85,7 +85,7 @@ namespace UAS_MES.Make
                 {
                     sql.Clear();
                     sql.Append("select ms_makecode,mcd_inqty,ma_qty,ma_qty-mcd_inqty as mcd_waitqty,ma_salecode,pr_detail,pr_colorboxunit,pr_code,pr_colorboxgw,");
-                    sql.Append("pr_colorboxunit,pr_colorboxmaxw,pr_colorboxminw from makeserial left join make on ms_makecode=ma_code left join product on ");
+                    sql.Append("pr_colorboxunit,pr_colorboxmaxw,pr_colorboxminw,nvl(PR_CHECKCOLORBOXW,'0') PR_CHECKCOLORBOXW from makeserial left join make on ms_makecode=ma_code left join product on ");
                     sql.Append("ms_prodcode=pr_code left join makecraftdetail on ms_makecode=mcd_macode where ms_sncode='" + sncode.Text + "' order by ms_id desc");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count > 0)
@@ -95,6 +95,7 @@ namespace UAS_MES.Make
                         string _maxweight = dt.Rows[0]["pr_colorboxmaxw"].ToString();
                         string _minweight = dt.Rows[0]["pr_colorboxminw"].ToString();
                         string pr_colorunit = dt.Rows[0]["pr_colorboxunit"].ToString();
+                        string PR_CHECKCOLORBOXW = dt.Rows[0]["PR_CHECKCOLORBOXW"].ToString();
                         //赋值重量单位
                         Weight = double.Parse(_weight == "" ? "0" : _weight);
                         MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
@@ -129,33 +130,44 @@ namespace UAS_MES.Make
                                 WeightChange = true;
                             }
                             double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
-                            if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
+                            if (PR_CHECKCOLORBOXW != "0")
                             {
-                                ListViewItem lsi = new ListViewItem();
-                                lsi.SubItems.Add(sncode.Text);
-                                lsi.SubItems.Add(ActualWeight.ToString());
-                                lsi.SubItems.Add(System.DateTime.Now.ToString());
-                                WeighRecord.Items.Add(lsi);
-                                //显示最近的三个称量记录
-                                if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sncode.Text, "彩盒称量", "称量合格", User.UserCode, out ErrorMessage))
+                                if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
                                 {
-                                    //提示正确返回时传递的信息
-                                    if (ErrorMessage.Contains("AFTERSUCCESS"))
-                                        OperateResult.AppendText(">>" + ErrorMessage + "\n");
-                                    LoadCheckQTY();
-                                    OperateResult.AppendText(">>" + sncode.Text + "重量检测检测合格\n", Color.Green);
-                                    //记录送检前的最后一个序列号
-                                    LastSncode = sncode.Text;
-                                    if (AutoPrint.Checked)
-                                    {
-                                        OperateResult.AppendText(">>打印条码号" + sncode.Text + "\n", Color.Green);
-                                        Confirm.PerformClick();
-                                    }
-                                    sncode.Text = "";
+                                    OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测检测合格\n", Color.Green, sncode);
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重", "称量合格", sncode.Text, "");
                                 }
-                                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
+                                else
+                                {
+                                    OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测未通过\n", Color.Red, sncode);
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重", "称量不合格", sncode.Text, "");
+                                    return;
+                                }
+                            }
+                            ListViewItem lsi = new ListViewItem();
+                            lsi.SubItems.Add(sncode.Text);
+                            lsi.SubItems.Add(ActualWeight.ToString());
+                            lsi.SubItems.Add(System.DateTime.Now.ToString());
+                            WeighRecord.Items.Add(lsi);
+                            OperateResult.AppendText(">>彩盒" + sncode.Text + "称重完成\n", Color.Green, sncode);
+                            //显示最近的三个称量记录
+                            if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sncode.Text, "彩盒称量", "称量合格", User.UserCode, out ErrorMessage))
+                            {
+                                //提示正确返回时传递的信息
+                                if (ErrorMessage.Contains("AFTERSUCCESS"))
+                                    OperateResult.AppendText(">>" + ErrorMessage + "\n");
+                                LoadCheckQTY();
+
+                                //记录送检前的最后一个序列号
+                                LastSncode = sncode.Text;
+                                if (AutoPrint.Checked)
+                                {
+                                    OperateResult.AppendText(">>打印条码号" + sncode.Text + "\n", Color.Green);
+                                    Confirm.PerformClick();
+                                }
+                                sncode.Text = "";
                             }
-                            else OperateResult.AppendText(">>" + sncode.Text + "重量检测未通过\n", Color.Red);
+                            else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
                             //称量是否通过都记录重量
                             dh.ExecuteSql("update makeserial set ms_grossw='" + ActualWeight + "' where ms_sncode='" + sncode.Text + "' and ms_makecode='" + ms_makecode.Text + "'", "update");
                             sncode.Clear();

+ 17 - 11
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -29,6 +29,8 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
+
+        string PR_CHECKCARTONW = "";
         //称量的标准重量
         double Weight;
         //最大重量
@@ -147,7 +149,7 @@ namespace UAS_MES.Make
             string Err = "";
             sql.Clear();
             sql.Append("select pa_prodcode,pr_cartonmaxw,pa_makecode,pr_cartonunit,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,pr_outboxinnerqty,pa_currentqty from package left join ");
+            sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,0)pa_standardqty,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");
@@ -157,6 +159,7 @@ namespace UAS_MES.Make
                 string _weight = dt.Rows[0]["pr_cartongw"].ToString();
                 string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
                 string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
+                PR_CHECKCARTONW = dt.Rows[0]["PR_CHECKCARTONW"].ToString();
                 //赋值重量单位
                 Weight = double.Parse(_weight == "" ? "0" : _weight);
                 MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
@@ -341,18 +344,21 @@ namespace UAS_MES.Make
                                         }
                                         if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                         {
-                                            //检查重量合格
-                                            if (float.Parse(weight.Text) > MinWeight && float.Parse(weight.Text) < MaxWeight)
+                                            if (PR_CHECKCARTONW != "0")
                                             {
-                                                dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                                                pa_standardqty.Text = "";
-                                                pa_status.Text = "1";
-                                                OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量合格\n", Color.Green);
-                                                LastSncode = sn_code.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_packageqty=pa_currentqty,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                                    pa_standardqty.Text = "";
+                                                    pa_status.Text = "1";
+                                                    OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量合格\n", Color.Green);
+                                                    LastSncode = sn_code.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();