Browse Source

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

章政 8 years ago
parent
commit
a195c7f8f4

+ 3 - 1
UAS-MES/FunctionCode/Make/Make_BigBoxWeight.cs

@@ -133,6 +133,7 @@ namespace UAS_MES.Make
                     //刷新grid的历史称重信息;
                     recordResult(pa_outboxcode.Text, weight.Text, System.DateTime.Now.ToString());
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱"+ pa_outboxcode.Text + "称重:"+weight.Text, "称重成功", pa_outboxcode.Text, "");
+                    LogicHandler.RecordProdWeight(pa_outboxcode.Text, "BIGBOX", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pa_prodcode.Text, User.UserSourceCode, User.UserName);
                     if (autoprint.Checked == true)
                     {
                         try
@@ -222,7 +223,8 @@ namespace UAS_MES.Make
                         {
                             try
                             {
-                                weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
+                                weight.Text = serialPort1.ReadLine();
+                                //weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
                             }
                             catch (Exception)
                             {

+ 3 - 0
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -136,11 +136,13 @@ namespace UAS_MES.Make
                         if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
                         {
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格:" + weight.Text.Trim(), outboxcode.Text, "");
+                            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);
                         }
                         else
                         {
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不合格:" + weight.Text.Trim(), outboxcode.Text, "");
+                            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);
                             return;
                         }
@@ -148,6 +150,7 @@ namespace UAS_MES.Make
                     else
                     {
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), outboxcode.Text, "");
+                        LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                     }
                     if (AutoPrint.Checked)
                     {

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

@@ -121,16 +121,19 @@ namespace UAS_MES.Make
                                 {
                                     OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测检测合格\n", Color.Green);
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量合格", sncode.Text, "");
+                                    LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                 }
                                 else
                                 {
                                     OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测未通过\n", Color.Red);
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量不合格", sncode.Text, "");
+                                    LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                     return;
                                 }
                             }
                             else {
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量完成", sncode.Text, "");
+                                LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             }
                             ListViewItem lsi = new ListViewItem();
                             lsi.SubItems.Add(sncode.Text);

+ 2 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -25,6 +25,7 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
+        string oMsStatus = "";
         string oOutBoxCode = "";
         decimal StandardQTY = 0;
         string LastSncode;
@@ -150,6 +151,7 @@ namespace UAS_MES.Make
                         if (oMsID == "" || oMsID == "null")
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
+                            oMsStatus = dt.Rows[0]["ms_status"].ToString();
                         }
                         PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code and cr_prodcode = ms_prodcode", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         //获取序列号信息

+ 10 - 2
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -29,6 +29,7 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
+        string oMsStatus = "";
 
         string PR_CHECKCARTONW = "0";
         //称量的标准重量
@@ -236,6 +237,7 @@ namespace UAS_MES.Make
                         if (oMsID == "" || oMsID == "null")
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
+                            oMsStatus = dt.Rows[0]["ms_status"].ToString();
                         }
                         // PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         sql.Clear();
@@ -370,10 +372,14 @@ namespace UAS_MES.Make
                                             if (!(weigh >= MinWeight && weigh <= MaxWeight))
                                             {
                                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
+                                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
+                                                LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                                 return;
                                             }
                                         }
-                                        LogicHandler.CartonBoxStepPass(oMakeCode, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
+                                        LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
+                                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
+                                        LogicHandler.CartonBoxStepPass(pa_makecode.Text, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
                                         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='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         LoadCheckQTY();
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
@@ -455,12 +461,14 @@ namespace UAS_MES.Make
                         {
                             OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量,不能完成工序过站\n", Color.Red);
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
+                            LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             return;
                         }
                     }
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
+                    LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                     LogicHandler.CartonBoxStepPass(pa_makecode.Text, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
-                    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='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_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='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");                   
                     LoadCheckQTY();
                 }
             }

+ 6 - 5
UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

@@ -151,11 +151,12 @@ namespace UAS_MES.Make
                         weightedNum.Text = double.Parse(weightedNum.Text) + 1 + "";
                         recordResult(palletcode.Text, weight.Text.Trim(), System.DateTime.Now.ToString());
                         //插入称重日志表
-                        sql.Clear();
-                        sql.Append("insert into weightlog(wl_id,wl_type,wl_scancode,wl_weight,wl_unit,wl_linecode,");
-                        sql.Append("wl_prodcode,wl_sccode,wl_indate,wl_inman) values (weightlog_seq.nextval,'PALLET',:palletcode,");
-                        sql.Append(":weight,'kg',:linecode,:prodcode,:sccode,sysdate,:inman)");
-                        dh.ExecuteSql(sql.GetString(), "insert", palletcode.Text, weight.Text.Replace("kg", "").Trim(), User.UserLineCode, pa_prodcode.Text, User.UserSourceCode, User.UserName);
+                        //sql.Clear();
+                        //sql.Append("insert into weightlog(wl_id,wl_type,wl_scancode,wl_weight,wl_unit,wl_linecode,");
+                        //sql.Append("wl_prodcode,wl_sccode,wl_indate,wl_inman) values (weightlog_seq.nextval,'PALLET',:palletcode,");
+                        //sql.Append(":weight,'kg',:linecode,:prodcode,:sccode,sysdate,:inman)");
+                        //dh.ExecuteSql(sql.GetString(), "insert", palletcode.Text, weight.Text.Replace("kg", "").Trim(), User.UserLineCode, pa_prodcode.Text, User.UserSourceCode, User.UserName);
+                        LogicHandler.RecordProdWeight(palletcode.Text, "PALLET", float.Parse(weight.Text.Replace("kg", "").Trim()), "kg", User.UserLineCode, pa_prodcode.Text, User.UserSourceCode, User.UserName);
                         //如果用户勾选了自动打印,调用打印, 打印成功,消息提示栏显示“打印成功”,“请输入栈板号”
                         if (autoPrint.Checked == true)
                         {

+ 25 - 20
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -29,6 +29,8 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMsID = "";
+        string ActWeigh;
+
         //称量的标准重量
         double Weight;
         //最大重量
@@ -111,9 +113,8 @@ namespace UAS_MES.Make
                         {
                             try
                             {
-                                weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
-                                if (pr_cartonunit.Text == "kg")
-                                    weight.Text = (double.Parse(weight.Text == "" ? "0" : weight.Text) / 1000).ToString();
+                                weight.Text = serialPort1.ReadLine();
+                                ActWeigh = weight.Text.Replace("kg", "").Trim();
                             }
                             catch (Exception)
                             {
@@ -277,25 +278,29 @@ namespace UAS_MES.Make
                                 }
                                 if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "特殊", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                                 {
-                                    if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
+                                    //if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
+                                    //{
+                                    if (ErrorMessage.Contains("AFTERSUCCESS"))
+                                        OperateResult.AppendText(">>" + ErrorMessage + "\n");
+                                    LoadCheckQTY();
+                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
+                                    LastSncode = sn_code.Text;
+                                    //满箱更新状态为1
+                                    if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                     {
-                                        if (ErrorMessage.Contains("AFTERSUCCESS"))
-                                            OperateResult.AppendText(">>" + ErrorMessage + "\n");
-                                        LoadCheckQTY();
-                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
-                                        LastSncode = 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_packageqty=pa_currentqty,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                                            if (AutoPrint.Checked)
-                                                Print_Click(new object(), new EventArgs());
-                                        }
-                                        LoadData();
-                                        LoadGridData();
-                                        sn_code.Clear();
+                                        float weigh = float.Parse(ActWeigh);
+                                        dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                        LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
+                                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
+                                        LogicHandler.CartonBoxStepPass(ms_makecode.Text, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
+                                        if (AutoPrint.Checked)
+                                            Print_Click(new object(), new EventArgs());
                                     }
-                                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                                    LoadData();
+                                    LoadGridData();
+                                    sn_code.Clear();
+                                    //}
+                                    //else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                 }
                                 else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                             }

+ 12 - 8
UAS-MES/PublicMethod/LogicHandler.cs

@@ -519,13 +519,17 @@ namespace UAS_MES.PublicMethod
 
         public static void CartonBoxStepPass(string iMakeCode, string iSourceCode, string iCartonBox, string iUserCode, string iResult, out string oErrorMessage)
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select pd_makecode,pd_barcode from packagedetail where pd_outboxcode='" + iCartonBox + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_status,V_BARCODE,V_MAKECODE from mes_package_view left join makeserial on V_MAKECODE=ms_makecode and  v_barcode = ms_sncode where V_OUTBOXCODE='" + iCartonBox + "'", "select");
             oErrorMessage = "";
             for (int i = 0; i < dt.Rows.Count; i++)
             {
-                string sn = dt.Rows[i]["pd_barcode"].ToString();
-                string makecode = dt.Rows[i]["pd_makecode"].ToString();
-                CS_SetResult(makecode, iSourceCode, sn, iUserCode, iResult, out oErrorMessage);
+                string ms_status = dt.Rows[i]["ms_status"].ToString();
+                string sn = dt.Rows[i]["V_BARCODE"].ToString();
+                string makecode = dt.Rows[i]["V_MAKECODE"].ToString();
+                if (ms_status != "2")
+                {
+                    CS_SetResult(makecode, iSourceCode, sn, iUserCode, iResult, out oErrorMessage);
+                }
             }
         }
 
@@ -1311,14 +1315,14 @@ namespace UAS_MES.PublicMethod
                 return false;
         }
 
-        public static void RecordProdWeight(string iSN, string iType, string iScanValue, float iWeight, string iUnit, string iLineCode, string iPrCode, string iSource, string iUser)
+        public static void RecordProdWeight(string iSN, string iType,float iWeight, string iUnit, string iLineCode, string iPrCode, string iSource, string iUser)
         {
             //记录重量
             sql.Clear();
             sql.Append("insert into weightlog(wl_id,wl_type,wl_scancode,wl_weight,wl_unit,wl_linecode,");
-            sql.Append("wl_prodcode,wl_sccode,wl_indate,wl_inman) values (weightlog_seq.nextval,:type,:palletcode,");
-            sql.Append(":weight,:unit,:linecode,:prodcode,:sccode,sysdate,:inman)");
-            dh.ExecuteSql(sql.ToString(), "insert", iType,iScanValue, iWeight,iUnit, User.UserLineCode, iPrCode, iSource, iUser);
+            sql.Append("wl_prodcode,wl_sccode,wl_indate,wl_inman) values (weightlog_seq.nextval,:wl_type,:wl_scancode,");
+            sql.Append(":wl_weight,:wl_unit,:wl_linecode,:wl_prodcode,:wl_sccode,sysdate,:wl_inman)");
+            dh.ExecuteSql(sql.ToString(), "insert", iType  , iSN  , iWeight ,iUnit ,iLineCode  , iPrCode , iSource , iUser);
         }