章政 7 жил өмнө
parent
commit
2a40295e98

+ 16 - 5
UAS_MES_NEW/FunctionCode/Packing/Packing_PackageCollection.cs

@@ -47,7 +47,7 @@ namespace UAS_MES_NEW.Packing
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl();
             }
-            catch (Exception ex)
+            catch (Exception)
             {
                 OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
             }
@@ -190,7 +190,7 @@ namespace UAS_MES_NEW.Packing
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_nextstepcode from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
+                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_nextstepcode,ms_prodcode,ms_craftcode from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
                     {
                         if (oMsID == "" || oMsID == "null" || oMsID == "0")
@@ -199,6 +199,17 @@ namespace UAS_MES_NEW.Packing
                             oMsStatus = dt.Rows[0]["ms_status"].ToString();
                             oMakeCode = dt.Rows[0]["ms_makecode"].ToString();
                         }
+                        if (oMsStatus == "2")
+                        {
+                            string prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                            string craftcode = dt.Rows[0]["ms_craftcode"].ToString();
+                            string craftstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id =cd_crid", "(cd_stepcode)", "cr_prodcode='" + prodcode + "' and cr_code='" + craftcode + "' and cd_stepcode='" + User.CurrentStepCode + "'").ToString();
+                            if (craftstepcode == "")
+                            {
+                                OperateResult.AppendText("工序" + User.CurrentStepCode + "不在途程" + craftcode + "内,不允许采集\n", Color.Red);
+                                return;
+                            }
+                        }
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         {
@@ -396,7 +407,7 @@ namespace UAS_MES_NEW.Packing
                                                     dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
                                                 }
                                             }
-                                            if (dt.Rows[0]["pa_type"] == "3")
+                                            if (dt.Rows[0]["pa_type"].ToString() == "3")
                                             {
                                                 dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
                                             }
@@ -479,7 +490,7 @@ namespace UAS_MES_NEW.Packing
                                                 dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
                                             }
                                         }
-                                        if (dt.Rows[0]["pa_type"] == "3")
+                                        if (dt.Rows[0]["pa_type"].ToString() == "3")
                                         {
                                             dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
                                         }
@@ -920,7 +931,7 @@ namespace UAS_MES_NEW.Packing
                             OperateResult.AppendText(">>箱号" + dt.Rows[0][0].ToString() + "已采集关联信息" + pa_remark.Text + "\n", Color.Red);
                             return;
                         }
-                    }                
+                    }
                     dh.UpdateByCondition("package", "pa_remark='" + pa_remark.Text.ToUpper() + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                     OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "关联信息" + pa_remark.Text + "采集成功\n", Color.Green);
                     pa_remark.Text = "";

+ 15 - 6
UAS_MES_NEW/FunctionCode/Packing/Packing_PackageCollectionWeigh.cs

@@ -67,7 +67,7 @@ namespace UAS_MES_NEW.Packing
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl();
             }
-            catch (Exception ex)
+            catch (Exception)
             {
                 OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
             }
@@ -159,12 +159,10 @@ namespace UAS_MES_NEW.Packing
         private void LoadData()
         {
             //加载表单数据
-            string Err = "";
             sql.Clear();
             sql.Append("select pa_prodcode,pr_cartonmaxw,pa_salecode,pa_remark,pa_makecode,pr_cartonunit,pr_code,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
             sql.Append("pa_status,pr_packrule,pr_detail,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype,pa_packageqty,nvl(pa_standardqty,0)pa_standardqty,nvl(pr_outboxinnerqty,0)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");
             if (dt.Rows.Count > 0)
             {
@@ -262,7 +260,7 @@ namespace UAS_MES_NEW.Packing
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode from makeserial where ms_sncode ='" + sn_code.Text + "'  order by ms_id desc", "select");
+                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_prodcode,ms_craftcode from makeserial where ms_sncode ='" + sn_code.Text + "'  order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
                     {
                         if (oMsID == "" || oMsID == "null" || oMsID == "0")
@@ -271,6 +269,17 @@ namespace UAS_MES_NEW.Packing
                             oMsStatus = dt.Rows[0]["ms_status"].ToString();
                             oMakeCode = dt.Rows[0]["ms_makecode"].ToString();
                         }
+                        if (oMsStatus == "2")
+                        {
+                            string prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                            string craftcode = dt.Rows[0]["ms_craftcode"].ToString();
+                            string craftstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id =cd_crid", "(cd_stepcode)", "cr_prodcode='" + prodcode + "' and cr_code='" + craftcode + "' and cd_stepcode='" + User.CurrentStepCode + "'").ToString();
+                            if (craftstepcode == "")
+                            {
+                                OperateResult.AppendText("工序" + User.CurrentStepCode + "不在途程" + craftcode + "内,不允许采集\n", Color.Red);
+                                return;
+                            }
+                        }
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         {
@@ -422,7 +431,7 @@ namespace UAS_MES_NEW.Packing
                                                     dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
                                                 }
                                             }
-                                            if (dt.Rows[0]["pa_type"] == "3")
+                                            if (dt.Rows[0]["pa_type"].ToString() == "3")
                                             {
                                                 dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
                                             }
@@ -516,7 +525,7 @@ namespace UAS_MES_NEW.Packing
                                                 dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
                                             }
                                         }
-                                        if (dt.Rows[0]["pa_type"] == "3")
+                                        if (dt.Rows[0]["pa_type"].ToString() == "3")
                                         {
                                             dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
                                         }