Browse Source

拆解处理修改

Hcsy 8 years ago
parent
commit
053a3f8849

+ 2 - 0
UAS-MES/FunctionCode/Make/Make_Decompose.Designer.cs

@@ -551,6 +551,7 @@
             // 
             this.pr_name.Font = new System.Drawing.Font("微软雅黑", 10.5F);
             this.pr_name.Location = new System.Drawing.Point(400, 66);
+            this.pr_name.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.pr_name.Name = "pr_name";
             this.pr_name.Size = new System.Drawing.Size(161, 25);
             this.pr_name.TabIndex = 195;
@@ -638,6 +639,7 @@
             // 
             this.mb_badcode.HeaderText = "不良代码";
             this.mb_badcode.Name = "mb_badcode";
+            this.mb_badcode.ReadOnly = true;
             this.mb_badcode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
             this.mb_badcode.Width = 80;
             // 

+ 15 - 7
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -177,6 +177,11 @@ namespace UAS_MES.Make
                         OperateResult.AppendText("第" + (i + 1) + "行没有采集不良代码或新批号\n", Color.Red);
                         return;
                     }
+                    if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && nochange.Checked && (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value == null))
+                    {
+                        OperateResult.AppendText("第" + (i + 1) + "行没有采集不良代码\n", Color.Red);
+                        return;
+                    }
                 }
             }
 
@@ -186,14 +191,17 @@ namespace UAS_MES.Make
                 {
                     if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true)
                     {
-                        String[] badcodetol = LabelDataGridView.Rows[i].Cells["mb_badcode"].Value.ToString().Split('|');
-                        bgcode = new string[badcodetol.Length - 1];
-                        bccode = new string[badcodetol.Length - 1];
-                        for (int h = 0; h < badcodetol.Length - 1; h++)
+                        if (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value != null)
                         {
-                            bgcode[h] = badcodetol[h].Split(':')[0].Trim();
-                            bccode[h] = badcodetol[h].Split(':')[1].Trim();
-                        }
+                            String[] badcodetol = LabelDataGridView.Rows[i].Cells["mb_badcode"].Value.ToString().Split('|');
+                            bgcode = new string[badcodetol.Length - 1];
+                            bccode = new string[badcodetol.Length - 1];
+                            for (int h = 0; h < badcodetol.Length - 1; h++)
+                            {
+                                bgcode[h] = badcodetol[h].Split(':')[0].Trim();
+                                bccode[h] = badcodetol[h].Split(':')[1].Trim();
+                            }
+                        }  
                         if (change.Checked)
                         {
                             dt1 = new DataTable();

+ 0 - 2
UAS-MES/FunctionCode/Packing/Packing_CartonTransfer.cs

@@ -187,7 +187,6 @@ namespace UAS_MES.Packing
                                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "卡通箱转移,生成目标箱号" + pa_outboxcode.Text + "", sn_code.Text, "");
                                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
                                                     OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
-                                                    movepack.Focus();
                                                     pa_outboxcode_KeyDown(sender, e);
                                                 }
                                             }
@@ -281,7 +280,6 @@ namespace UAS_MES.Packing
                                         dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_id = '" + ms_id + "'");
                                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
                                         OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
-                                        movepack.Focus();
                                         pa_outboxcode_KeyDown(sender, e);
                                         sql.Clear();
                                         sql.Append("select pa_id,pa_checkno,PA_CURRENTQTY pa_qty,PA_PACKTYPE,nvl(PA_DOWNSTATUS,0) PA_DOWNSTATUS,pa_prodcode  pa_macode,pa_salecode,pa_level,pa_custcode,pa_type,pa_packtype,pa_mothercode from package where pa_outboxcode='" + ms_outboxcode + "'");

+ 65 - 46
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.Designer.cs

@@ -46,20 +46,21 @@
             this.bigboxBtn = new System.Windows.Forms.RadioButton();
             this.input = new System.Windows.Forms.TextBox();
             this.pi_id = new System.Windows.Forms.Label();
+            this.pi_type = new System.Windows.Forms.Label();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
-            this.customCheckBox2 = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
+            this.pi_type_check = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.cancel = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
             this.InOutDetailDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
+            this.ConfirmOut = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.NewProdInOut = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.ProdDetail = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.pi_inoutno = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.pim_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pim_mac = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pim_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ConfirmOut = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.NewProdInOut = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.ProdDetail = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.pi_inoutno = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).BeginInit();
             this.SuspendLayout();
@@ -243,6 +244,15 @@
             this.pi_id.Size = new System.Drawing.Size(0, 21);
             this.pi_id.TabIndex = 229;
             // 
+            // pi_type
+            // 
+            this.pi_type.AutoSize = true;
+            this.pi_type.Location = new System.Drawing.Point(235, 48);
+            this.pi_type.Name = "pi_type";
+            this.pi_type.Size = new System.Drawing.Size(0, 12);
+            this.pi_type.TabIndex = 230;
+            this.pi_type.Visible = false;
+            // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -252,18 +262,19 @@
             this.OperateResult.TabIndex = 228;
             this.OperateResult.Text = "";
             // 
-            // customCheckBox2
+            // pi_type_check
             // 
-            this.customCheckBox2.AutoSize = true;
-            this.customCheckBox2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.customCheckBox2.Location = new System.Drawing.Point(453, 427);
-            this.customCheckBox2.Margin = new System.Windows.Forms.Padding(2);
-            this.customCheckBox2.Name = "customCheckBox2";
-            this.customCheckBox2.Power = null;
-            this.customCheckBox2.Size = new System.Drawing.Size(109, 25);
-            this.customCheckBox2.TabIndex = 225;
-            this.customCheckBox2.Text = "按订单出货";
-            this.customCheckBox2.UseVisualStyleBackColor = true;
+            this.pi_type_check.AutoSize = true;
+            this.pi_type_check.Enabled = false;
+            this.pi_type_check.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pi_type_check.Location = new System.Drawing.Point(453, 427);
+            this.pi_type_check.Margin = new System.Windows.Forms.Padding(2);
+            this.pi_type_check.Name = "pi_type_check";
+            this.pi_type_check.Power = null;
+            this.pi_type_check.Size = new System.Drawing.Size(109, 25);
+            this.pi_type_check.TabIndex = 225;
+            this.pi_type_check.Text = "按订单出货";
+            this.pi_type_check.UseVisualStyleBackColor = true;
             // 
             // Clean
             // 
@@ -283,6 +294,7 @@
             this.Clean.TabIndex = 224;
             this.Clean.Text = "清除明细";
             this.Clean.UseVisualStyleBackColor = false;
+            this.Clean.Click += new System.EventHandler(this.Clean_Click);
             // 
             // cancel
             // 
@@ -314,33 +326,6 @@
             this.InOutDetailDGV.Size = new System.Drawing.Size(544, 357);
             this.InOutDetailDGV.TabIndex = 218;
             // 
-            // pim_outboxcode
-            // 
-            this.pim_outboxcode.HeaderText = "栈板/箱号";
-            this.pim_outboxcode.MinimumWidth = 120;
-            this.pim_outboxcode.Name = "pim_outboxcode";
-            this.pim_outboxcode.Width = 120;
-            // 
-            // pim_mac
-            // 
-            this.pim_mac.HeaderText = "SN号";
-            this.pim_mac.Name = "pim_mac";
-            // 
-            // pim_prodcode
-            // 
-            this.pim_prodcode.HeaderText = "产品代码";
-            this.pim_prodcode.Name = "pim_prodcode";
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.HeaderText = "名称";
-            this.pr_detail.Name = "pr_detail";
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.HeaderText = "规格";
-            this.pr_spec.Name = "pr_spec";
-            // 
             // ConfirmOut
             // 
             this.ConfirmOut.AllPower = null;
@@ -420,14 +405,47 @@
             this.pi_inoutno.TableName = null;
             this.pi_inoutno.TextBoxEnable = false;
             // 
+            // pim_outboxcode
+            // 
+            this.pim_outboxcode.DataPropertyName = "pim_outboxcode";
+            this.pim_outboxcode.HeaderText = "栈板/箱号";
+            this.pim_outboxcode.MinimumWidth = 120;
+            this.pim_outboxcode.Name = "pim_outboxcode";
+            this.pim_outboxcode.Width = 120;
+            // 
+            // pim_mac
+            // 
+            this.pim_mac.DataPropertyName = "pim_mac";
+            this.pim_mac.HeaderText = "SN号";
+            this.pim_mac.Name = "pim_mac";
+            // 
+            // pim_prodcode
+            // 
+            this.pim_prodcode.DataPropertyName = "pim_prodcode";
+            this.pim_prodcode.HeaderText = "产品代码";
+            this.pim_prodcode.Name = "pim_prodcode";
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.DataPropertyName = "pr_detail";
+            this.pr_detail.HeaderText = "名称";
+            this.pr_detail.Name = "pr_detail";
+            // 
+            // pr_spec
+            // 
+            this.pr_spec.DataPropertyName = "pr_spec";
+            this.pr_spec.HeaderText = "规格";
+            this.pr_spec.Name = "pr_spec";
+            // 
             // Warehouse_FinishedProductOut
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(740, 518);
+            this.Controls.Add(this.pi_type);
             this.Controls.Add(this.pi_id);
             this.Controls.Add(this.OperateResult);
-            this.Controls.Add(this.customCheckBox2);
+            this.Controls.Add(this.pi_type_check);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.cancel);
             this.Controls.Add(this.input);
@@ -483,13 +501,14 @@
         private System.Windows.Forms.TextBox input;
         private CustomControl.CustomCheckBox.CustomCheckBox cancel;
         private CustomControl.ButtonUtil.NormalButton Clean;
-        private CustomControl.CustomCheckBox.CustomCheckBox customCheckBox2;
+        private CustomControl.CustomCheckBox.CustomCheckBox pi_type_check;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
+        private System.Windows.Forms.Label pi_id;
+        private System.Windows.Forms.Label pi_type;
         private System.Windows.Forms.DataGridViewTextBoxColumn pim_outboxcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pim_mac;
         private System.Windows.Forms.DataGridViewTextBoxColumn pim_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
-        private System.Windows.Forms.Label pi_id;
     }
 }

+ 107 - 14
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

@@ -45,7 +45,7 @@ namespace UAS_MES.Warehouse
             pi_inoutno.TableName = "prodinout";
             pi_inoutno.DBTitle = "出货单查询";
             pi_inoutno.SelectField = "pi_id # ID,pi_title  # 客户名称,pi_inoutno # 出货单号,pi_type # 出货类型";
-            pi_inoutno.SetValueField = new string[] { "pi_title", "pi_inoutno", "pi_id" };
+            pi_inoutno.SetValueField = new string[] { "pi_title", "pi_inoutno", "pi_id", "pi_type" };
             pi_inoutno.FormName = Name;
             pi_inoutno.Condition = "pi_pdastatus<>'已出库' and pi_class='出货单'";
             pi_inoutno.DbChange += Pi_inoutno_DbChange;
@@ -71,7 +71,7 @@ namespace UAS_MES.Warehouse
             sql.Clear();
             sql.Append("select pi_id,pi_title,pi_inoutno,pi_type from prodinout where pi_inoutno = '" + pi_inoutno.Text + "'");
             dtpi = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            if (dt.Rows.Count > 0)
+            if (dtpi.Rows.Count > 0)
             {
                 BaseUtil.SetFormValue(this.Controls, dtpi);
             }
@@ -85,6 +85,13 @@ namespace UAS_MES.Warehouse
                 BaseUtil.SetFormValue(this.Controls, dtform);
                 ungetqty.Text = (int.Parse(dtform.Rows[0]["outqty"].ToString()) - int.Parse(dtform.Rows[0]["getqty"].ToString())).ToString();
             }
+            if (pi_type.Text == "按订单出货")
+            {
+                pi_type_check.Checked = true;
+            }
+            else {
+                pi_type_check.Checked = false;
+            }
         }
 
         /// <summary>
@@ -122,14 +129,53 @@ namespace UAS_MES.Warehouse
 
         private void ProdDetail_Click(object sender, EventArgs e)
         {
-            Warehouse_ProdDetail newpd = new Warehouse_ProdDetail();
+            Warehouse_ProdDetail newpd = new Warehouse_ProdDetail(pi_inoutno.Text,pi_id.Text);
             BaseUtil.SetFormCenter(newpd);
             newpd.ShowDialog();
         }
 
         private void ConfirmOut_Click(object sender, EventArgs e)
         {
-
+            String dialog = MessageBox.Show("是否确认出货", "提示", MessageBoxButtons.OKCancel).ToString();
+            if (dialog != "OK")
+            {
+                OperateResult.AppendText("取消确认出货\n", Color.Black);
+                return;
+            }
+            else
+            {
+                sql.Clear();
+                sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id,pi_type from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                if (dt.Rows.Count > 0)
+                {
+                    if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
+                    {
+                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,无需重复确认\n", Color.Red);
+                        return;
+                    }
+                    else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
+                    {
+                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法确认出货\n", Color.Red);
+                        return;
+                    }
+                    else if (dt.Rows[0]["pi_type"].ToString() == "按订单出货" && dt.Rows[0]["pi_pdastatus"].ToString() == "备货中")
+                    {
+                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "未完成备货,无法确认出货\n", Color.Red);
+                        return;
+                    }
+                    else {
+                        dh.ExecuteSql("update package set pa_status=2 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'", "update");
+                        dh.ExecuteSql("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
+                        dh.ExecuteSql("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')", "insert");
+                    }
+                }
+                else
+                {
+                    OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
+                    return;
+                }
+            }
         }
 
         private void input_KeyDown(object sender, KeyEventArgs e)
@@ -168,7 +214,7 @@ namespace UAS_MES.Warehouse
                         else if (bigboxBtn.Checked)
                         {
                             sql.Clear();
-                            sql.Append("select pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_outno, pa_mothercode from package where pa_outboxcode='" + input.Text + "' and pa_type=(1,2)");
+                            sql.Append("select pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_outno, pa_mothercode from package where pa_outboxcode='" + input.Text + "' and pa_type in(1,2)");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows.Count > 0)
                             {
@@ -217,12 +263,12 @@ namespace UAS_MES.Warehouse
                                     OperateResult.AppendText("序列号" + input.Text + "处于下地状态,不允许出货\n", Color.Red, input);
                                     return;
                                 }
-                                if (dtms.Rows[0]["ms_iostatus"].ToString() != "1")
+                                if (dtms.Rows[0]["ms_iostatus"].ToString() != "0")
                                 {
                                     OperateResult.AppendText("序列号" + input.Text + "已经被出货单:" + dh.getFieldDataByCondition("makeserial left JOIN prodiomac  on pim_mac=ms_sncode", "pim_inoutno", "ms_id='" + ms_id + "' order by pim_indate desc").ToString() + "出货\n", Color.Red, input);
                                     return;
                                 }
-                                if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
+                                if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
                                 {
                                     sql.Clear();
                                     sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode='" + dtms.Rows[0]["ms_prodcode"].ToString() + "'),0)ungetqty from");
@@ -246,25 +292,31 @@ namespace UAS_MES.Warehouse
                                 }
                             }
                         }
-                        LoadFormData();
-                        LoadGridData();
-                        if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
+                        else {
+                            OperateResult.AppendText("未选择录入数据类型\n", Color.Red,input);
+                            return;
+                        }
+                        if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
                         {
                             if (int.Parse(dtform.Rows[0]["outqty"].ToString()) > int.Parse(dtform.Rows[0]["getqty"].ToString()))
                             {
                                 dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
+                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
                             }
                             else
                             {
                                 dh.UpdateByCondition("prodinout", "pi_pdastatus='已备货'", "pi_inoutno='" + pi_inoutno.Text + "'");
-                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black);
+                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black,input);
                                 return;
                             }
                         }
                         else if (dta.Rows[0]["pi_type"].ToString() == "自由出货")
                         {
                             dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
                         }
+                        LoadFormData();
+                        LoadGridData();
                     }
                     else
                     {
@@ -287,6 +339,7 @@ namespace UAS_MES.Warehouse
                             {
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET'", "delete");
                                 dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='"+input.Text+ "'");
+                                OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black,input);
                             }
                             else {
                                 OperateResult.AppendText("栈板号" + input.Text + "不在备货数据中\n", Color.Red,input);
@@ -302,6 +355,7 @@ namespace UAS_MES.Warehouse
                             {
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='BOX'", "delete");
                                 dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
+                                OperateResult.AppendText("箱号" + input.Text + "取消备货成功\n", Color.Black, input);
                             }
                             else
                             {
@@ -325,6 +379,7 @@ namespace UAS_MES.Warehouse
                                 {
                                     dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_mac='" + input.Text + "'", "delete");
                                     dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_sncode='"+input.Text+"' and ms_prodcode='"+ dt.Rows[0]["pim_prodcode"].ToString() + "' and ms_iostatus=2");
+                                    OperateResult.AppendText("序列号" + input.Text + "取消备货成功\n", Color.Black, input);
                                 }
                             }
                             else
@@ -333,6 +388,13 @@ namespace UAS_MES.Warehouse
                                 return;
                             }
                         }
+                        else
+                        {
+                            OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
+                            return;
+                        }
+                        LoadFormData();
+                        LoadGridData();
                     }
                 }
                 else
@@ -347,8 +409,8 @@ namespace UAS_MES.Warehouse
         {
             //更新操作
             sql.Clear();
-            sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman)");
-            sql.Append("values(prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "','" + dtms.Rows[0]["ms_prodcode"].ToString() + "','" + input.Text + "',sysdate,'" + User.UserCode + "')");
+            sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type)");
+            sql.Append("values(prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "','" + dtms.Rows[0]["ms_prodcode"].ToString() + "','" + input.Text + "',sysdate,'" + User.UserCode + "',' ')");
             dh.ExecuteSql(sql.GetString(), "insert");
             dh.UpdateByCondition("makeserial", "ms_iostatus=2", " ms_id='" + ms_id + "'");
         }
@@ -382,7 +444,7 @@ namespace UAS_MES.Warehouse
                 OperateResult.AppendText(type + input.Text + "内序列号未完工,序列号:" + dt.Rows[0]["data"].ToString() + "\n", Color.Red, input);
                 return;
             }
-            if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
+            if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
             {
                 sql.Clear();
                 sql.Append("select ms_prodcode,ms_salecode,cn  from (select ms_prodcode,ms_salecode,count(1)cn from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode  where v_outboxcode='" + input.Text + "' ");
@@ -430,5 +492,36 @@ namespace UAS_MES.Warehouse
             }
             return true;
         }
+
+        private void Clean_Click(object sender, EventArgs e)
+        {
+            sql.Clear();
+            sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
+            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
+                {
+                    OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,不允许取消明细\n", Color.Red);
+                    return;
+                }
+                else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
+                {
+                    OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法取消明细\n", Color.Red);
+                    return;
+                }
+                dh.ExecuteSql("update makeserial set ms_iostatus=1 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + " ' and pim_mac=ms_sncode and pim_prodcode=ms_prodcode and nvl(pim_outboxcode,' ')=' ') and ms_status=2", "update");
+                dh.ExecuteSql("update package set pa_outno = '' where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'", "update");
+                dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "'", "delete");
+                dh.ExecuteSql("update prodinout set pi_pdastatus='未备货' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
+                dh.ExecuteSql("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName+ "','清除全部备货明细',''清除备货明细成功'','ProdInOut!Sale|pi_id=" + pi_id.Text+"')", "insert");
+            }
+            else {
+                OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
+                return;
+            }
+            LoadFormData();
+            LoadGridData();
+        }
     }
 }

+ 33 - 29
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.Designer.cs

@@ -30,11 +30,11 @@
         {
             this.headBar1 = new UAS_MES.CustomControl.HeadBar();
             this.InOutDetailDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.pim_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pim_mac = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pim_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.outqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.getqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ungetqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -53,11 +53,11 @@
             this.InOutDetailDGV.AllowUserToAddRows = false;
             this.InOutDetailDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.InOutDetailDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.pim_outboxcode,
-            this.pim_mac,
-            this.pim_prodcode,
+            this.pd_prodcode,
             this.pr_detail,
-            this.pr_spec});
+            this.outqty,
+            this.getqty,
+            this.ungetqty});
             this.InOutDetailDGV.Location = new System.Drawing.Point(32, 37);
             this.InOutDetailDGV.Margin = new System.Windows.Forms.Padding(2);
             this.InOutDetailDGV.Name = "InOutDetailDGV";
@@ -65,32 +65,36 @@
             this.InOutDetailDGV.Size = new System.Drawing.Size(544, 357);
             this.InOutDetailDGV.TabIndex = 219;
             // 
-            // pim_outboxcode
+            // pd_prodcode
             // 
-            this.pim_outboxcode.HeaderText = "栈板/箱号";
-            this.pim_outboxcode.MinimumWidth = 120;
-            this.pim_outboxcode.Name = "pim_outboxcode";
-            this.pim_outboxcode.Width = 120;
+            this.pd_prodcode.DataPropertyName = "pd_prodcode";
+            this.pd_prodcode.HeaderText = "产品代码";
+            this.pd_prodcode.MinimumWidth = 120;
+            this.pd_prodcode.Name = "pd_prodcode";
+            this.pd_prodcode.Width = 120;
             // 
-            // pim_mac
+            // pr_detail
             // 
-            this.pim_mac.HeaderText = "SN号";
-            this.pim_mac.Name = "pim_mac";
+            this.pr_detail.DataPropertyName = "pr_detail";
+            this.pr_detail.HeaderText = "产品名称";
+            this.pr_detail.Name = "pr_detail";
             // 
-            // pim_prodcode
+            // outqty
             // 
-            this.pim_prodcode.HeaderText = "产品代码";
-            this.pim_prodcode.Name = "pim_prodcode";
+            this.outqty.DataPropertyName = "outqty";
+            this.outqty.HeaderText = "出货数";
+            this.outqty.Name = "outqty";
             // 
-            // pr_detail
+            // getqty
             // 
-            this.pr_detail.HeaderText = "名称";
-            this.pr_detail.Name = "pr_detail";
+            this.getqty.DataPropertyName = "getqty";
+            this.getqty.HeaderText = "已采集数";
+            this.getqty.Name = "getqty";
             // 
-            // pr_spec
+            // ungetqty
             // 
-            this.pr_spec.HeaderText = "规格";
-            this.pr_spec.Name = "pr_spec";
+            this.ungetqty.HeaderText = "未采集数";
+            this.ungetqty.Name = "ungetqty";
             // 
             // Warehouse_ProdDetail
             // 
@@ -113,10 +117,10 @@
 
         private CustomControl.HeadBar headBar1;
         private CustomControl.DataGrid_View.DataGridViewWithSerialNum InOutDetailDGV;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_outboxcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_mac;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
+        private System.Windows.Forms.DataGridViewTextBoxColumn outqty;
+        private System.Windows.Forms.DataGridViewTextBoxColumn getqty;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ungetqty;
     }
 }

+ 27 - 2
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.cs

@@ -6,19 +6,44 @@ using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Windows.Forms;
+using UAS_MES.DataOperate;
+using UAS_MES.PublicMethod;
 
 namespace UAS_MES.Warehouse
 {
     public partial class Warehouse_ProdDetail : Form
     {
-        public Warehouse_ProdDetail()
+        DataTable dbfind;
+
+        DataHelper dh;
+        LogStringBuilder sql = new LogStringBuilder();
+
+        //页面Caller
+        string caller;
+
+        string pim_inoutno;
+        string pd_piid;
+
+        public Warehouse_ProdDetail(string pim_inoutno,string pd_piid)
         {
+            dh = new DataHelper();
             InitializeComponent();
+            this.pim_inoutno = pim_inoutno;
+            this.pd_piid = pd_piid;
         }
 
         private void Warehouse_ProdDetail_Load(object sender, EventArgs e)
         {
-
+            sql.Clear();
+            sql.Append("select pd_prodcode,pr_detail,outqty ,nvl((select count(1) from prodiomac where pim_inoutno='"+pim_inoutno+"' and pim_prodcode=pd_prodcode),0) getqty ");
+            sql.Append("from (select pd_prodcode,sum(pd_outqty) outqty from prodiodetail ");
+            sql.Append("where pd_piid='"+pd_piid+"'group by pd_prodcode) left join product on pr_code=pd_prodcode");
+            dbfind = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
+            BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dbfind);
+            for (int i = 0; i < InOutDetailDGV.Rows.Count; i++)
+            {
+                InOutDetailDGV.Rows[i].Cells["ungetqty"].Value = (int.Parse(InOutDetailDGV.Rows[i].Cells["outqty"].Value.ToString()) - int.Parse(InOutDetailDGV.Rows[i].Cells["getqty"].Value.ToString())).ToString();
+            }
         }
     }
 }

+ 120 - 0
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>