Browse Source

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

Hcsy 7 years ago
parent
commit
442a2ef0aa

+ 16 - 7
UAS-MES/FunctionCode/Make/Make_CartonBoxSNWeigh.cs

@@ -36,6 +36,8 @@ namespace UAS_MES.Make
 
 
         bool LockSn = false;
         bool LockSn = false;
 
 
+        Regex re = new Regex("\\d+.\\d+\\w+");
+
         string PR_CHECKCARTONW = "0";
         string PR_CHECKCARTONW = "0";
         //创建串口实例
         //创建串口实例
         SerialPort serialPort1 = new SerialPort();
         SerialPort serialPort1 = new SerialPort();
@@ -198,15 +200,22 @@ namespace UAS_MES.Make
                         }
                         }
                     }
                     }
                     OperateResult.AppendText(">>箱号" + outboxcode + "称重完成\n", Color.Green);
                     OperateResult.AppendText(">>箱号" + outboxcode + "称重完成\n", Color.Green);
-                    if (LogicHandler.CartonBoxStepPass(ma_code.Text, User.UserSourceCode, outboxcode, User.UserCode, "卡通箱:" + outboxcode + "整箱过站", out ErrorMessage))
-                    {
-                        dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode + "'");
-                        dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode + "'");
-                    }
-                    else
+                    //if (LogicHandler.CartonBoxStepPass(ma_code.Text, User.UserSourceCode, outboxcode, User.UserCode, "卡通箱:" + outboxcode + "整箱过站", out ErrorMessage))
+                    //{
+                    //    dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode + "'");
+                    //    dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode + "'");
+                    //}
+                    //else
+                    //{
+                    //    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                    //}
+                    if (!LogicHandler.OutBoxStepPass(outboxcode, ma_code.Text, User.UserSourceCode, User.UserCode, "卡通箱:" + outboxcode + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
                     {
                     {
                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        return;
                     }
                     }
+                    dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode + "'");
+                    dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode + "'");
                     LoadCheckQTY();
                     LoadCheckQTY();
                     sncode.Clear();
                     sncode.Clear();
                 }
                 }
@@ -227,7 +236,7 @@ namespace UAS_MES.Make
                         {
                         {
                             try
                             try
                             {
                             {
-                                weight.Text = serialPort1.ReadLine();
+                                weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {

+ 11 - 6
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -30,6 +30,8 @@ namespace UAS_MES.Make
 
 
         Document doc;
         Document doc;
 
 
+        Regex re = new Regex("\\d+.\\d+\\w+");
+
         Thread thread;
         Thread thread;
 
 
         string PR_CHECKCARTONW = "0";
         string PR_CHECKCARTONW = "0";
@@ -141,13 +143,13 @@ namespace UAS_MES.Make
                         //称量合格或不合格都记录重量
                         //称量合格或不合格都记录重量
                         if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight && ActualWeight != 0)
                         if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight && ActualWeight != 0)
                         {
                         {
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱"+ outboxcode.Text + "称重", "称量合格:" + weight.Text.Trim(), outboxcode.Text, "");
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量合格:" + weight.Text.Trim(), outboxcode.Text, "");
                             LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
                         }
                         }
                         else
                         else
                         {
                         {
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱"+ outboxcode.Text + "称重", "称量不合格:" + weight.Text.Trim(), outboxcode.Text, "");
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量不合格:" + weight.Text.Trim(), outboxcode.Text, "");
                             LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red, outboxcode);
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red, outboxcode);
                             return;
                             return;
@@ -155,7 +157,7 @@ namespace UAS_MES.Make
                     }
                     }
                     else
                     else
                     {
                     {
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱"+ outboxcode.Text + "称重", "称量完成:" + weight.Text.Trim(), outboxcode.Text, "");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量完成:" + weight.Text.Trim(), outboxcode.Text, "");
                         LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                         LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                     }
                     }
                     if (AutoPrint.Checked)
                     if (AutoPrint.Checked)
@@ -184,7 +186,11 @@ namespace UAS_MES.Make
                     //{
                     //{
                     //    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     //    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     //}
                     //}
-                    LogicHandler.OutBoxStepPass(outboxcode.Text, ma_code.Text, User.UserSourceCode, User.UserCode, "卡通箱:" + outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage);
+                    if (!LogicHandler.OutBoxStepPass(outboxcode.Text, ma_code.Text, User.UserSourceCode, User.UserCode, "卡通箱:" + outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
+                    {
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);
+                        return;
+                    }
                     dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
                     dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
                     dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode.Text + "'");
                     dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode.Text + "'");
                     LoadCheckQTY();
                     LoadCheckQTY();
@@ -207,8 +213,7 @@ namespace UAS_MES.Make
                         {
                         {
                             try
                             try
                             {
                             {
-                                weight.Text = serialPort1.ReadLine();
-                                //weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
+                                weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {

+ 3 - 10
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -38,6 +38,8 @@ namespace UAS_MES.Make
         string LastSncode;
         string LastSncode;
         bool WeightChange = false;
         bool WeightChange = false;
 
 
+        Regex re = new Regex("\\d+.\\d+\\w+");
+
         string ErrorMessage;
         string ErrorMessage;
 
 
         Thread InitPrint;
         Thread InitPrint;
@@ -208,16 +210,7 @@ namespace UAS_MES.Make
                         {
                         {
                             try
                             try
                             {
                             {
-                                weight.Text = serialPort1.ReadLine();
-                                //if (pr_colorboxunit.Text == "kg")
-                                //{
-                                //    weight.Text = (float.Parse(weight.Text) / 1000).ToString();
-                                //    WeightChange = true;
-                                //}
-                                //else
-                                //{
-                                //    WeightChange = false;
-                                //}
+                                weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {

+ 1 - 17
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -241,33 +241,17 @@ namespace UAS_MES.Make
                                 LockMakeCode.Checked = true;
                                 LockMakeCode.Checked = true;
                             }
                             }
                         }
                         }
-                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_craftcode,ms_prodcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
+                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
                         string status = dt.Rows[0]["ms_status"].ToString();
                         string status = dt.Rows[0]["ms_status"].ToString();
                         reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                         reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                         string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                         string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                         string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
                         string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
                         string sncode = dt.Rows[0]["ms_sncode"].ToString();
                         string sncode = dt.Rows[0]["ms_sncode"].ToString();
-                        string craftcode = dt.Rows[0]["ms_craftcode"].ToString();
-                        string prodcode = dt.Rows[0]["ms_prodcode"].ToString();
                         if (sncode != ms_sncode.Text)
                         if (sncode != ms_sncode.Text)
                         {
                         {
                             OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
                             OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
                             return;
                             return;
                         }
                         }
-                        //判断是否是序列号转换工序,如果有导入号段则不允许直接良品过站
-                        if (dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid", "cd_ifsnchange", "cr_code='" + craftcode + "' and cr_prodcode='" + prodcode + "' and cd_stepcode='" + User.CurrentStepCode + "'").ToString() != "0")
-                        {
-                            if (dh.getRowCount("Makeaddresslist", "mal_makecode='" + oMakeCode + "'") > 0)
-                            {
-                                OperateResult.AppendText(">>工单导入烧写信息,不允许直接良品过站\n", Color.Red, ms_sncode);
-                                return;
-                            }
-                            if (dh.getRowCount("makeimeilist", "mil_makecode='" + oMakeCode + "'") > 0)
-                            {
-                                OperateResult.AppendText(">>工单导入烧写信息,不允许直接良品过站\n", Color.Red, ms_sncode);
-                                return;
-                            }
-                        }
                         ifrework = dt.Rows[0]["ms_ifrework"].ToString();
                         ifrework = dt.Rows[0]["ms_ifrework"].ToString();
                         if (GoodProduct.Checked)
                         if (GoodProduct.Checked)
                         {
                         {