Parcourir la source

1.维修界面序列号默认回流工序为上料工序时,不可修改回流工序
2.返工数据采集界面采集的序列号若采集为不良需完成维修方可采集进返工工单

Hcsy il y a 6 ans
Parent
commit
76665bb796

+ 11 - 2
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -136,12 +136,13 @@ namespace UAS_MES.Make
                                 sql.Clear();
                                 sql.Append("select ma_salecode,nvl(ma_checksacode,0)ma_checksacode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
                                 sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode,NVL(re_autodecom,0)");
-                                sql.Append("re_autodecom,re_code from make left join rework on ma_screcode=re_code where ");
+                                sql.Append("re_autodecom,nvl(re_ifsnok,0)re_ifsnok,re_code from make left join rework on ma_screcode=re_code where ");
                                 sql.Append("ma_code='" + ma_code.Text + "'and ma_kind='返工' and  ma_statuscode='STARTED'");
                                 DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
                                 string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
                                 string re_autodecom = MaInf.Rows[0]["re_autodecom"].ToString();
+                                string re_ifsnok = MaInf.Rows[0]["re_ifsnok"].ToString();
                                 string ma_checksacode = MaInf.Rows[0]["ma_checksacode"].ToString();
                                 string re_code = MaInf.Rows[0]["re_code"].ToString();
                                 int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
@@ -165,8 +166,16 @@ namespace UAS_MES.Make
                                 {
                                     OperateResult.AppendText(">>工单不允许超数投产\n", Color.Red, sn_code);
                                     return;
-                                }
+                                }                           
                                 string Sn = sn_code.Text;
+                                if (re_ifsnok != "0")
+                                {
+                                    if (ms_status == "3"&&dh.CheckExist("makebad","mb_sncode = '"+ sn_code.Text + "'and mb_makecode = '"+ ms_makecode + "' and mb_status = '0'"))
+                                    {
+                                        OperateResult.AppendText(">>序列号:"+ sn_code.Text + "处于不良状态,完成维修后才能归属至返工工单\n", Color.Red, sn_code);
+                                        return;
+                                    }
+                                }
                                 //if (ReWorkAsRelateTSN.Checked)
                                 //{
                                 //    if (ms_beforesn != "")

+ 15 - 16
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs

@@ -28,7 +28,6 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Make_Repair));
             this.label14 = new System.Windows.Forms.Label();
             this.bc_name_label = new System.Windows.Forms.Label();
@@ -43,8 +42,8 @@
             this.GetSNCode_Label = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.BadCodeTree = new System.Windows.Forms.TreeView();
-            this.LocationSource = new System.Windows.Forms.BindingSource(this.components);
-            this.ComponentSource = new System.Windows.Forms.BindingSource(this.components);
+            this.LocationSource = new System.Windows.Forms.BindingSource();
+            this.ComponentSource = new System.Windows.Forms.BindingSource();
             this.bc_code = new System.Windows.Forms.Label();
             this.bg_code = new System.Windows.Forms.Label();
             this.nrg_code = new System.Windows.Forms.Label();
@@ -427,7 +426,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_reworkcheckno.AutoSize = true;
             this.ms_reworkcheckno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_reworkcheckno.Location = new System.Drawing.Point(792, 59);
+            this.ms_reworkcheckno.Location = new System.Drawing.Point(791, 58);
             this.ms_reworkcheckno.Name = "ms_reworkcheckno";
             this.ms_reworkcheckno.Size = new System.Drawing.Size(74, 21);
             this.ms_reworkcheckno.TabIndex = 129;
@@ -440,7 +439,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_makecode_label.AutoSize = true;
             this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(203, 27);
+            this.ms_makecode_label.Location = new System.Drawing.Point(202, 26);
             this.ms_makecode_label.Name = "ms_makecode_label";
             this.ms_makecode_label.Size = new System.Drawing.Size(58, 21);
             this.ms_makecode_label.TabIndex = 37;
@@ -452,7 +451,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_sncode_label.AutoSize = true;
             this.ms_sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode_label.Location = new System.Drawing.Point(15, 26);
+            this.ms_sncode_label.Location = new System.Drawing.Point(14, 25);
             this.ms_sncode_label.Name = "ms_sncode_label";
             this.ms_sncode_label.Size = new System.Drawing.Size(58, 21);
             this.ms_sncode_label.TabIndex = 38;
@@ -464,7 +463,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_checkno.AutoSize = true;
             this.ms_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_checkno.Location = new System.Drawing.Point(790, 27);
+            this.ms_checkno.Location = new System.Drawing.Point(789, 26);
             this.ms_checkno.Name = "ms_checkno";
             this.ms_checkno.Size = new System.Drawing.Size(74, 21);
             this.ms_checkno.TabIndex = 128;
@@ -498,7 +497,7 @@
             this.ms_sncode.AutoSize = true;
             this.ms_sncode.CutLength = null;
             this.ms_sncode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode.Location = new System.Drawing.Point(90, 27);
+            this.ms_sncode.Location = new System.Drawing.Point(89, 26);
             this.ms_sncode.MaximumSize = new System.Drawing.Size(150, 0);
             this.ms_sncode.Name = "ms_sncode";
             this.ms_sncode.Size = new System.Drawing.Size(0, 21);
@@ -529,7 +528,7 @@
             this.nr_code.AutoSize = true;
             this.nr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.nr_code.ForeColor = System.Drawing.Color.Black;
-            this.nr_code.Location = new System.Drawing.Point(840, 222);
+            this.nr_code.Location = new System.Drawing.Point(839, 221);
             this.nr_code.Name = "nr_code";
             this.nr_code.Size = new System.Drawing.Size(0, 21);
             this.nr_code.TabIndex = 125;
@@ -540,7 +539,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.st_rstepcode_label.AutoSize = true;
             this.st_rstepcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.st_rstepcode_label.Location = new System.Drawing.Point(265, 65);
+            this.st_rstepcode_label.Location = new System.Drawing.Point(264, 64);
             this.st_rstepcode_label.Name = "st_rstepcode_label";
             this.st_rstepcode_label.Size = new System.Drawing.Size(74, 21);
             this.st_rstepcode_label.TabIndex = 65;
@@ -552,7 +551,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ma_craftcode_label.AutoSize = true;
             this.ma_craftcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_craftcode_label.Location = new System.Drawing.Point(15, 65);
+            this.ma_craftcode_label.Location = new System.Drawing.Point(14, 64);
             this.ma_craftcode_label.Name = "ma_craftcode_label";
             this.ma_craftcode_label.Size = new System.Drawing.Size(74, 21);
             this.ma_craftcode_label.TabIndex = 66;
@@ -585,7 +584,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(637, 27);
+            this.pr_detail_label.Location = new System.Drawing.Point(636, 26);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(74, 21);
             this.pr_detail_label.TabIndex = 61;
@@ -597,7 +596,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_prodcode_label.AutoSize = true;
             this.ms_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_prodcode_label.Location = new System.Drawing.Point(408, 27);
+            this.ms_prodcode_label.Location = new System.Drawing.Point(407, 26);
             this.ms_prodcode_label.Name = "ms_prodcode_label";
             this.ms_prodcode_label.Size = new System.Drawing.Size(74, 21);
             this.ms_prodcode_label.TabIndex = 62;
@@ -610,7 +609,7 @@
             this.pr_detail.AutoSize = true;
             this.pr_detail.CutLength = null;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(733, 27);
+            this.pr_detail.Location = new System.Drawing.Point(732, 26);
             this.pr_detail.MaximumSize = new System.Drawing.Size(150, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 21);
@@ -623,7 +622,7 @@
             this.ms_prodcode.AutoSize = true;
             this.ms_prodcode.CutLength = null;
             this.ms_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_prodcode.Location = new System.Drawing.Point(504, 27);
+            this.ms_prodcode.Location = new System.Drawing.Point(503, 26);
             this.ms_prodcode.MaximumSize = new System.Drawing.Size(150, 0);
             this.ms_prodcode.Name = "ms_prodcode";
             this.ms_prodcode.Size = new System.Drawing.Size(0, 21);
@@ -637,7 +636,7 @@
             this.ms_makecode.AutoSize = true;
             this.ms_makecode.CutLength = null;
             this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(283, 27);
+            this.ms_makecode.Location = new System.Drawing.Point(282, 26);
             this.ms_makecode.MaximumSize = new System.Drawing.Size(150, 0);
             this.ms_makecode.Name = "ms_makecode";
             this.ms_makecode.Size = new System.Drawing.Size(0, 21);

+ 5 - 0
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -309,6 +309,10 @@ namespace UAS_MES.Make
                                 cdstepcode = ms_stepcode;
                             }
                             cd_stepcode.Text = cdstepcode;
+                            if (dh.getFieldDataByCondition("craftdetail left JOIN craft on cr_id = cd_crid", "nvl(cd_ifinput,0)cd_ifinput", "cr_code=  '" + cr_code.Text + "' and cr_prodcode = '" + ms_prodcode.Text + "' and cd_stepcode = '" + cd_stepcode.Text + "'").ToString() == "-1")
+                                cd_stepcode.Enabled = false;
+                            else
+                                cd_stepcode.Enabled = true;
                             LoadBadInfTree(sender, e);
                         }
                         else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
@@ -572,6 +576,7 @@ namespace UAS_MES.Make
                     LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
                     OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
+                    cd_stepcode.Enabled = true;
                     BaseUtil.CleanForm(this);
                     BadCodeTree.Nodes.Clear();
                     GetSNCode.Clear();

+ 0 - 12
UAS-MES/FunctionCode/Make/Make_Repair.resx

@@ -206,18 +206,6 @@
   <metadata name="DeleteCom.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="mbp_part1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="DeleteCom.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="mbl_loc1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="DeletePos.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <metadata name="mbl_loc1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 37 - 3
UAS_MES_NEW/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -136,12 +136,13 @@ namespace UAS_MES_NEW.Make
                                 sql.Clear();
                                 sql.Append("select ma_salecode,nvl(ma_checksacode,0)ma_checksacode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
                                 sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode,NVL(re_autodecom,0)");
-                                sql.Append("re_autodecom,re_code from make left join rework on ma_screcode=re_code where ");
+                                sql.Append("re_autodecom,nvl(re_ifsnok,0)re_ifsnok,re_code from make left join rework on ma_screcode=re_code where ");
                                 sql.Append("ma_code='" + ma_code.Text + "'and ma_kind='返工' and  ma_statuscode='STARTED'");
                                 DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
                                 string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
                                 string re_autodecom = MaInf.Rows[0]["re_autodecom"].ToString();
+                                string re_ifsnok = MaInf.Rows[0]["re_ifsnok"].ToString();
                                 string ma_checksacode = MaInf.Rows[0]["ma_checksacode"].ToString();
                                 string re_code = MaInf.Rows[0]["re_code"].ToString();
                                 int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
@@ -167,6 +168,14 @@ namespace UAS_MES_NEW.Make
                                     return;
                                 }
                                 string Sn = sn_code.Text;
+                                if (re_ifsnok != "0")
+                                {
+                                    if (ms_status == "3" && dh.CheckExist("makebad", "mb_sncode = '" + sn_code.Text + "'and mb_makecode = '" + ms_makecode + "' and mb_status = '0'"))
+                                    {
+                                        OperateResult.AppendText(">>序列号:" + sn_code.Text + "处于不良状态,完成维修后才能归属至返工工单\n", Color.Red, sn_code);
+                                        return;
+                                    }
+                                }
                                 //if (ReWorkAsRelateTSN.Checked)
                                 //{
                                 //    if (ms_beforesn != "")
@@ -244,10 +253,35 @@ namespace UAS_MES_NEW.Make
                                 SQLS.Add("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'");
                                 if (ms_outboxcode != "")
                                 {
-                                    //更新箱号失效
+                                    string pamothercode = dh.getFieldDataByCondition("package", "pa_mothercode", "pa_outboxcode='" + ms_outboxcode + "'").ToString();
+                                    //如果已装栈板从栈板解除
+                                    if (pamothercode != "")
+                                    {
+                                        sql.Clear();
+                                        sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
+                                        sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
+                                        sql.Append("pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
+                                        SQLS.Add(sql.GetString());
+                                        SQLS.Add("delete from packagedetail where pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
+                                        DataTable dt = dh.getFieldsDatasByCondition("packagedetail left join package on pa_id=pd_paid", new string[] { "nvl(sum(pd_innerqty),0)", "count(1)" }, "pa_outboxcode='" + pamothercode + "'");
+                                        string totalqty = dt.Rows[0][0].ToString();
+                                        string currentqty = dt.Rows[0][1].ToString();
+                                        SQLS.Add("update package set PA_TOTALQTY='" + totalqty + "',pa_packageqty='" + currentqty + "',pa_currentqty='" + currentqty + "' where pa_outboxcode='" + pamothercode + "'");
+                                    }
+                                    //备份和删除卡通箱明细
+                                    sql.Clear();
+                                    sql.Append("insert into packagebackup(pab_id,pab_prodcode,pab_outboxcode,pab_packdate,pab_level,pab_packageqty,pab_totalqty,pab_makecode,pab_status,pab_indate,pab_salecode,pab_printcount,pab_custcode,pab_type,");
+                                    sql.Append("pab_weight,pab_currentqty,pab_standardqty,pab_packtype,pab_checkno,pab_downstatus,pab_sccode,pab_ymd,pab_mothercode,pab_currentstep,pab_nextstep,pab_outno,pab_iostatus,pab_remark) ");
+                                    sql.Append("select pa_id,pa_prodcode,pa_outboxcode,pa_packdate,pa_level,pa_packageqty,pa_totalqty,pa_makecode,pa_status,pa_indate,pa_salecode,pa_printcount,pa_custcode,pa_type,pa_weight,pa_currentqty,");
+                                    sql.Append("pa_standardqty,pa_packtype,pa_checkno,pa_downstatus,pa_sccode,pa_ymd,pa_mothercode,pa_currentstep,pa_nextstep,pa_outno,pa_iostatus,pa_remark from package where pa_outboxcode='" + ms_outboxcode + "'");
+                                    SQLS.Add(sql.GetString());
+                                    SQLS.Add("delete from package where pa_outboxcode='" + ms_outboxcode + "'");
                                     sql.Clear();
-                                    sql.Append("update package set pa_status=-1 where pa_outboxcode='" + ms_outboxcode + "' and pa_status<>-1");
+                                    sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
+                                    sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
+                                    sql.Append("pd_outboxcode='" + ms_outboxcode + "'");
                                     SQLS.Add(sql.GetString());
+                                    SQLS.Add("delete from packagedetail where pd_outboxcode='" + ms_outboxcode + "' ");
                                 }
                                 sql.Clear();
                                 sql.Append("update makebad set mb_makecode='" + ms_makecode + "' where mb_sncode ='" + sn_code.Text + "' and mb_status=0");

+ 5 - 0
UAS_MES_NEW/FunctionCode/Make/Make_Repair.cs

@@ -309,6 +309,10 @@ namespace UAS_MES_NEW.Make
                                 cdstepcode = ms_stepcode;
                             }
                             cd_stepcode.Text = cdstepcode;
+                            if (dh.getFieldDataByCondition("craftdetail left JOIN craft on cr_id = cd_crid", "nvl(cd_ifinput,0)cd_ifinput", "cr_code=  '" + cr_code.Text + "' and cr_prodcode = '" + ms_prodcode.Text + "' and cd_stepcode = '" + cd_stepcode.Text + "'").ToString() == "-1")
+                                cd_stepcode.Enabled = false;
+                            else
+                                cd_stepcode.Enabled = true;
                             LoadBadInfTree(sender, e);
                         }
                         else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
@@ -572,6 +576,7 @@ namespace UAS_MES_NEW.Make
                     LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
                     OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
+                    cd_stepcode.Enabled = true;
                     BaseUtil.CleanForm(this);
                     BadCodeTree.Nodes.Clear();
                     GetSNCode.Clear();