Browse Source

整箱过站时,箱内产品为非完工状态才执行过站步骤

Hcsy 8 years ago
parent
commit
b678b4a1fc

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

@@ -25,6 +25,7 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMakeCode = "";
         string oMsID = "";
         string oMsID = "";
+        string oMsStatus = "";
         string oOutBoxCode = "";
         string oOutBoxCode = "";
         decimal StandardQTY = 0;
         decimal StandardQTY = 0;
         string LastSncode;
         string LastSncode;
@@ -150,6 +151,7 @@ namespace UAS_MES.Make
                         if (oMsID == "" || oMsID == "null")
                         if (oMsID == "" || oMsID == "null")
                         {
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
                             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();
                         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();
                         //获取序列号信息
                         //获取序列号信息

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

@@ -29,6 +29,7 @@ namespace UAS_MES.Make
         string ErrorMessage = "";
         string ErrorMessage = "";
         string oMakeCode = "";
         string oMakeCode = "";
         string oMsID = "";
         string oMsID = "";
+        string oMsStatus = "";
 
 
         string PR_CHECKCARTONW = "0";
         string PR_CHECKCARTONW = "0";
         //称量的标准重量
         //称量的标准重量
@@ -236,6 +237,7 @@ namespace UAS_MES.Make
                         if (oMsID == "" || oMsID == "null")
                         if (oMsID == "" || oMsID == "null")
                         {
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
                             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();
                         // 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();
                         sql.Clear();
@@ -373,7 +375,7 @@ namespace UAS_MES.Make
                                                 return;
                                                 return;
                                             }
                                             }
                                         }
                                         }
-                                        LogicHandler.CartonBoxStepPass(oMakeCode, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
+                                        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();
                                         LoadCheckQTY();
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
@@ -460,7 +462,7 @@ namespace UAS_MES.Make
                     }
                     }
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
                     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);
                     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();
                     LoadCheckQTY();
                 }
                 }
             }
             }

+ 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)
         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 = "";
             oErrorMessage = "";
             for (int i = 0; i < dt.Rows.Count; i++)
             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;
                 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.Clear();
             sql.Append("insert into weightlog(wl_id,wl_type,wl_scancode,wl_weight,wl_unit,wl_linecode,");
             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.BatchInsert(sql.ToString(), new string[] { "wl_type", "wl_scancode", "wl_weight", "wl_unit", "wl_linecode", "wl_prodcode", "wl_sccode", "wl_inman" }, new string[] { iType } , new string[] { iSN } , new float[] { iWeight }, new string[] { iUnit } , new string[] { iLineCode } , new string[] { iPrCode }, iSource, iUser);
         }
         }