Browse Source

添加分组合并

章政 7 years ago
parent
commit
0b1ac87317

+ 15 - 14
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -561,7 +561,7 @@
             // 
             this.pictureBox1.Image = global::UAS_LabelMachine.Properties.Resources.Status;
             this.pictureBox1.Location = new System.Drawing.Point(548, 150);
-            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
             this.pictureBox1.Name = "pictureBox1";
             this.pictureBox1.Size = new System.Drawing.Size(163, 80);
             this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@@ -701,7 +701,7 @@
             this.pjd_zxbzs_user});
             this.GridPrcode.GridColor = System.Drawing.SystemColors.Control;
             this.GridPrcode.Location = new System.Drawing.Point(0, 278);
-            this.GridPrcode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.GridPrcode.Margin = new System.Windows.Forms.Padding(4);
             this.GridPrcode.MultiSelect = false;
             this.GridPrcode.Name = "GridPrcode";
             this.GridPrcode.RowTemplate.Height = 23;
@@ -805,7 +805,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(85, 138);
+            this.label18.Location = new System.Drawing.Point(85, 137);
             this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(15, 20);
@@ -840,7 +840,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(84, 59);
+            this.label16.Location = new System.Drawing.Point(84, 58);
             this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(15, 20);
@@ -875,7 +875,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(9, 91);
+            this.label12.Location = new System.Drawing.Point(9, 90);
             this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(69, 20);
@@ -886,7 +886,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(9, 20);
+            this.label7.Location = new System.Drawing.Point(9, 19);
             this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(69, 20);
@@ -1141,7 +1141,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(67, 221);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(94, 220);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(91, 32);
@@ -1156,7 +1156,7 @@
             this.SingleLabelAutoPrint.Checked = true;
             this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(8, 116);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(8, 115);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(91, 24);
@@ -1209,7 +1209,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(5, 150);
+            this.label2.Location = new System.Drawing.Point(5, 149);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(39, 20);
@@ -1233,7 +1233,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(7, 190);
+            this.label5.Location = new System.Drawing.Point(7, 189);
             this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(39, 20);
@@ -1267,7 +1267,7 @@
             this.MidLabelAutoPrint.Checked = true;
             this.MidLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(12, 116);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(12, 115);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(91, 24);
@@ -1310,7 +1310,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(145, 8);
+            this.LogingOut.Location = new System.Drawing.Point(145, 7);
             this.LogingOut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(52, 27);
@@ -1337,7 +1337,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(9, 185);
+            this.label10.Location = new System.Drawing.Point(9, 184);
             this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(39, 20);
@@ -1348,7 +1348,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(9, 138);
+            this.label6.Location = new System.Drawing.Point(9, 137);
             this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(39, 20);
@@ -1408,6 +1408,7 @@
             this.Combindetail.TabIndex = 104;
             this.Combindetail.Text = "合并明细";
             this.Combindetail.UseVisualStyleBackColor = true;
+            this.Combindetail.CheckedChanged += new System.EventHandler(this.Combindetail_CheckedChanged);
             // 
             // UAS_出货标签打印
             // 

+ 27 - 2
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -265,7 +265,7 @@ namespace UAS_LabelMachine
             if (CurrentUnit == "KPCS")
             {
                 //如果单位是KPCS则必须是1000的整数倍
-                if ((int.Parse(Data["QTY"]) > 1000&& int.Parse(Data["QTY"]) % 1000 != 0) || int.Parse(Data["QTY"]) / 1000 % float.Parse(CurrentZXBZ) != 0)
+                if ((int.Parse(Data["QTY"]) > 1000 && int.Parse(Data["QTY"]) % 1000 != 0) || int.Parse(Data["QTY"]) / 1000 % float.Parse(CurrentZXBZ) != 0)
                 {
                     MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
                     Input.SelectAll();
@@ -1268,7 +1268,27 @@ namespace UAS_LabelMachine
 
         private void LoadPrcodeData()
         {
-            GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_pdno,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
+            if (Combindetail.Checked)
+            {
+                sql.Clear();
+                sql.Append("select min(pd_pdno)pd_pdno,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,sum(pd_outqty)pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id ");
+                sql.Append("from  prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on ");
+                sql.Append("pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "'");
+                sql.Append("group by pd_prodcode,pd_brand,pr_unit ,pjd_zxbzs_user,pjd_id  order by pd_pdno");
+                GridPrcode.DataSource = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            }
+            else
+            {
+                GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_pdno,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
+            }
+            for (int i = 0; i < GridPrcode.Rows.Count; i++)
+            {
+                string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
+                string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
+                string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
+                GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
+                GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = float.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - float.Parse(collectqty == "" ? "0" : collectqty);
+            }
             if (GridPrcode.Rows.Count > 0)
             {
                 CurrentPrCode = GridPrcode.Rows[0].Cells["pd_prodcode"].Value.ToString();
@@ -1643,5 +1663,10 @@ namespace UAS_LabelMachine
             LoadGridData(sender, e);
             CustomerLabel.Enabled = false;
         }
+
+        private void Combindetail_CheckedChanged(object sender, EventArgs e)
+        {
+            LoadPrcodeData();
+        }
     }
 }