Browse Source

优化装箱功能,栈板称重功能

callm 19 hours ago
parent
commit
9e81e41fa0

+ 1 - 0
UAS_MES_YDCY/DataOperate/DataHelper.cs

@@ -128,6 +128,7 @@ namespace UAS_MES_NEW.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select count(1) from " + TableName + " where " + Condition;
+            Console.WriteLine(  sql);
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);

+ 120 - 104
UAS_MES_YDCY/FunctionCode/Warehouse/Warehouse_FinishedProductOutSumNEW.Designer.cs

@@ -34,6 +34,10 @@
             this.pi_titile_label = new System.Windows.Forms.Label();
             this.pi_title = new System.Windows.Forms.Label();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.sumpalletweight = new System.Windows.Forms.Label();
+            this.label1 = new System.Windows.Forms.Label();
+            this.weight = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
             this.boxqty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
             this.getqty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
             this.ungetqty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
@@ -53,12 +57,6 @@
             this.PrintLabel = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.ComboxWithTip(this.components);
             this.Printlab = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Prodiodetail = new UAS_MES_NEW.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.pd_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.cancel = new UAS_MES_NEW.CustomControl.CustomCheckBox.CustomCheckBox();
@@ -82,10 +80,13 @@
             this.pa_packageqty_label = new System.Windows.Forms.Label();
             this.StartWeight = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.RefreshWeigh = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.sumpalletweight = new System.Windows.Forms.Label();
-            this.label1 = new System.Windows.Forms.Label();
-            this.weight = new System.Windows.Forms.Label();
-            this.label5 = new System.Windows.Forms.Label();
+            this.pd_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_cartons = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Prodiodetail)).BeginInit();
@@ -145,6 +146,49 @@
             this.panel1.Size = new System.Drawing.Size(553, 388);
             this.panel1.TabIndex = 217;
             // 
+            // sumpalletweight
+            // 
+            this.sumpalletweight.AutoSize = true;
+            this.sumpalletweight.Font = new System.Drawing.Font("微软雅黑", 25F);
+            this.sumpalletweight.Location = new System.Drawing.Point(301, 274);
+            this.sumpalletweight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.sumpalletweight.Name = "sumpalletweight";
+            this.sumpalletweight.Size = new System.Drawing.Size(0, 88);
+            this.sumpalletweight.TabIndex = 250;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(271, 201);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(210, 41);
+            this.label1.TabIndex = 249;
+            this.label1.Text = "系统计算重量";
+            // 
+            // weight
+            // 
+            this.weight.AutoSize = true;
+            this.weight.Font = new System.Drawing.Font("微软雅黑", 35F);
+            this.weight.ForeColor = System.Drawing.Color.DarkGreen;
+            this.weight.Location = new System.Drawing.Point(295, 84);
+            this.weight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.weight.Name = "weight";
+            this.weight.Size = new System.Drawing.Size(0, 121);
+            this.weight.TabIndex = 248;
+            // 
+            // 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(271, 22);
+            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 = 247;
+            this.label5.Text = "称量重量";
+            // 
             // boxqty
             // 
             this.boxqty.AutoSize = true;
@@ -359,6 +403,7 @@
             this.Prodiodetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.Prodiodetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.pd_pdno,
+            this.pd_cartons,
             this.pd_id,
             this.pd_prodcode,
             this.dataGridViewTextBoxColumn2,
@@ -374,58 +419,6 @@
             this.Prodiodetail.TabIndex = 242;
             this.Prodiodetail.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Prodiodetail_CellClick);
             // 
-            // pd_pdno
-            // 
-            this.pd_pdno.DataPropertyName = "pd_pdno";
-            this.pd_pdno.HeaderText = "序号";
-            this.pd_pdno.MinimumWidth = 10;
-            this.pd_pdno.Name = "pd_pdno";
-            this.pd_pdno.Width = 200;
-            // 
-            // pd_id
-            // 
-            this.pd_id.DataPropertyName = "pd_id";
-            this.pd_id.HeaderText = "ID";
-            this.pd_id.MinimumWidth = 10;
-            this.pd_id.Name = "pd_id";
-            this.pd_id.Width = 10;
-            // 
-            // pd_prodcode
-            // 
-            this.pd_prodcode.DataPropertyName = "pd_prodcode";
-            this.pd_prodcode.HeaderText = "物料编号";
-            this.pd_prodcode.MinimumWidth = 2;
-            this.pd_prodcode.Name = "pd_prodcode";
-            this.pd_prodcode.ReadOnly = true;
-            this.pd_prodcode.Width = 150;
-            // 
-            // dataGridViewTextBoxColumn2
-            // 
-            this.dataGridViewTextBoxColumn2.DataPropertyName = "pd_outqty";
-            this.dataGridViewTextBoxColumn2.HeaderText = "出货数量";
-            this.dataGridViewTextBoxColumn2.MinimumWidth = 10;
-            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
-            this.dataGridViewTextBoxColumn2.ReadOnly = true;
-            this.dataGridViewTextBoxColumn2.Width = 200;
-            // 
-            // pr_detail1
-            // 
-            this.pr_detail1.DataPropertyName = "pr_detail";
-            this.pr_detail1.HeaderText = "名称";
-            this.pr_detail1.MinimumWidth = 10;
-            this.pr_detail1.Name = "pr_detail1";
-            this.pr_detail1.ReadOnly = true;
-            this.pr_detail1.Width = 200;
-            // 
-            // pr_spec1
-            // 
-            this.pr_spec1.DataPropertyName = "pr_spec";
-            this.pr_spec1.HeaderText = "规格";
-            this.pr_spec1.MinimumWidth = 200;
-            this.pr_spec1.Name = "pr_spec1";
-            this.pr_spec1.ReadOnly = true;
-            this.pr_spec1.Width = 200;
-            // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -638,7 +631,7 @@
             this.AutoOutBoxCode.Name = "AutoOutBoxCode";
             this.AutoOutBoxCode.Size = new System.Drawing.Size(155, 39);
             this.AutoOutBoxCode.TabIndex = 253;
-            this.AutoOutBoxCode.Text = "自动生成";
+            this.AutoOutBoxCode.Text = "散包出货";
             this.AutoOutBoxCode.UseVisualStyleBackColor = true;
             // 
             // pa_outboxcode
@@ -733,48 +726,70 @@
             this.RefreshWeigh.Text = "刷新重量";
             this.RefreshWeigh.UseVisualStyleBackColor = true;
             // 
-            // sumpalletweight
+            // pd_pdno
             // 
-            this.sumpalletweight.AutoSize = true;
-            this.sumpalletweight.Font = new System.Drawing.Font("微软雅黑", 25F);
-            this.sumpalletweight.Location = new System.Drawing.Point(301, 274);
-            this.sumpalletweight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.sumpalletweight.Name = "sumpalletweight";
-            this.sumpalletweight.Size = new System.Drawing.Size(0, 88);
-            this.sumpalletweight.TabIndex = 250;
+            this.pd_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pd_pdno.DataPropertyName = "pd_pdno";
+            this.pd_pdno.HeaderText = "序号";
+            this.pd_pdno.MinimumWidth = 10;
+            this.pd_pdno.Name = "pd_pdno";
             // 
-            // label1
+            // pd_cartons
             // 
-            this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(271, 201);
-            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(210, 41);
-            this.label1.TabIndex = 249;
-            this.label1.Text = "系统计算重量";
+            this.pd_cartons.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pd_cartons.DataPropertyName = "pd_cartons";
+            this.pd_cartons.HeaderText = "栈板数量";
+            this.pd_cartons.MinimumWidth = 10;
+            this.pd_cartons.Name = "pd_cartons";
+            this.pd_cartons.Width = 160;
             // 
-            // weight
+            // pd_id
             // 
-            this.weight.AutoSize = true;
-            this.weight.Font = new System.Drawing.Font("微软雅黑", 35F);
-            this.weight.ForeColor = System.Drawing.Color.DarkGreen;
-            this.weight.Location = new System.Drawing.Point(295, 84);
-            this.weight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.weight.Name = "weight";
-            this.weight.Size = new System.Drawing.Size(0, 121);
-            this.weight.TabIndex = 248;
+            this.pd_id.DataPropertyName = "pd_id";
+            this.pd_id.HeaderText = "ID";
+            this.pd_id.MinimumWidth = 10;
+            this.pd_id.Name = "pd_id";
+            this.pd_id.Visible = false;
+            this.pd_id.Width = 10;
             // 
-            // label5
+            // pd_prodcode
             // 
-            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(271, 22);
-            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 = 247;
-            this.label5.Text = "称量重量";
+            this.pd_prodcode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.pd_prodcode.DataPropertyName = "pd_prodcode";
+            this.pd_prodcode.HeaderText = "物料编号";
+            this.pd_prodcode.MinimumWidth = 2;
+            this.pd_prodcode.Name = "pd_prodcode";
+            this.pd_prodcode.ReadOnly = true;
+            this.pd_prodcode.Width = 2;
+            // 
+            // dataGridViewTextBoxColumn2
+            // 
+            this.dataGridViewTextBoxColumn2.DataPropertyName = "pd_outqty";
+            this.dataGridViewTextBoxColumn2.HeaderText = "出货数量";
+            this.dataGridViewTextBoxColumn2.MinimumWidth = 10;
+            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
+            this.dataGridViewTextBoxColumn2.ReadOnly = true;
+            this.dataGridViewTextBoxColumn2.Width = 200;
+            // 
+            // pr_detail1
+            // 
+            this.pr_detail1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.pr_detail1.DataPropertyName = "pr_detail";
+            this.pr_detail1.HeaderText = "名称";
+            this.pr_detail1.MinimumWidth = 10;
+            this.pr_detail1.Name = "pr_detail1";
+            this.pr_detail1.ReadOnly = true;
+            this.pr_detail1.Width = 10;
+            // 
+            // pr_spec1
+            // 
+            this.pr_spec1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.pr_spec1.DataPropertyName = "pr_spec";
+            this.pr_spec1.HeaderText = "规格";
+            this.pr_spec1.MinimumWidth = 200;
+            this.pr_spec1.Name = "pr_spec1";
+            this.pr_spec1.ReadOnly = true;
+            this.pr_spec1.Width = 200;
             // 
             // Warehouse_FinishedProductOutSumNEW
             // 
@@ -864,12 +879,6 @@
         private System.Windows.Forms.Label PrinterList_label;
         private CustomControl.ComBoxWithFocus.PrinterCombox PrinterList;
         private System.Windows.Forms.CheckBox Combine;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pd_pdno;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pd_id;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail1;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
         private System.Windows.Forms.CheckBox AutoOutBoxCode;
         private CustomControl.TextBoxWithIcon.SnCollectionBox pa_outboxcode;
         private System.Windows.Forms.Label pa_outboxcode_label;
@@ -887,5 +896,12 @@
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label weight;
         private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_pdno;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_cartons;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
     }
 }

+ 71 - 45
UAS_MES_YDCY/FunctionCode/Warehouse/Warehouse_FinishedProductOutSumNEW.cs

@@ -79,13 +79,13 @@ namespace UAS_MES_NEW.Warehouse
             }
         }
 
-        private string RefreshWeight(string pr_code)
+        private string RefreshWeight(string pr_code, string pa_outboxcode)
         {
-            string boxweight = dh.getFieldDataByCondition("package", "nvl(sum(pa_weight),0)", "pa_mothercode='" + pa_outboxcode.Text + "'").ToString();
-            string pr_Singlelevelqty = dh.getFieldDataByCondition("packagedetail left join product on PD_PRODCODE=pr_code", "nvl(pr_Singlelevelqty,1)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-            string palletweight = dh.getFieldDataByCondition("pallet", "nvl(PL_WEIGHT,0)", "PL_CODE=(select PA_PALLETNO from package where pa_outboxcode='" + pa_outboxcode.Text + "')").ToString();
+            string boxweight = dh.getFieldDataByCondition("package", "nvl(sum(pa_weight),0)", "pa_mothercode='" + pa_outboxcode + "'").ToString();
+            string pr_Singlelevelqty = dh.getFieldDataByCondition("packagedetail left join product on PD_PRODCODE=pr_code", "nvl(pr_Singlelevelqty,1)", "pd_outboxcode='" + pa_outboxcode + "'").ToString();
+            string palletweight = dh.getFieldDataByCondition("pallet", "nvl(PL_WEIGHT,0)", "PL_CODE=(select PA_PALLETNO from package where pa_outboxcode='" + pa_outboxcode + "')").ToString();
             sumpalletweight.Text = (double.Parse(boxweight)).ToString();
-            int packageqty = dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "'");
+            int packageqty = dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode + "'");
             pr_Singlelevelqty = pr_Singlelevelqty == "" ? "1" : pr_Singlelevelqty;
             //根据单层装的数量,自动计算栈板装的层数
             int rowcount = 0;
@@ -204,13 +204,13 @@ namespace UAS_MES_NEW.Warehouse
         {
             sql.Clear();
             sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_prodcode,pr_detail,pr_spec from package ");
-            sql.Append("left join product on pr_code=pa_prodcode where pa_outno='" + pi_inoutno.Text + "' and pa_type=3 order by pa_outboxcode asc");
+            sql.Append("left join product on pr_code=pa_prodcode where pa_outno='" + pi_inoutno.Text + "' and pa_type in (1,3) order by pa_outboxcode asc");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
             if (Combine.Checked)
             {
                 sql.Clear();
-                sql.Append("select max(pd_pdno)pd_pdno,max(pd_id)pd_id,pd_prodcode,sum(pd_outqty)pd_outqty,max(pr_detail)pr_detail,max(pr_spec)pr_spec from prodiodetail left join prodinout ");
+                sql.Append("select max(pd_pdno)pd_pdno,max(pd_id)pd_id,pd_prodcode,sum(nvl(pd_cartons,0))pd_cartons,sum(pd_outqty)pd_outqty,max(pr_detail)pr_detail,max(pr_spec)pr_spec from prodiodetail left join prodinout ");
                 sql.Append("on pd_piid=pi_id left join product on pd_prodcode=pr_code where pi_inoutno='" + pi_inoutno.Text + "' group by pd_prodcode");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
@@ -218,7 +218,7 @@ namespace UAS_MES_NEW.Warehouse
             else
             {
                 sql.Clear();
-                sql.Append("select pd_pdno,pd_prodcode,pd_id,pd_outqty,pr_detail,pr_spec from prodiodetail left join prodinout ");
+                sql.Append("select pd_pdno,pd_prodcode,pd_id,pd_outqty,nvl(pd_cartons,0)pd_cartons,pr_detail,pr_spec from prodiodetail left join prodinout ");
                 sql.Append("on pd_piid=pi_id left join product on pd_prodcode=pr_code where pi_inoutno='" + pi_inoutno.Text + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
@@ -273,8 +273,9 @@ namespace UAS_MES_NEW.Warehouse
                         {
                             string pa_makecode = "";
                             string PA_TOTALQTY = "";
+                            string pa_prodcode = "";
                             sql.Clear();
-                            sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_status,nvl(pa_iostatus,0) pa_iostatus,pa_makecode,pa_mothercode,nvl(pa_downstatus,0)pa_downstatus,pa_outno from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
+                            sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_status,pa_prodcode,nvl(pa_iostatus,0) pa_iostatus,pa_makecode,pa_mothercode,nvl(pa_downstatus,0)pa_downstatus,pa_outno from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows.Count > 0)
                             {
@@ -282,6 +283,7 @@ namespace UAS_MES_NEW.Warehouse
                                     return;
                                 pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
                                 PA_TOTALQTY = dt.Rows[0]["PA_TOTALQTY"].ToString();
+                                pa_prodcode = dt.Rows[0]["pa_prodcode"].ToString();
                             }
                             else
                             {
@@ -308,6 +310,7 @@ namespace UAS_MES_NEW.Warehouse
                                 OperateResult.AppendText("当前栈板数量" + PA_TOTALQTY + ",超出待采集数量\n", Color.Red, input);
                                 return;
                             }
+                            RefreshWeight(pa_prodcode, input.Text);
                             if (!checkinsertprodiomac("栈板号", input.Text))
                                 return;
                             //更新箱号对应的出货单号
@@ -353,48 +356,71 @@ namespace UAS_MES_NEW.Warehouse
                                 OperateResult.AppendText("箱号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
                                 return;
                             }
-                            if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked)
+                            if (pa_outboxcode.Text == "" && !AutoOutBoxCode.Checked)
                             {
                                 pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", pa_makecode, pa_prodcode, User.UserCode);
                             }
-                            //插入新的栈板号和箱号
-                            string pa_id = dh.getFieldDataByCondition("package", "pa_id", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-                            if (pa_id == "")
+                            //需要打栈板
+                            if (pa_outboxcode.Text != "")
                             {
-                                pa_id = dh.GetSEQ("package_seq");
-                                dh.ExecuteSql("insert into package(PA_ID, PA_OUTBOXCODE,PA_PRODCODE,PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,PA_SALECODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY,PA_SCCODE,PA_OUTNO)values" +
-                                            "(" + pa_id + ",'" + pa_outboxcode.Text + "',case when nvl('" + pr_packrule + "',' ')<>'MIX' then '" + pa_prodcode + "' ELSE''END,3,0,0,case when '" + pr_packrule + "'='MAKE' THEN '" + pa_makecode + "' ELSE '' END, 0,SYSDATE,case when '" + pr_packrule + "'='SALE' " +
-                                             "then '" + pa_salecode + "' else ''end,3,0,'" + pr_packrule + "'," + pa_standardqty.Text + ",'" + User.UserSourceCode + "','" + pi_inoutno.Text + "')", "insert");
-                            }
-                            sql.Clear();
-                            sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
-                            sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode + "','" + pa_prodcode + "','" + input.Text + "' ");
-                            sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
-                            sql.Append("'" + input.Text + "'),sysdate from package where pa_outboxcode='" + input.Text + "'");
-                            dh.ExecuteSql(sql.GetString(), "insert");
-                            dh.ExecuteSql("update package set pa_packageqty=pa_packageqty+1,pa_totalqty=pa_totalqty+(select pa_totalqty from package where pa_outboxcode='" + input.Text + "'),pa_currentqty=pa_currentqty+1,pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
-                            if (pa_mothercode != "")
-                            {
-                                //从之前的栈板号里面移除出来
-                                dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_mothercode + "' and pd_innerboxcode='" + input.Text + "'", "delete");
-                                //减少箱内容量
-                                dh.ExecuteSql("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + input.Text + "'),pa_currentqty=pa_currentqty-1,pa_status=0 where pa_outboxcode='" + pa_mothercode + "'", "update");
-                                dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
+                                //插入新的栈板号和箱号
+                                string pa_id = dh.getFieldDataByCondition("package", "pa_id", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                                if (pa_id == "")
+                                {
+                                    pa_id = dh.GetSEQ("package_seq");
+                                    dh.ExecuteSql("insert into package(PA_ID, PA_OUTBOXCODE,PA_PRODCODE,PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,PA_SALECODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY,PA_SCCODE,PA_OUTNO)values" +
+                                                "(" + pa_id + ",'" + pa_outboxcode.Text + "',case when nvl('" + pr_packrule + "',' ')<>'MIX' then '" + pa_prodcode + "' ELSE''END,3,0,0,case when '" + pr_packrule + "'='MAKE' THEN '" + pa_makecode + "' ELSE '' END, 0,SYSDATE,case when '" + pr_packrule + "'='SALE' " +
+                                                 "then '" + pa_salecode + "' else ''end,3,0,'" + pr_packrule + "'," + pa_standardqty.Text + ",'" + User.UserSourceCode + "','" + pi_inoutno.Text + "')", "insert");
+                                }
+                                sql.Clear();
+                                sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
+                                sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode + "','" + pa_prodcode + "','" + input.Text + "' ");
+                                sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
+                                sql.Append("'" + input.Text + "'),sysdate from package where pa_outboxcode='" + input.Text + "'");
+                                dh.ExecuteSql(sql.GetString(), "insert");
+                                dh.ExecuteSql("update package set pa_packageqty=pa_packageqty+1,pa_totalqty=pa_totalqty+(select pa_totalqty from package where pa_outboxcode='" + input.Text + "'),pa_currentqty=pa_currentqty+1,pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
+                                if (pa_mothercode != "")
+                                {   
+                                    //从之前的栈板号里面移除出来
+                                    dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_mothercode + "' and pd_innerboxcode='" + input.Text + "'", "delete");
+                                    //减少箱内容量
+                                    dh.ExecuteSql("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + input.Text + "'),pa_currentqty=pa_currentqty-1,pa_status=0 where pa_outboxcode='" + pa_mothercode + "'", "update");
+                                    dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
+                                }
+                                RefreshWeight(pa_prodcode, input.Text);
+                                if (!checkinsertprodiomac("栈板", pa_outboxcode.Text))
+                                    return;
+                                //更新箱号对应的出货单号
+                                dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
+                                List<string> v_barcode = new List<string>();
+                                List<string> v_makecode = new List<string>();
+                                DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
+                                for (int i = 0; i < datatable.Rows.Count; i++)
+                                {
+                                    v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
+                                    v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
+                                }
+                                dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text, "");
                             }
-                            if (!checkinsertprodiomac("栈板", pa_outboxcode.Text))
-                                return;
-                            //更新箱号对应的出货单号
-                            dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
-                            List<string> v_barcode = new List<string>();
-                            List<string> v_makecode = new List<string>();
-                            DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
-                            for (int i = 0; i < datatable.Rows.Count; i++)
+                            else
                             {
-                                v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
-                                v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
+                                RefreshWeight(pa_prodcode, input.Text);
+                                if (!checkinsertprodiomac("箱号",input.Text))
+                                    return;
+                                //更新箱号对应的出货单号
+                                dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
+                                List<string> v_barcode = new List<string>();
+                                List<string> v_makecode = new List<string>();
+                                DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
+                                for (int i = 0; i < datatable.Rows.Count; i++)
+                                {
+                                    v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
+                                    v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
+                                }
+                                dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text, "");
                             }
-                            dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text, "");
                         }
                         else
                         {
@@ -591,7 +617,7 @@ namespace UAS_MES_NEW.Warehouse
             }
             else if (type == "箱号")
             {
-                pib_type = "PALLET";
+                pib_type = "BOX";
             }
             sql.Clear();
             sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode,pim_inorout,pim_class)");

+ 21 - 0
UAS_MES_YDCY/FunctionCode/Warehouse/Warehouse_FinishedProductOutSumNEW.resx

@@ -255,6 +255,9 @@
   <metadata name="pd_pdno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_cartons.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -326,6 +329,24 @@
   <metadata name="blank.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pa_mothercode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="PA_TOTALQTY.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_detail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="blank.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <data name="ProdDetail.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m