callm 4 дней назад
Родитель
Сommit
a8947ae3c4

+ 150 - 52
UAS_MES_YTDZ/FunctionCode/Special/Special_CancelCollection.Designer.cs

@@ -30,66 +30,107 @@
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Special_CancelCollection));
             this.sn_code_label = new System.Windows.Forms.Label();
-            this.sn_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.pr_detail = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.sn_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.SuspendLayout();
             // 
             // sn_code_label
             // 
             this.sn_code_label.AutoSize = true;
             this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sn_code_label.Location = new System.Drawing.Point(45, 162);
-            this.sn_code_label.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
+            this.sn_code_label.Location = new System.Drawing.Point(68, 401);
+            this.sn_code_label.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
             this.sn_code_label.Name = "sn_code_label";
-            this.sn_code_label.Size = new System.Drawing.Size(72, 27);
+            this.sn_code_label.Size = new System.Drawing.Size(114, 41);
             this.sn_code_label.TabIndex = 104;
             this.sn_code_label.Text = "序列号";
             // 
-            // sn_code
+            // pr_detail
             // 
-            this.sn_code.AllPower = null;
-            this.sn_code.BackColor = System.Drawing.Color.White;
-            this.sn_code.ID = null;
-            this.sn_code.Location = new System.Drawing.Point(151, 164);
-            this.sn_code.Margin = new System.Windows.Forms.Padding(5);
-            this.sn_code.Name = "sn_code";
-            this.sn_code.Power = null;
-            this.sn_code.Size = new System.Drawing.Size(233, 25);
-            this.sn_code.Str = null;
-            this.sn_code.Str1 = null;
-            this.sn_code.Str2 = null;
-            this.sn_code.TabIndex = 140;
+            this.pr_detail.AutoSize = true;
+            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(219, 343);
+            this.pr_detail.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 41);
+            this.pr_detail.TabIndex = 237;
             // 
-            // Confirm
+            // label6
             // 
-            this.Confirm.AllPower = null;
-            this.Confirm.BackColor = System.Drawing.Color.Transparent;
-            this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
-            this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
-            this.Confirm.IsShowBorder = true;
-            this.Confirm.Location = new System.Drawing.Point(440, 161);
-            this.Confirm.Margin = new System.Windows.Forms.Padding(5);
-            this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
-            this.Confirm.Name = "Confirm";
-            this.Confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("Confirm.NormalImage")));
-            this.Confirm.Power = null;
-            this.Confirm.Size = new System.Drawing.Size(80, 31);
-            this.Confirm.TabIndex = 141;
-            this.Confirm.Text = "确认";
-            this.Confirm.UseVisualStyleBackColor = true;
-            this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
+            this.label6.AutoSize = true;
+            this.label6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label6.Location = new System.Drawing.Point(41, 343);
+            this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(146, 41);
+            this.label6.TabIndex = 236;
+            this.label6.Text = "产品名称";
             // 
-            // OperateResult
+            // label2
             // 
-            this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(555, 16);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(5);
-            this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(308, 385);
-            this.OperateResult.TabIndex = 142;
-            this.OperateResult.Text = "";
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(41, 220);
+            this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(146, 41);
+            this.label2.TabIndex = 233;
+            this.label2.Text = "工单编号";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(41, 278);
+            this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(146, 41);
+            this.label5.TabIndex = 232;
+            this.label5.Text = "产品代码";
+            // 
+            // pr_code
+            // 
+            this.pr_code.AllPower = null;
+            this.pr_code.BackColor = System.Drawing.Color.White;
+            this.pr_code.Enabled = false;
+            this.pr_code.ID = null;
+            this.pr_code.Location = new System.Drawing.Point(226, 287);
+            this.pr_code.Name = "pr_code";
+            this.pr_code.Power = null;
+            this.pr_code.Size = new System.Drawing.Size(388, 35);
+            this.pr_code.Str = null;
+            this.pr_code.Str1 = null;
+            this.pr_code.Str2 = null;
+            this.pr_code.TabIndex = 235;
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = "IFALL";
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = "";
+            this.ma_code.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(226, 220);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(6);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = "";
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(409, 46);
+            this.ma_code.TabIndex = 234;
+            this.ma_code.TableName = null;
+            this.ma_code.Tag = "makecode";
+            this.ma_code.TextBoxEnable = true;
             // 
             // Clean
             // 
@@ -98,34 +139,85 @@
             this.Clean.DownImage = ((System.Drawing.Image)(resources.GetObject("Clean.DownImage")));
             this.Clean.Image = ((System.Drawing.Image)(resources.GetObject("Clean.Image")));
             this.Clean.IsShowBorder = true;
-            this.Clean.Location = new System.Drawing.Point(668, 412);
-            this.Clean.Margin = new System.Windows.Forms.Padding(5);
+            this.Clean.Location = new System.Drawing.Point(1002, 659);
+            this.Clean.Margin = new System.Windows.Forms.Padding(8);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
             this.Clean.Power = null;
-            this.Clean.Size = new System.Drawing.Size(80, 31);
+            this.Clean.Size = new System.Drawing.Size(120, 50);
             this.Clean.TabIndex = 143;
             this.Clean.Text = "清除";
             this.Clean.UseVisualStyleBackColor = true;
             this.Clean.Click += new System.EventHandler(this.Clean_Click);
             // 
+            // OperateResult
+            // 
+            this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OperateResult.Location = new System.Drawing.Point(832, 26);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(8);
+            this.OperateResult.Name = "OperateResult";
+            this.OperateResult.Size = new System.Drawing.Size(460, 614);
+            this.OperateResult.TabIndex = 142;
+            this.OperateResult.Text = "";
+            // 
+            // Confirm
+            // 
+            this.Confirm.AllPower = null;
+            this.Confirm.BackColor = System.Drawing.Color.Transparent;
+            this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
+            this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
+            this.Confirm.IsShowBorder = true;
+            this.Confirm.Location = new System.Drawing.Point(319, 518);
+            this.Confirm.Margin = new System.Windows.Forms.Padding(8);
+            this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
+            this.Confirm.Name = "Confirm";
+            this.Confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("Confirm.NormalImage")));
+            this.Confirm.Power = null;
+            this.Confirm.Size = new System.Drawing.Size(120, 50);
+            this.Confirm.TabIndex = 141;
+            this.Confirm.Text = "确认";
+            this.Confirm.UseVisualStyleBackColor = true;
+            this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
+            // 
+            // sn_code
+            // 
+            this.sn_code.AllPower = null;
+            this.sn_code.BackColor = System.Drawing.Color.White;
+            this.sn_code.ID = null;
+            this.sn_code.Location = new System.Drawing.Point(226, 404);
+            this.sn_code.Margin = new System.Windows.Forms.Padding(8);
+            this.sn_code.Name = "sn_code";
+            this.sn_code.Power = null;
+            this.sn_code.Size = new System.Drawing.Size(388, 35);
+            this.sn_code.Str = null;
+            this.sn_code.Str1 = null;
+            this.sn_code.Str2 = null;
+            this.sn_code.TabIndex = 140;
+            // 
             // Special_CancelCollection
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1044, 501);
+            this.ClientSize = new System.Drawing.Size(1566, 802);
+            this.Controls.Add(this.pr_detail);
+            this.Controls.Add(this.label6);
+            this.Controls.Add(this.pr_code);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label5);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.Confirm);
             this.Controls.Add(this.sn_code);
             this.Controls.Add(this.sn_code_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Name = "Special_CancelCollection";
             this.Tag = "Special!CancelCollection";
-            this.Text = "取消采集";
-            this.ResumeLayout(false);
+            this.Text = " ";
+            this.Load += new System.EventHandler(this.Special_CancelCollection_Load);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }
@@ -136,5 +228,11 @@
         private CustomControl.ButtonUtil.NormalButton Confirm;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
         private CustomControl.ButtonUtil.NormalButton Clean;
+        private System.Windows.Forms.Label pr_detail;
+        private System.Windows.Forms.Label label6;
+        private CustomControl.TextBoxWithIcon.EnterTextBox pr_code;
+        private CustomControl.TextBoxWithIcon.SearchTextBox ma_code;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label5;
     }
 }

+ 106 - 61
UAS_MES_YTDZ/FunctionCode/Special/Special_CancelCollection.cs

@@ -24,10 +24,11 @@ namespace UAS_MES_NEW.Special
         private void Confirm_Click(object sender, EventArgs e)
         {
             //获取序列号的途程
-            DataTable dt = (DataTable)dh.ExecuteSql("select ms_id,ms_nextstepcode,ms_currentstepcode,ms_makecode,ms_status,ms_checkno,ms_craftcode,ms_prodcode,ms_stepcode from makeserial where ms_sncode='" + sn_code.Text + "' order by ms_id desc", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_outboxcode,ms_sncode,ms_firstsn,ms_id,ms_nextstepcode,ms_currentstepcode,ms_makecode,ms_status,ms_checkno,ms_craftcode,ms_prodcode,ms_stepcode from makeserial where (ms_sncode='" + sn_code.Text + "'  or ms_imei1='" + sn_code.Text + "' or ms_imei2='" + sn_code.Text + "')and ms_makecode='" + ma_code.Text + "' order by ms_id desc", "select");
             if (dt.Rows.Count > 0)
             {
                 string pr_code = dt.Rows[0]["ms_prodcode"].ToString();
+                string ms_outboxcode = dt.Rows[0]["ms_outboxcode"].ToString();
                 string cr_code = dt.Rows[0]["ms_craftcode"].ToString();
                 string ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                 string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
@@ -36,82 +37,126 @@ namespace UAS_MES_NEW.Special
                 string ms_status = dt.Rows[0]["ms_status"].ToString();
                 string ms_currentstepcode = dt.Rows[0]["ms_currentstepcode"].ToString();
                 string ms_id = dt.Rows[0]["ms_id"].ToString();
+                string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
+                sn_code.Text = dt.Rows[0]["ms_sncode"].ToString();
                 sql.Clear();
                 sql.Append("select cd_stepcode from craft left join craftdetail on cr_id=cd_crid where ");
                 sql.Append("cr_prodcode='" + pr_code + "' and cr_code='" + cr_code + "' order by cd_detno ");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                if (ms_stepcode == dt.Rows[0]["cd_stepcode"].ToString() || (ms_stepcode == "" && ms_nextstepcode == User.CurrentStepCode))
+                //if (ms_stepcode == dt.Rows[0]["cd_stepcode"].ToString() || (ms_stepcode == "" && ms_nextstepcode == User.CurrentStepCode))
+                //{
+                List<string> sqls = new List<string>();
+                if (ms_outboxcode != "")
                 {
-                    List<string> sqls = new List<string>();
-                    //存在不良删除不良记录
-                    if (ms_status == "3")
-                    {
-                        sqls.Add("delete from makebad where mb_sncode='" + sn_code.Text + "' and mb_makecode='" + ms_makecode + "'");
-                        //更新MakeCraftDetail表记录
-                        sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and mcd_stepcode='" + ms_stepcode + "'");
-                    }
-                    else
-                    {
-                        sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and mcd_stepcode='" + ms_stepcode + "'");
-                    }
-                    if (ms_checkno != "")
-                    {
-                        //删除送检明细
-                        sqls.Add("delete from oqcbatchdetail where obd_sncode='" + sn_code.Text + "' and obd_makecode='" + ms_makecode + "'");
-                        //送检数量-1
-                        sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
-                    }
-                    //清除上料数据
-                    dt = (DataTable)dh.ExecuteSql("select cm_barcode,cm_materialtype,cm_makecode,cm_stepcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
-                    if (dt.Rows.Count > 0)
+                    OperateResult.AppendText(">>序列号" + sn_code.Text + "已装箱" + ms_outboxcode + ",不允许取消采集\n", Color.Red, sn_code);
+                    return;
+                }
+                if (ms_status == "3")
+                {
+                    OperateResult.AppendText(">>序列号" + sn_code.Text + "处于不良状态,不允许取消采集\n", Color.Red, sn_code);
+                    return;
+                }
+                //存在不良删除不良记录
+                if (ms_status == "3")
+                {
+                    sqls.Add("delete from makebad where mb_sncode='" + sn_code.Text + "' and mb_makecode='" + ms_makecode + "'");
+                    //更新MakeCraftDetail表记录
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode + "'),mcd_stepcode)>0 ");
+                }
+                else
+                {
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode + "'),mcd_stepcode)>0 ");
+                }
+                if (ms_checkno != "")
+                {
+                    //删除送检明细
+                    sqls.Add("delete from oqcbatchdetail where obd_sncode='" + sn_code.Text + "' and obd_makecode='" + ms_makecode + "'");
+                    //送检数量-1
+                    sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
+                }
+                //清除上料数据
+                dt = (DataTable)dh.ExecuteSql("select cm_barcode,cm_materialtype,cm_makecode,cm_stepcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
+                if (dt.Rows.Count > 0)
+                {
+                    List<string> barcode = new List<string>();
+                    for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        List<string> barcode = new List<string>();
-                        for (int i = 0; i < dt.Rows.Count; i++)
+                        barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
+                        //存在批管控的物料
+                        if (dt.Rows[i]["cm_materialtype"].ToString() == "2")
                         {
-                            barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
-                            //存在批管控的物料
-                            if (dt.Rows[i]["cm_materialtype"].ToString() == "2")
-                            {
-                                string mss_id = dh.getFieldDataByCondition("makesourcestock", "mss_id", "mss_makecode='" + dt.Rows[i]["cm_makecode"].ToString() + "' and mss_barcode='" + dt.Rows[i]["cm_barcode"].ToString() + "' and mss_stepcode='" + dt.Rows[i]["cm_stepcode"].ToString() + "' and mss_validtime is not null and mss_invalidtime is null").ToString();
-                                dh.UpdateByCondition("makesourcestock", "mss_remain=mss_remain+mss_baseqty,mss_useqty=mss_useqty-mss_baseqty", "mss_id='" + mss_id + "'");
-                            }
+                            string mss_id = dh.getFieldDataByCondition("makesourcestock", "mss_id", "mss_makecode='" + dt.Rows[i]["cm_makecode"].ToString() + "' and mss_barcode='" + dt.Rows[i]["cm_barcode"].ToString() + "' and mss_stepcode='" + dt.Rows[i]["cm_stepcode"].ToString() + "' and mss_validtime is not null and mss_invalidtime is null").ToString();
+                            dh.UpdateByCondition("makesourcestock", "mss_remain=mss_remain+mss_baseqty,mss_useqty=mss_useqty-mss_baseqty", "mss_id='" + mss_id + "'");
                         }
-                        sql.Clear();
-                        sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_nextmacode='" + ms_makecode + "'");
-                        dh.BatchInsert(sql.GetString(), new string[] { "barcode" }, barcode.ToArray());
-                        sqls.Add("delete from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
                     }
-                    //删除打印日志
-                    sqls.Add("delete from labelprintlog where lpl_value='" + sn_code.Text + "' and lpl_makecode='" + ms_makecode + "'");
-                    //删除老化记录
-                    sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
-                    //解除前一工单板的使用
-                    sqls.Add("update makeserial set ms_nextmacode='' where ms_sncode='" + sn_code.Text + "' and ms_nextmacode='" + ms_makecode + "'");
-                    //初始化导入数据状态
-                    sqls.Add("update makesnlist set msl_status=0 where msl_sncode='" + sn_code.Text + "' and msl_makecode='" + ms_makecode + "' and msl_type='before'");
-                    ////初始化号段状态
-                    sqls.Add("update MAKESNRULEDETAIL set msd_status=0 where msd_sncode='" + sn_code.Text + "' and msd_makecode='" + ms_makecode + "'  and msd_type='before'");
-                    //清除操作日志
-                    //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
-                    //删除过站记录
-                    //sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
-                    //投入数-1
-                    sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
-                    //删除StepPass
-                    sqls.Add("delete from steppassed where sp_sncode='" + sn_code.Text + "' and sp_makecode='" + ms_makecode + "'");
-                    sqls.Add("delete from makeserial where ms_id='" + ms_id + "'");
-                    dh.ExecuteSQLTran(sqls.ToArray());
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "取消采集", "取消采集成功", sn_code.Text, "");
-                    OperateResult.AppendText(">>序列号" + sn_code.Text + "成功解除绑定\n", Color.Green, sn_code);
+                    sql.Clear();
+                    sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_nextmacode='" + ms_makecode + "'");
+                    dh.BatchInsert(sql.GetString(), new string[] { "barcode" }, barcode.ToArray());
+                    sqls.Add("update  craftmaterial set cm_status=-1 where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
                 }
-                else OperateResult.AppendText(">>序列号" + sn_code.Text + "不处于第一道工序,不允许取消采集\n", Color.Red, sn_code);
+                sqls.Add("delete from sninfo where si_sn='" + sn_code.Text + "'");
+                //sqls.Add("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='" + sn_code.Text + "'");
+                //删除打印日志
+                sqls.Add("delete from labelprintlog where lpl_value='" + sn_code.Text + "' and lpl_makecode='" + ms_makecode + "'");
+                //删除老化记录
+                sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
+                //删除IMIE分配记录
+                sqls.Add("update  makeimeilist set mil_status=0 where mil_sncode='" + sn_code.Text + "' and mil_makecode='" + ms_makecode + "'");
+                //更新MAC使用记录
+                sqls.Add("update  makeaddresslist set mal_status=0 where mal_sncode='" + sn_code.Text + "' and mal_makecode='" + ms_makecode + "'");
+                //解除前一工单板的使用
+                sqls.Add("update makeserial set ms_nextmacode='' where ms_firstsn='" + ms_firstsn + "' and ms_nextmacode='" + ms_makecode + "'");
+                //初始化导入数据状态
+                sqls.Add("update makesnlist set msl_status=0 where msl_sncode='" + sn_code.Text + "' and msl_makecode='" + ms_makecode + "' and msl_type='before'");
+                ////初始化号段状态
+                sqls.Add("update MAKESNRULEDETAIL set msd_status=0 where msd_sncode='" + sn_code.Text + "' and msd_makecode='" + ms_makecode + "'  and msd_type='before'");
+                sqls.Add("delete from  makesnrelation where SN='" + sn_code.Text + "' and makecode='" + ms_makecode + "' ");
+                //清除操作日志
+                //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
+                //删除过站记录
+                //sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
+                //投入数-1
+                sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
+                //删除StepPass
+                sqls.Add("delete from steppassed where sp_sncode='" + ms_firstsn + "' and sp_makecode='" + ms_makecode + "'");
+                sqls.Add("delete from steppassed where sp_sncode='" + sn_code.Text + "' and sp_makecode='" + ms_makecode + "'");
+                sqls.Add("delete from makeserial where ms_id='" + ms_id + "'");
+                dh.ExecuteSQLTran(sqls.ToArray());
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "取消采集", "取消采集成功", sn_code.Text, "");
+                OperateResult.AppendText(">>序列号" + sn_code.Text + "成功解除绑定\n", Color.Green, sn_code);
+                //}
+                //else OperateResult.AppendText(">>序列号" + sn_code.Text + "不处于第一道工序,不允许取消采集\n", Color.Red, sn_code);
             }
-            else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
+            else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在于工单" + ma_code.Text + "\n", Color.Red, sn_code);
         }
 
         private void Clean_Click(object sender, EventArgs e)
         {
             OperateResult.Clear();
         }
+
+        private void Special_CancelCollection_Load(object sender, EventArgs e)
+        {
+            ma_code.TableName = " make left join product on ma_prodcode=pr_code";
+            ma_code.SelectField = "ma_code # 工单编号,pr_code # 产品编号,pr_spec # 型号";
+            ma_code.FormName = Name;
+            ma_code.SetValueField = new string[] { "ma_code" };
+            ma_code.Condition = "ma_statuscode='STARTED'";
+            ma_code.DbChange += pr_code_DbChange;
+        }
+
+        DataTable Dbfind;
+        private void pr_code_DbChange(object sender, EventArgs e)
+        {
+            Dbfind = ma_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+            DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,mil_makecode from makeimeilist where mil_printstatus=-1 group by mil_makecode) on mil_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
+                pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
+            }
+        }
+
     }
 }

+ 10 - 10
UAS_MES_YTDZ/FunctionCode/Special/Special_CancelCollection.resx

@@ -118,7 +118,7 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
-  <data name="Confirm.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Clean.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
@@ -130,7 +130,7 @@
         oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
 </value>
   </data>
-  <data name="Confirm.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Clean.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
         DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
@@ -177,7 +177,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALEwAACxMBAJqcGAAACfBJREFUeF7t3dtuFFcC
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALEAAACxABrSO9dQAACfBJREFUeF7t3dtuFFcC
         heFc5VWQRsrL5T0iRcrDkJAjJOADNjbdbvD5iE9tu302RIq0Z6+ynWkmS6oZrlys/+KT8FJX3f2bcmPa
         X5RSAISyI4AMdgSQwY4AMtgRQAY7AshgRwAZ7Agggx0BZLAjgAx2BJDBjgAy2BFABjsCyGBHABnsCCCD
         HQFksCOADHYEkMGOADLYEUAGOwLIYEcAGewIIIMdAWSwI4AMdgSQwY4AMtgRQAY7AshgRwAZ7Agggx0B
@@ -223,7 +223,7 @@
         2BFABjsCSFC++DdnYZod1cA/NQAAAABJRU5ErkJggg==
 </value>
   </data>
-  <data name="Confirm.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Clean.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
@@ -236,7 +236,7 @@
         gg==
 </value>
   </data>
-  <data name="Confirm.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Clean.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
@@ -249,7 +249,7 @@
         ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
 </value>
   </data>
-  <data name="Clean.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Confirm.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
@@ -261,7 +261,7 @@
         oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
 </value>
   </data>
-  <data name="Clean.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Confirm.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
         DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
@@ -308,7 +308,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALEwAACxMBAJqcGAAACfBJREFUeF7t3dtuFFcC
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALEAAACxABrSO9dQAACfBJREFUeF7t3dtuFFcC
         heFc5VWQRsrL5T0iRcrDkJAjJOADNjbdbvD5iE9tu302RIq0Z6+ynWkmS6oZrlys/+KT8FJX3f2bcmPa
         X5RSAISyI4AMdgSQwY4AMtgRQAY7AshgRwAZ7Agggx0BZLAjgAx2BJDBjgAy2BFABjsCyGBHABnsCCCD
         HQFksCOADHYEkMGOADLYEUAGOwLIYEcAGewIIIMdAWSwI4AMdgSQwY4AMtgRQAY7AshgRwAZ7Agggx0B
@@ -354,7 +354,7 @@
         2BFABjsCSFC++DdnYZod1cA/NQAAAABJRU5ErkJggg==
 </value>
   </data>
-  <data name="Clean.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Confirm.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
@@ -367,7 +367,7 @@
         gg==
 </value>
   </data>
-  <data name="Clean.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="Confirm.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE