Browse Source

添加条码自动生成,外箱数量校验

章政 6 years ago
parent
commit
9950125a00

+ 18 - 0
UAS-出货标签管理(泽天)/Entity/ItemObject.cs

@@ -0,0 +1,18 @@
+namespace UAS_LabelMachine.Entity
+{
+    class ItemObject
+    {
+        public string Text = "", Value = "";//可以多个
+
+        public ItemObject(string _text, string _value)
+        {
+            Text = _text;
+            Value = _value;
+        }
+
+        public override string ToString()
+        {
+            return Text;
+        }
+    }
+}

+ 1 - 0
UAS-出货标签管理(泽天)/Program.cs

@@ -61,6 +61,7 @@ namespace UAS_LabelMachine
         static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
         {
             string str = GetExceptionMsg(e.Exception, e.ToString());
+            LogManager.DoLog(e.Exception.StackTrace);
             MessageBox.Show(str, "操作异常", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         //未处理的异常统一通过这里返回

+ 1 - 0
UAS-出货标签管理(泽天)/PublicMethod/DataHelper.cs

@@ -830,6 +830,7 @@ namespace UAS_LabelMachine
                     command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
                 }
             }
+            Console.WriteLine(SQL);
             switch (Type.ToUpper())
             {
                 case "SELECT":

+ 1 - 0
UAS-出货标签管理(泽天)/UAS-出货标签管理(泽天).csproj

@@ -211,6 +211,7 @@
     <Compile Include="DbFind.Designer.cs">
       <DependentUpon>DbFind.cs</DependentUpon>
     </Compile>
+    <Compile Include="Entity\ItemObject.cs" />
     <Compile Include="Entity\SystemInf.cs" />
     <Compile Include="Entity\User.cs" />
     <Compile Include="Login.cs">

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

@@ -40,7 +40,6 @@
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
-            this.AllCollected = new System.Windows.Forms.Button();
             this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -80,6 +79,9 @@
             this.PrintFooter = new System.Windows.Forms.Button();
             this.GridPrcode = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.pd_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pjd_zxbzs_user = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.groupBoxWithBorder1 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.SetPrintStatus_label = new System.Windows.Forms.Label();
             this.label18 = new System.Windows.Forms.Label();
@@ -106,7 +108,6 @@
             this.griddetno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -115,7 +116,6 @@
             this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -185,7 +185,7 @@
             // 
             this.label24.AutoSize = true;
             this.label24.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label24.Location = new System.Drawing.Point(9, 129);
+            this.label24.Location = new System.Drawing.Point(9, 105);
             this.label24.Name = "label24";
             this.label24.Size = new System.Drawing.Size(51, 20);
             this.label24.TabIndex = 55;
@@ -267,18 +267,6 @@
             this.Fresh.Text = "刷新";
             this.Fresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Refresh_LinkClicked);
             // 
-            // AllCollected
-            // 
-            this.AllCollected.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AllCollected.Location = new System.Drawing.Point(320, 80);
-            this.AllCollected.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.AllCollected.Name = "AllCollected";
-            this.AllCollected.Size = new System.Drawing.Size(68, 26);
-            this.AllCollected.TabIndex = 75;
-            this.AllCollected.Text = "全部已采";
-            this.AllCollected.UseVisualStyleBackColor = true;
-            this.AllCollected.Click += new System.EventHandler(this.AllCollected_Click);
-            // 
             // GetGridOnly
             // 
             this.GetGridOnly.AutoSize = true;
@@ -555,7 +543,7 @@
             // ExportData
             // 
             this.ExportData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ExportData.Location = new System.Drawing.Point(320, 114);
+            this.ExportData.Location = new System.Drawing.Point(320, 79);
             this.ExportData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ExportData.Name = "ExportData";
             this.ExportData.Size = new System.Drawing.Size(68, 26);
@@ -581,7 +569,10 @@
             this.GridPrcode.BackgroundColor = System.Drawing.SystemColors.Control;
             this.GridPrcode.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.GridPrcode.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.pd_prodcode});
+            this.pd_prodcode,
+            this.pr_unit,
+            this.pd_brand,
+            this.pjd_zxbzs_user});
             this.GridPrcode.GridColor = System.Drawing.SystemColors.Control;
             this.GridPrcode.Location = new System.Drawing.Point(0, 204);
             this.GridPrcode.Name = "GridPrcode";
@@ -593,11 +584,32 @@
             // 
             // pd_prodcode
             // 
-            this.pd_prodcode.DataPropertyName = "pib_prodcode";
+            this.pd_prodcode.DataPropertyName = "pd_prodcode";
             this.pd_prodcode.HeaderText = "物料编号";
             this.pd_prodcode.Name = "pd_prodcode";
             this.pd_prodcode.ReadOnly = true;
             // 
+            // pr_unit
+            // 
+            this.pr_unit.DataPropertyName = "pr_unit";
+            this.pr_unit.HeaderText = "单位";
+            this.pr_unit.Name = "pr_unit";
+            this.pr_unit.ReadOnly = true;
+            // 
+            // pd_brand
+            // 
+            this.pd_brand.DataPropertyName = "pd_brand";
+            this.pd_brand.HeaderText = "品牌";
+            this.pd_brand.Name = "pd_brand";
+            this.pd_brand.ReadOnly = true;
+            // 
+            // pjd_zxbzs_user
+            // 
+            this.pjd_zxbzs_user.DataPropertyName = "pjd_zxbzs_user";
+            this.pjd_zxbzs_user.HeaderText = "最小包装";
+            this.pjd_zxbzs_user.Name = "pjd_zxbzs_user";
+            this.pjd_zxbzs_user.ReadOnly = true;
+            // 
             // groupBoxWithBorder1
             // 
             this.groupBoxWithBorder1.Controls.Add(this.SetPrintStatus_label);
@@ -623,7 +635,7 @@
             this.SetPrintStatus_label.AutoSize = true;
             this.SetPrintStatus_label.Font = new System.Drawing.Font("微软雅黑", 12F);
             this.SetPrintStatus_label.ForeColor = System.Drawing.Color.Green;
-            this.SetPrintStatus_label.Location = new System.Drawing.Point(9, 140);
+            this.SetPrintStatus_label.Location = new System.Drawing.Point(8, 139);
             this.SetPrintStatus_label.Name = "SetPrintStatus_label";
             this.SetPrintStatus_label.Size = new System.Drawing.Size(58, 21);
             this.SetPrintStatus_label.TabIndex = 76;
@@ -633,7 +645,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(67, 107);
+            this.label18.Location = new System.Drawing.Point(66, 106);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(13, 17);
             this.label18.TabIndex = 90;
@@ -667,7 +679,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(66, 44);
+            this.label16.Location = new System.Drawing.Point(65, 43);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(13, 17);
             this.label16.TabIndex = 87;
@@ -701,7 +713,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(10, 76);
+            this.label12.Location = new System.Drawing.Point(9, 75);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(56, 17);
             this.label12.TabIndex = 77;
@@ -711,7 +723,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(10, 19);
+            this.label7.Location = new System.Drawing.Point(9, 18);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(56, 17);
             this.label7.TabIndex = 76;
@@ -743,7 +755,7 @@
             // 
             this.Capacity.AutoSize = true;
             this.Capacity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Capacity.Location = new System.Drawing.Point(58, 62);
+            this.Capacity.Location = new System.Drawing.Point(57, 61);
             this.Capacity.Name = "Capacity";
             this.Capacity.Size = new System.Drawing.Size(0, 17);
             this.Capacity.TabIndex = 75;
@@ -752,7 +764,7 @@
             // 
             this.Process_midboxcode.AutoSize = true;
             this.Process_midboxcode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process_midboxcode.Location = new System.Drawing.Point(58, 107);
+            this.Process_midboxcode.Location = new System.Drawing.Point(57, 106);
             this.Process_midboxcode.Name = "Process_midboxcode";
             this.Process_midboxcode.Size = new System.Drawing.Size(15, 17);
             this.Process_midboxcode.TabIndex = 74;
@@ -762,7 +774,7 @@
             // 
             this.Process_outboxcode.AutoSize = true;
             this.Process_outboxcode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process_outboxcode.Location = new System.Drawing.Point(58, 83);
+            this.Process_outboxcode.Location = new System.Drawing.Point(57, 82);
             this.Process_outboxcode.Name = "Process_outboxcode";
             this.Process_outboxcode.Size = new System.Drawing.Size(15, 17);
             this.Process_outboxcode.TabIndex = 73;
@@ -773,7 +785,7 @@
             this.TotalCount.AutoSize = true;
             this.TotalCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.TotalCount.ForeColor = System.Drawing.Color.Blue;
-            this.TotalCount.Location = new System.Drawing.Point(92, 14);
+            this.TotalCount.Location = new System.Drawing.Point(91, 13);
             this.TotalCount.Name = "TotalCount";
             this.TotalCount.Size = new System.Drawing.Size(15, 17);
             this.TotalCount.TabIndex = 72;
@@ -783,7 +795,7 @@
             // 
             this.label17.AutoSize = true;
             this.label17.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label17.Location = new System.Drawing.Point(79, 14);
+            this.label17.Location = new System.Drawing.Point(78, 13);
             this.label17.Name = "label17";
             this.label17.Size = new System.Drawing.Size(13, 17);
             this.label17.TabIndex = 71;
@@ -794,7 +806,7 @@
             this.CollectedCount.AutoSize = true;
             this.CollectedCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.CollectedCount.ForeColor = System.Drawing.Color.Red;
-            this.CollectedCount.Location = new System.Drawing.Point(61, 14);
+            this.CollectedCount.Location = new System.Drawing.Point(60, 13);
             this.CollectedCount.Name = "CollectedCount";
             this.CollectedCount.Size = new System.Drawing.Size(15, 17);
             this.CollectedCount.TabIndex = 70;
@@ -804,7 +816,7 @@
             // 
             this.label14.AutoSize = true;
             this.label14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label14.Location = new System.Drawing.Point(8, 84);
+            this.label14.Location = new System.Drawing.Point(7, 83);
             this.label14.Name = "label14";
             this.label14.Size = new System.Drawing.Size(32, 17);
             this.label14.TabIndex = 69;
@@ -814,7 +826,7 @@
             // 
             this.label11.AutoSize = true;
             this.label11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label11.Location = new System.Drawing.Point(8, 107);
+            this.label11.Location = new System.Drawing.Point(7, 106);
             this.label11.Name = "label11";
             this.label11.Size = new System.Drawing.Size(32, 17);
             this.label11.TabIndex = 68;
@@ -824,7 +836,7 @@
             // 
             this.label13.AutoSize = true;
             this.label13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label13.Location = new System.Drawing.Point(8, 43);
+            this.label13.Location = new System.Drawing.Point(7, 42);
             this.label13.Name = "label13";
             this.label13.Size = new System.Drawing.Size(44, 17);
             this.label13.TabIndex = 67;
@@ -834,7 +846,7 @@
             // 
             this.Installed.AutoSize = true;
             this.Installed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Installed.Location = new System.Drawing.Point(58, 43);
+            this.Installed.Location = new System.Drawing.Point(57, 42);
             this.Installed.Name = "Installed";
             this.Installed.Size = new System.Drawing.Size(0, 17);
             this.Installed.TabIndex = 66;
@@ -843,7 +855,7 @@
             // 
             this.Process.AutoSize = true;
             this.Process.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process.Location = new System.Drawing.Point(8, 14);
+            this.Process.Location = new System.Drawing.Point(7, 13);
             this.Process.Name = "Process";
             this.Process.Size = new System.Drawing.Size(44, 17);
             this.Process.TabIndex = 65;
@@ -852,10 +864,11 @@
             // Input
             // 
             this.Input.ID = null;
-            this.Input.Location = new System.Drawing.Point(76, 129);
+            this.Input.Location = new System.Drawing.Point(76, 105);
             this.Input.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.Input.Multiline = true;
             this.Input.Name = "Input";
-            this.Input.Size = new System.Drawing.Size(150, 21);
+            this.Input.Size = new System.Drawing.Size(150, 61);
             this.Input.Str = null;
             this.Input.Str1 = null;
             this.Input.Str2 = null;
@@ -883,7 +896,6 @@
             this.LabelInf.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.LabelInf.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Choose,
-            this.pib_ifpick,
             this.pib_ifprint,
             this.pib_id1,
             this.pib_pdno,
@@ -892,7 +904,6 @@
             this.pib_brand,
             this.pib_madein,
             this.pr_zxbzs,
-            this.pr_unit,
             this.pib_lotno,
             this.pib_datecode,
             this.pib_qty,
@@ -922,14 +933,6 @@
             this.Choose.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
             this.Choose.Width = 55;
             // 
-            // pib_ifpick
-            // 
-            this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_ifpick.DataPropertyName = "pib_ifpick";
-            this.pib_ifpick.HeaderText = "已采集";
-            this.pib_ifpick.Name = "pib_ifpick";
-            this.pib_ifpick.Width = 60;
-            // 
             // pib_ifprint
             // 
             this.pib_ifprint.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -994,14 +997,6 @@
             this.pr_zxbzs.Visible = false;
             this.pr_zxbzs.Width = 90;
             // 
-            // pr_unit
-            // 
-            this.pr_unit.DataPropertyName = "pr_unit";
-            this.pr_unit.HeaderText = "单位";
-            this.pr_unit.Name = "pr_unit";
-            this.pr_unit.Visible = false;
-            this.pr_unit.Width = 54;
-            // 
             // pib_lotno
             // 
             this.pib_lotno.DataPropertyName = "pib_lotno";
@@ -1128,7 +1123,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(37, 151);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(80, 152);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(68, 26);
@@ -1143,7 +1138,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(6, 96);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(5, 95);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1198,7 +1193,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(5, 125);
+            this.label5.Location = new System.Drawing.Point(4, 124);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(32, 17);
             this.label5.TabIndex = 50;
@@ -1231,7 +1226,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(7, 95);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(6, 94);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1275,7 +1270,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(112, 9);
+            this.LogingOut.Location = new System.Drawing.Point(111, 8);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(42, 21);
             this.LogingOut.TabIndex = 77;
@@ -1286,17 +1281,21 @@
             // OutBoxNum
             // 
             this.OutBoxNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxNum.Location = new System.Drawing.Point(117, 128);
+            this.OutBoxNum.Items.AddRange(new object[] {
+            "新增"});
+            this.OutBoxNum.Location = new System.Drawing.Point(117, 127);
             this.OutBoxNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxNum.Name = "OutBoxNum";
             this.OutBoxNum.Size = new System.Drawing.Size(48, 25);
             this.OutBoxNum.TabIndex = 91;
+            this.OutBoxNum.Text = "新增";
+            this.OutBoxNum.Click += new System.EventHandler(this.OutBoxNum_Click);
             // 
             // label10
             // 
             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(85, 130);
+            this.label10.Location = new System.Drawing.Point(84, 129);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(32, 17);
             this.label10.TabIndex = 90;
@@ -1306,7 +1305,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(5, 130);
+            this.label6.Location = new System.Drawing.Point(4, 129);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(32, 17);
             this.label6.TabIndex = 87;
@@ -1330,7 +1329,7 @@
             this.OutboxCapacity.Size = new System.Drawing.Size(38, 23);
             this.OutboxCapacity.TabIndex = 84;
             this.OutboxCapacity.Value = new decimal(new int[] {
-            1,
+            60,
             0,
             0,
             0});
@@ -1352,7 +1351,7 @@
             // 
             this.OutBoxLabelAutoPrint.AutoSize = true;
             this.OutBoxLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(8, 99);
+            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(7, 98);
             this.OutBoxLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxLabelAutoPrint.Name = "OutBoxLabelAutoPrint";
             this.OutBoxLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1388,7 +1387,6 @@
             this.Controls.Add(this.groupBoxWithBorder1);
             this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.GetGridOnly);
-            this.Controls.Add(this.AllCollected);
             this.Controls.Add(this.Fresh);
             this.Controls.Add(this.pi_cardcode_label);
             this.Controls.Add(this.pi_cardcode);
@@ -1418,19 +1416,19 @@
             this.SizeChanged += new System.EventHandler(this.贴标机条码打印_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).EndInit();
-            this.groupBoxWithBorder1.ResumeLayout(true);
+            this.groupBoxWithBorder1.ResumeLayout(false);
             this.groupBoxWithBorder1.PerformLayout();
-            this.CollectionProcess.ResumeLayout(true);
+            this.CollectionProcess.ResumeLayout(false);
             this.CollectionProcess.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LabelInf)).EndInit();
-            this.SingleLabel.ResumeLayout(true);
+            this.SingleLabel.ResumeLayout(false);
             this.SingleLabel.PerformLayout();
-            this.MidLabel.ResumeLayout(true);
+            this.MidLabel.ResumeLayout(false);
             this.MidLabel.PerformLayout();
-            this.OutBoxLabel.ResumeLayout(true);
+            this.OutBoxLabel.ResumeLayout(false);
             this.OutBoxLabel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.OutboxCapacity)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -1501,7 +1499,6 @@
         private System.Windows.Forms.Label pi_cardcode;
         private System.Windows.Forms.Label pi_cardcode_label;
         private System.Windows.Forms.LinkLabel Fresh;
-        private System.Windows.Forms.Button AllCollected;
         private System.Windows.Forms.LinkLabel LogingOut;
         private System.Windows.Forms.Timer RefreshDBConnect;
         private System.Windows.Forms.CheckBox GetGridOnly;
@@ -1530,12 +1527,14 @@
         private System.Windows.Forms.Label pi_date;
         private System.Windows.Forms.Label label19;
         private CustomControl.DataGridViewWithSerialNum GridPrcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
         private System.Windows.Forms.Button SetPrintStatus;
         private System.Windows.Forms.Label SetPrintStatus_label;
         private System.Windows.Forms.Button PrintFooter;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_brand;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pjd_zxbzs_user;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
-        private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifpick;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifprint;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_id1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_pdno;
@@ -1544,7 +1543,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_brand;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_madein;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_zxbzs;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;

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

@@ -56,39 +56,26 @@ namespace UAS_LabelMachine
         /// <summary>
         /// 当前品牌
         /// </summary>
-        string Brand;
         string PI_ID;
         /// <summary>
-        /// 当前扫描的项目
-        /// </summary>
-        int CurrentItemIndex = 0;
-        /// <summary>
         /// 当前扫描的所在行
         /// </summary>
         int CurrentRowIndex = 0;
         /// <summary>
-        /// 最大的出入口单号
-        /// </summary>
-        int MaxOutBoxCode = 1;
-        /// <summary>
         /// 正则表达式用于项目匹配
         /// </summary>
         Regex reg;
-        /*标识供应商物料编号采集是否通过*/
-        bool CollectVeProdCodePass = true;
-
-        bool CollectQTYPass = true;
 
         bool logout = false;
 
-        //每个不同序号存在的
-        object[] ItemData;
 
         DataTable SingleLabelParam;
         DataTable MidLabelParam;
         DataTable OutLabelParam;
 
-        Dictionary<string, string> CollectData;
+        //主表数据源
+        DataTable LabelInfDataTable;
+
         //缓存单盘数据数据的DataTable
         DataTable SingleBoxCacheData;
         /// <summary>
@@ -119,18 +106,10 @@ namespace UAS_LabelMachine
         /// 是否全选
         /// </summary>
         bool AllChecked = false;
-        /// <summary>
-        /// 是否获取过箱号
-        /// </summary>
-        bool GetPackingCode = false;
-        /*用于存放采集项目的Grid信息*/
-        Dictionary<string, Dictionary<string, string>> SiItem;
+
         int CloumnCount = 0;
         /*需要重绘的Cell*/
         Dictionary<DataGridViewCell, bool> PaintCell = new Dictionary<DataGridViewCell, bool>();
-        //使用二维数组进行排序
-        ArrayList<ArrayList<string>> ScanData;
-        ArrayList<string> GetData;
         /// <summary>
         /// 是否通过选择Combox来改变打开的文件
         /// </summary>
@@ -142,6 +121,12 @@ namespace UAS_LabelMachine
 
         List<string> OutParam = new List<string>();
 
+        string CurrentPrCode = "";
+
+        string CurrentZXBZ = "";
+
+        string CurrentUnit = "";
+
         public UAS_出货标签打印(string Master)
         {
             InitializeComponent();
@@ -174,14 +159,13 @@ namespace UAS_LabelMachine
             //将本地读取的打印机设置进Combox,并选中默认打印机
             MidBoxCacheData = new DataTable();
             SingleBoxCacheData = new DataTable();
-           
+
             Point pt = new Point();
             //禁止所有列的排序
             foreach (DataGridViewColumn dgv in LabelInf.Columns)
             {
                 dgv.SortMode = DataGridViewColumnSortMode.NotSortable;
             }
-            Input.Focus();
             int ScreenWidth = Screen.GetWorkingArea(pt).Width;
             //设置获取当前屏幕大小自动全屏但是保留任务栏
             Rectangle ScreenArea = Screen.GetWorkingArea(this);
@@ -251,22 +235,6 @@ namespace UAS_LabelMachine
             }
         }
 
-        /// <summary>
-        /// 保存明细
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void SaveGrid_Click(object sender, EventArgs e)
-        {
-            DataTable savedt = (LabelInf.DataSource as DataTable);
-            if (savedt != null && savedt.GetChanges() != null)
-            {
-                MidSource.EndEdit();
-                dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
-                MessageBox.Show("保存成功!");
-            }
-        }
-
         //输入框Enter事件
         private void Input_KeyDown(object sender, KeyEventArgs e)
         {
@@ -278,6 +246,7 @@ namespace UAS_LabelMachine
                     return;
                 }
                 CollectInputData();
+                Input.Clear();
             }
         }
 
@@ -288,6 +257,11 @@ namespace UAS_LabelMachine
         {
             Dictionary<string, string> Data = new Dictionary<string, string>();
             string[] SplitData = Input.Text.Split('*');
+            if (SplitData.Length < 6)
+            {
+                MessageBox.Show("数据格式错误,无法解析");
+                return;
+            }
             for (int i = 0; i < SplitData.Length; i++)
             {
                 switch (i.ToString())
@@ -317,42 +291,42 @@ namespace UAS_LabelMachine
                         break;
                 }
             }
-            string[] PIBID = dh.GetSEQ("prodiobarcode_seq",10);
+            int CodeCount = 0;
+            //如果单位是KPCS则需要除1000
+            if (CurrentUnit == "KPCS")
+                CodeCount = int.Parse(Data["QTY"]) / 1000 / int.Parse(CurrentZXBZ);
+            else
+                CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
+            string pib_barcode = Data.ContainsKey("SERIAL") ? Data["SERIAL"] : "";
+            //获取ID
+            string[] PIBID = dh.GetSEQ("prodiobarcode_seq", CodeCount);
+            string pib_outboxcode2 = "";
+            if (OutBoxNum.Text == "新增")
+            {
+                string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
+                //如果没有则从开始插入
+                if (maxoutbox == "")
+                {
+                    pib_outboxcode2 = "1";
+                }
+                else
+                {
+                    pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
+                }
+            }
+            else pib_outboxcode2 = OutBoxNum.Text;
             sql.Clear();
             sql.Append("insert into prodiobarcode(PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_PDNO, PIB_PDID,PIB_PICLASS,");
-            sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_OUTBOXCODE2,pib_custoutboxcode,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO) ");
-            sql.Append("select prodiobarcode_seq.nextval,pd_prodcode,sysdate,pi_inoutno,pi_id,pd_pdno,pd_id,pi_class,");
-            sql.Append("'','','','','','','',0,0,v_pd_ordercode,pd_pocode ");
-            sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid where pi_id='" + PI_ID + "'");
-            dh.BatchInsert(sql.ToString(), new string[] { });
-        }
-
-        /// <summary>
-        /// 根据物料资料的参数设置外箱容量
-        /// </summary>
-        /// <param name="pr_code"></param>
-        private void SetOutBoxCapacity(string pr_code)
-        {
-            DataTable temp = (DataTable)dh.ExecuteSql("select pr_qtyperplace,pr_zxbzs from product where pr_code='" + pr_code + "'", "select");
-            if (temp.Rows.Count > 0)
-            {
-                //try { OutboxCapacity.Value = (decimal)temp.Rows[0]["pr_qtyperplace"] / (decimal)temp.Rows[0]["pr_zxbzs"]; }
-                //catch (Exception) { }
-            }
-        }
-
-        //设置行的索引到当前需要采集的行
-        private void SetRowIndexToCollectRow()
-        {
-            //获取当前需要采集的行
-            for (int i = CurrentRowIndex; i < LabelInf.RowCount; i++)
+            sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,PIB_OUTBOXCODE1,PIB_OUTBOXCODE2,pib_custoutboxcode,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO) ");
+            sql.Append("select :PIB_ID,pd_prodcode,sysdate,pi_inoutno,pi_id,pd_pdno,pd_id,pi_class,");
+            sql.Append("'" + pib_barcode + "','','','','" + pib_outboxcode2 + "','',0,pd_ordercode,pd_pocode ");
+            sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid where pi_id='" + PI_ID + "' and pd_prodcode='" + CurrentPrCode + "'");
+            dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID" }, PIBID);
+            LoadGridData(new object(), new EventArgs());
+            //加载完数据之后进行容量的判断
+            if (LabelInfDataTable.Select("pib_outboxcode2='" + OutBoxNum.Text + "'").Length > OutboxCapacity.Value)
             {
-                if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                {
-                    griddetno.Text = LabelInf.Rows[i].Cells["pib_pdno"].FormattedValue.ToString();
-                    CurrentRowIndex = LabelInf.Rows[i].Cells["pib_prodcode"].RowIndex;
-                    break;
-                }
+                MessageBox.Show("箱号" + OutBoxNum.Text + "超出容量");
             }
         }
 
@@ -425,162 +399,6 @@ namespace UAS_LabelMachine
                 SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
                 SingleDoc.PrintDocument();
             }
-            LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
-        }
-
-        /// <summary>
-        /// 提醒用户当前采集的项目
-        /// </summary>
-        private void RemindUser()
-        {
-            SetRowIndexToCollectRow();
-            if (ScanData.ToArray().Length > 0)
-            {
-                object[] arr = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();
-                string Inf = "";
-                for (int i = 0; i < arr.Length; i++)
-                {
-                    Inf += arr[i] + "  ";
-                }
-            }
-        }
-
-        //
-        /// <summary>
-        /// 设置外箱号
-        /// </summary>
-        /// <param name="BatchCollect">是否批量采集</param>
-        private void SetOutBoxCode2(bool BatchCollect)
-        {
-            if (OutboxCapacity.Value != 0)
-            {
-                //获取当前出入口单最大的外箱号
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    string outboxcode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                    if (outboxcode.Contains("-"))
-                    {
-                        if (int.Parse(outboxcode.Split('-')[0] == "" ? "1" : outboxcode.Split('-')[0]) > MaxOutBoxCode)
-                            MaxOutBoxCode = int.Parse(outboxcode.Split('-')[0]);
-                    }
-                    else
-                    {
-                        if (int.Parse(outboxcode == "" ? "0" : outboxcode) > MaxOutBoxCode)
-                            MaxOutBoxCode = int.Parse(outboxcode);
-                    }
-                }
-                //统计最大的箱号存在多少
-                int MaxOutBoxCodeCount = 0;
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    if (LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString() == MaxOutBoxCode.ToString())
-                        MaxOutBoxCodeCount = MaxOutBoxCodeCount + 1;
-                }
-                //如果是获取过包装单的话则不再继续追加箱号
-                if (!GetPackingCode)
-                {
-                    //如果箱内的盒数量小于容量,继续使用此箱号赋值,否则箱号+1
-                    if (BatchCollect)
-                    {
-                        if (MaxOutBoxCodeCount < OutboxCapacity.Value)
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        else
-                        {
-                            MaxOutBoxCode = MaxOutBoxCode + 1;
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        }
-                    }
-                    else
-                    {
-                        if (MaxOutBoxCodeCount <= OutboxCapacity.Value)
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        else
-                        {
-                            MaxOutBoxCode = MaxOutBoxCode + 1;
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        }
-                    }
-                }
-            }
-        }
-
-        /// <summary>
-        /// 自定义函数 根据匹配规则
-        /// si_item的二维数组,str是需要赋值的字符串,item表示DateCode,LotNo等
-        /// </summary>
-        /// <param name="SiItem"></param>
-        /// <param name="str"></param>
-        /// <param name="item"></param>
-        /// <returns></returns>
-        private string MatchStr(string str, string item)
-        {
-            string kind = SiItem[item]["si_kind"];
-            //起始字符不为空的时候
-            switch (kind)
-            {
-                case "起始位置":
-                    if (SiItem[item]["si_index"] != "")
-                    {
-                        try
-                        {
-                            //长度不为空的时候按照指定的长度去取数据
-                            if (SiItem[item]["si_length"] != "")
-                                str = str.Substring(int.Parse(SiItem[item]["si_index"]), int.Parse(SiItem[item]["si_length"]));
-                            //长度为空的时候取index之后的全部数据
-                            else
-                                str = str.Substring(int.Parse(SiItem[item]["si_index"]));
-                        }
-                        catch (Exception e) { LogManager.DoLog(e.StackTrace); }
-                    }
-                    break;
-                case "索引字符":
-                    try
-                    {
-                        if (SiItem[item]["si_indexstring"] != "")
-                        {
-                            //长度不为空的时候按照指定的长度去取数据
-                            if (SiItem[item]["si_length"] != "")
-                                str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
-                            //长度为空的时候取index之后的全部数据
-                            else
-                                str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
-                        }
-                    }
-                    catch (Exception e) { LogManager.DoLog(e.StackTrace); }
-                    break;
-                case "二次解析":
-                    if (SiItem[item]["si_indexstring"] != "")
-                    {
-                        //长度不为空的时候按照指定的长度去取数据
-                        if (SiItem[item]["si_length"] != "")
-                            str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
-                        //长度为空的时候取index之后的全部数据
-                        else
-                            str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
-                    }
-                    str = Analysis.AnalysisData(Brand, item, str);
-                    break;
-                case "全部":
-                    break;
-                default:
-                    break;
-            }
-            if (SiItem[item]["si_expression"] != "")
-            {
-                string log = "使用正则表达式" + SiItem[item]["si_expression"] + "匹配数据" + str;
-                reg = new Regex(SiItem[item]["si_expression"]);
-                try
-                {
-                    str = reg.Matches(str)[int.Parse(SiItem[item]["si_expressionitem"].ToString()) - 1].Value;
-                }
-                catch (Exception)
-                {
-
-                }
-                log += ",匹配后数据" + str;
-                LogManager.DoLog(log);
-            }
-            return str;
         }
 
         //关闭窗口前提示用户确认
@@ -690,6 +508,7 @@ namespace UAS_LabelMachine
                 OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
                 OutLabelParam.Merge(Attach);
             }
+            Input.Focus();
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
             Parallel.Invoke(GetSingleBoxData, GetMidBoxData);
@@ -712,11 +531,6 @@ namespace UAS_LabelMachine
                     pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
                     pi_date.Text = dt.Rows[0]["pi_date"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
-                    if (dh.GetConfig("AutoBarcode", "ProdInOut!Sale").ToString() != "")
-                    {
-                        string[] param = new string[] { PI_ID, "", "" };
-                        dh.CallProcedure("GetCustBarcode", param);
-                    }
                     LoadGridData(sender, e);
                     //重新输入单号后清除缓存
                     MidBoxArgument.Clear();
@@ -727,27 +541,13 @@ namespace UAS_LabelMachine
                     BaseUtil.CleanDataTable(SingleBoxCacheData);
                     MidIDAndOutboxcode.Clear();
                     SingleID.Clear();
-                    //刷新采集进度
-                    RefreshProcessData();
-                    //设置当前的最大箱号
-                    for (int i = 0; i < LabelInf.RowCount; i++)
-                    {
-                        string outboxcode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                        //如果包含有-,则需要解析
-                        if (outboxcode.Contains("-"))
-                            if (int.Parse(outboxcode.Split('-')[0] == "" ? "1" : outboxcode.Split('-')[0]) > MaxOutBoxCode)
-                                MaxOutBoxCode = int.Parse(outboxcode.Split('-')[0]);
-                        //else
-                        //if (int.Parse(outboxcode == "" ? "1" : outboxcode) > MaxOutBoxCode)
-                        //    MaxOutBoxCode = int.Parse(outboxcode);
-                    }
+                    //获取外箱数据
+                    OutBoxNum_Click(sender, new EventArgs());
                     LoadPrcodeData();
                     thread = new Thread(GetInOutInfAndLabelFile);
                     stw = new SetLoadingWindow(thread, "正在获取打印标签");
                     BaseUtil.SetFormCenter(stw);
                     stw.ShowDialog();
-                    //重置采集项次
-                    CurrentItemIndex = 0;
                     LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
                 }
                 else
@@ -794,7 +594,7 @@ namespace UAS_LabelMachine
                 {
                     if (!SingleID.Contains(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString()))
                         SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
+                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
                         //如果不存在中盒号则进行添加
                         if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
@@ -824,12 +624,6 @@ namespace UAS_LabelMachine
                                 outboxcode1.Add(LabelInf.Rows[i + 1].Cells["pib_outboxcode1"].Value.ToString(), true);
                         }
                     }
-                    //只要有一行没有采集满就不打印
-                    if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
-                    {
-                        if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                            outboxcode1[LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()] = false;
-                    }
                 }
                 //用于判断用户是否勾选了行
                 int CheckedRowCount = 0;
@@ -837,7 +631,7 @@ namespace UAS_LabelMachine
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     //勾选了并且未打印
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
+                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
                         CheckedRowCount = CheckedRowCount + 1;
                         CurrentRowIndex = i;
@@ -1100,7 +894,6 @@ namespace UAS_LabelMachine
                             for (int i = begin - 1; i < end; i++)
                             {
                                 LabelInf.Rows[i].Cells["Choose"].Value = true;
-                                LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
                                 LabelInf.Rows[i].Cells["pib_ifprint"].Value = false;
                             }
                         }
@@ -1584,7 +1377,6 @@ namespace UAS_LabelMachine
                     dh.BatchInsert("delete from prodiobarcode where pib_id=:pib_id", new string[] { "pib_id" }, DeleteID.ToArray());
                     MessageBox.Show("删除成功");
                     LoadGridData(sender, e);
-                    RefreshProcessData();
                 }
             }
             else
@@ -1604,41 +1396,6 @@ namespace UAS_LabelMachine
                 MessageBox.Show("未维护外箱标签");
         }
 
-        /// <summary>
-        /// 刷新采集进度
-        /// </summary>
-        private void RefreshProcessData()
-        {
-            if (LabelInf.Rows.Count > 0)
-            {
-                //设置初始化的采集进度
-                int Count = 0;
-                int CurrentMidBoxCollectedCount = 0;
-                //当前盒号的总盘数
-                int CurrentMidBoxTotalCount = 0;
-                //未超出当前范围的时候
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
-                        Count++;
-                    //和当前编辑箱号相等行
-                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
-                        CurrentMidBoxCollectedCount++;
-                    //当前盒号一共有几盘
-                    if (LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
-                        CurrentMidBoxTotalCount++;
-                }
-                Capacity.Text = "可装" + CurrentMidBoxTotalCount + "盘";
-                Installed.Text = "已装" + CurrentMidBoxCollectedCount + "盘";
-                //设置当前的箱号和盒号
-                Process_outboxcode.Text = LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value.ToString();
-                Process_midboxcode.Text = LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString();
-                //设置当前总数和已采集数量
-                TotalCount.Text = LabelInf.RowCount.ToString();
-                CollectedCount.Text = Count.ToString();
-            }
-        }
-
         private void LoadGridData()
         {
             LoadGridData(new object(), new EventArgs());
@@ -1654,26 +1411,16 @@ namespace UAS_LabelMachine
             AllCollect = false;
             sql.Clear();
             sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
-            sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
+            sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifprint,0)pib_ifprint");
             sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
             sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
             sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
-            dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-            MidSource.DataSource = dt;
-            BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
+            LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
             //有数据的话默认取第一条的品牌去取采集策略
             TotalCount.Text = LabelInf.RowCount.ToString();
-            //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
-            for (int i = 0; i < LabelInf.RowCount; i++)
-            {
-                if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                {
-                    griddetno.Text = LabelInf.Rows[i].Cells["pib_pdno"].FormattedValue.ToString();
-                    pib_id.Text = LabelInf.Rows[i].Cells["pib_id1"].FormattedValue.ToString();
-                    CurrentRowIndex = LabelInf.Rows[i].Cells["pib_prodcode"].RowIndex;
-                    break;
-                }
-            }
+            if (LabelInf.Rows.Count > 0)
+                LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
         }
 
         private void Refresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -1694,12 +1441,10 @@ namespace UAS_LabelMachine
                 bool FindDetno = false;
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
-                    if (LabelInf.Rows[i].Cells["pib_pdno"].Value.ToString() == griddetno.Text && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                    if (LabelInf.Rows[i].Cells["pib_pdno"].Value.ToString() == griddetno.Text)
                     {
                         FindDetno = true;
-                        CurrentItemIndex = 0;
                         CurrentRowIndex = i;
-                        RemindUser();
                         break;
                     }
                 }
@@ -1717,11 +1462,11 @@ namespace UAS_LabelMachine
             //判断所有盒号未该盒的是否勾选已采集
             for (int i = 0; i < LabelInf.RowCount; i++)
             {
-                if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
-                {
-                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                        FullBox = false;
-                }
+                //if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
+                //{
+                //    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                //        FullBox = false;
+                //}
             }
             //如果当前箱号已经装满了
             if (FullBox)
@@ -1776,54 +1521,6 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void GetOutBoxCode_Click(object sender, EventArgs e)
-        {
-            if (dh.GetConfig("UsingPacking", "ProdInOut!Sale").ToString() != "")
-            {
-                int Current = 0;
-                sql.Clear();
-                sql.Append("select pr_qtyperplace,pd_qty,packingdetail.pd_cartonno,pr_zxbzs,packingdetail.pd_cartons from packingdetail left join packing on pd_piid=pi_id left join prodinout on ");
-                sql.Append("pi_packingcode=packing.pi_code left join product on pd_prodcode=pr_code where pi_inoutno='" + pi_inoutno.Text + "' order by pr_code,pd_detno");
-                dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                if (dt.Rows.Count > 0)
-                {
-                    try { OutboxCapacity.Value = (decimal)dt.Rows[0]["pr_qtyperplace"] / (decimal)dt.Rows[0]["pr_zxbzs"]; }
-                    catch (Exception) { }
-                }
-                try
-                {
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        int pd_qty = int.Parse(dt.Rows[i]["pd_qty"].ToString());
-                        int pr_zxbzs = int.Parse(dt.Rows[i]["pr_zxbzs"].ToString());
-                        int pd_cartons = int.Parse(dt.Rows[i]["pd_cartons"].ToString());
-                        for (int j = 0; j < pd_qty * pd_cartons / pr_zxbzs; j++)
-                        {
-                            LabelInf.Rows[Current].Cells["pib_outboxcode2"].Value = dt.Rows[i]["pd_cartonno"].ToString();
-                            Current++;
-                        }
-                    }
-                    GetPackingCode = true;
-                }
-                catch (Exception)
-                {
-                }
-            }
-            else
-            {
-                int BoxCode = 1;
-                for (int i = 0; i < LabelInf.Rows.Count; i++)
-                {
-                    LabelInf.Rows[i].Cells["pib_outboxcode2"].Value = BoxCode;
-                    if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) % OutboxCapacity.Value == 0)
-                    {
-                        BoxCode = BoxCode + 1;
-                    }
-                }
-            }
-            SaveGrid_Click(sender, e);
-        }
-
         private void LogingOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
         {
             string close = MessageBox.Show(this.ParentForm, "是否注销", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
@@ -1934,13 +1631,13 @@ namespace UAS_LabelMachine
             if (result == DialogResult.OK)
             {
                 ExcelHandler eh = new ExcelHandler();
-                DataTable dt = ((DataTable)MidSource.DataSource).Copy();
+                DataTable dt = LabelInfDataTable.Copy();
                 for (int i = dt.Columns.Count - 1; i >= 0; i--)
                 {
                     for (int j = 0; j < LabelInf.Columns.Count; j++)
                     {
                         //去除ID列
-                        if (dt.Columns[i].ColumnName.ToLower().Contains("id") || dt.Columns[i].ColumnName.ToLower() == "pib_barcode" || dt.Columns[i].ColumnName.ToLower() == "pib_pdno" || dt.Columns[i].ColumnName.ToLower() == "pib_ifpick" || dt.Columns[i].ColumnName.ToLower() == "pib_ifprint" || dt.Columns[i].ColumnName.ToLower() == "pib_datecode1" || dt.Columns[i].ColumnName.ToLower() == "pr_vendprodcode")
+                        if (dt.Columns[i].ColumnName.ToLower().Contains("id") || dt.Columns[i].ColumnName.ToLower() == "pib_barcode" || dt.Columns[i].ColumnName.ToLower() == "pib_pdno" || dt.Columns[i].ColumnName.ToLower() == "pib_ifprint" || dt.Columns[i].ColumnName.ToLower() == "pib_datecode1" || dt.Columns[i].ColumnName.ToLower() == "pr_vendprodcode")
                         {
                             dt.Columns.RemoveAt(i);
                             break;
@@ -2008,7 +1705,13 @@ namespace UAS_LabelMachine
 
         private void LoadPrcodeData()
         {
-            GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select distinct pib_prodcode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_prodcode", "select");
+            GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_prodcode,pd_brand,pjd_zxbzs_user,pr_unit 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 pjd_prodcode", "select");
+            if (GridPrcode.Rows.Count > 0)
+            {
+                CurrentPrCode = GridPrcode.Rows[0].Cells["pd_prodcode"].Value.ToString();
+                CurrentZXBZ = GridPrcode.Rows[0].Cells["pjd_zxbzs_user"].Value.ToString();
+                CurrentUnit = GridPrcode.Rows[0].Cells["pr_unit"].Value.ToString();
+            }
         }
 
         private void GridPrcode_CellClick(object sender, DataGridViewCellEventArgs e)
@@ -2016,21 +1719,9 @@ namespace UAS_LabelMachine
             //用户在重新勾选后重置采集项目的索引
             if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
             {
-                CurrentItemIndex = 0;
-                DataGridViewSelectedRowCollection col = LabelInf.SelectedRows;
-                for (int i = 0; i < col.Count; i++)
-                {
-                    col[i].Selected = false;
-                }
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    if (GridPrcode.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
-                    {
-                        CurrentRowIndex = i;
-                        LabelInf.Rows[i].Selected = true;
-                        break;
-                    }
-                }
+                CurrentPrCode = GridPrcode.Rows[e.RowIndex].Cells["pd_prodcode"].ToString();
+                CurrentZXBZ = GridPrcode.Rows[e.RowIndex].Cells["pjd_zxbzs_user"].ToString();
+                CurrentUnit = GridPrcode.Rows[e.RowIndex].Cells["pr_unit"].ToString();
             }
         }
 
@@ -2050,5 +1741,20 @@ namespace UAS_LabelMachine
                 SetPrintStatus_label.Text = "暂停打印";
             }
         }
+
+        private void OutBoxNum_Click(object sender, EventArgs e)
+        {
+            OutBoxNum.Items.Clear();
+            DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_outboxcode2", "select");
+            ItemObject io = new ItemObject("新增", "新增");
+            OutBoxNum.Items.Add(io);
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                string pib_outboxcode2 = dt.Rows[i]["pib_outboxcode2"].ToString();
+                io = new ItemObject(pib_outboxcode2, pib_outboxcode2);
+                OutBoxNum.Items.Add(io);
+            }
+            OutBoxNum.SelectedIndex = OutBoxNum.Items.Count - 1;
+        }
     }
 }

+ 9 - 3
UAS-出货标签管理(泽天)/UAS_出货标签管理.resx

@@ -129,13 +129,19 @@
   <metadata name="pd_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_madein.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pr_zxbzs.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pd_brand.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pjd_zxbzs_user.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_madein.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_zxbzs.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="pib_custbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">