Browse Source

包装连号问题处理

callm 6 days ago
parent
commit
6546bef829

+ 8 - 3
UAS_MES_HYSX/FunctionCode/Packing/Packing_PackageCollectionZX.cs

@@ -289,7 +289,7 @@ namespace UAS_MES_NEW.Packing
                                 return;
                             }
                         }
-                        if (locksalecode.Checked&&!CheckBoxNum(oMakeCode, sn_code.Text))
+                        if (locksalecode.Checked && !CheckBoxNum(oMakeCode, sn_code.Text))
                         {
                             OperateResult.AppendText("序列号" + sn_code.Text + "不在箱号装箱范围内,不允许采集\n", Color.Red);
                             return;
@@ -804,7 +804,7 @@ namespace UAS_MES_NEW.Packing
 
         private bool CheckBoxNum(string ma_code, string sncode)
         {
-            string maxbox = dh.getFieldDataByCondition("package", "max(pa_zxcode)", "pa_makecode='" + ma_code + "' and pa_type=1").ToString();
+            string maxbox = dh.getFieldDataByCondition("package left join source on sc_code=pa_sccode", "max(pa_zxcode)", "pa_makecode='" + ma_code + "' and pa_type=1 and sc_linecode='" + User.UserLineCode + "'").ToString();
             int pr_outboxinnerqty = int.Parse(dh.getFieldDataByCondition("makeserial left join product on ms_prodcode=pr_code", "nvl(pr_outboxinnerqty,0)", "ms_makecode='" + ma_code + "' and ms_sncode='" + sncode + "'").ToString());
             int maxnum = 0;
             int currentnum = 0;
@@ -813,7 +813,8 @@ namespace UAS_MES_NEW.Packing
             {
                 maxnum = int.Parse(maxbox.Substring(maxbox.Length - 4));
             }
-            else {
+            else
+            {
                 maxnum = 0;
             }
             //当前序列号的流水
@@ -823,6 +824,10 @@ namespace UAS_MES_NEW.Packing
             {
                 return true;
             }
+            if (maxnum == 0 && currentnum > 1)
+            {
+                return true;
+            }
             return false;
         }
 

+ 18 - 0
UAS_MES_HYSX/FunctionCode/Packing/Packing_PalletCollectionZX.Designer.cs

@@ -84,6 +84,7 @@
             this.label7 = new System.Windows.Forms.Label();
             this.PrintList1 = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.label8 = new System.Windows.Forms.Label();
+            this.CheckBox = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.PackageInf)).BeginInit();
             this.SuspendLayout();
             // 
@@ -762,11 +763,27 @@
             this.label8.TabIndex = 214;
             this.label8.Text = "打印机1";
             // 
+            // CheckBox
+            // 
+            this.CheckBox.AutoSize = true;
+            this.CheckBox.Checked = true;
+            this.CheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.CheckBox.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CheckBox.ForeColor = System.Drawing.Color.Red;
+            this.CheckBox.Location = new System.Drawing.Point(1701, 299);
+            this.CheckBox.Margin = new System.Windows.Forms.Padding(6);
+            this.CheckBox.Name = "CheckBox";
+            this.CheckBox.Size = new System.Drawing.Size(138, 28);
+            this.CheckBox.TabIndex = 221;
+            this.CheckBox.Text = "连号检查";
+            this.CheckBox.UseVisualStyleBackColor = true;
+            // 
             // Packing_PalletCollectionZX
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1994, 1104);
+            this.Controls.Add(this.CheckBox);
             this.Controls.Add(this.PrintNum1);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.PrintSecond);
@@ -884,5 +901,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
+        private System.Windows.Forms.CheckBox CheckBox;
     }
 }

+ 16 - 8
UAS_MES_HYSX/FunctionCode/Packing/Packing_PalletCollectionZX.cs

@@ -141,8 +141,9 @@ namespace UAS_MES_NEW.Packing
                     {
                         BaseUtil.SetFormValue(this.Controls, dt);
                         pa_makecode.Text = dt.Rows[0]["pd_makecode"].ToString();
-                        if (!Cancel.Checked) {
-                            if (!CheckBoxNum())
+                        if (!Cancel.Checked)
+                        {
+                            if (!CheckBoxNum() && CheckBox.Checked)
                             {
                                 OperateResult.AppendText(">>采集箱号" + outboxcode.Text + "不连续\n", Color.Red, outboxcode);
                                 return;
@@ -218,7 +219,7 @@ namespace UAS_MES_NEW.Packing
                     }
                     if (!Cancel.Checked)
                     {
-                        if (!CheckBoxNum())
+                        if (!CheckBoxNum() && CheckBox.Checked)
                         {
                             OperateResult.AppendText(">>采集箱号" + outboxcode.Text + "不连续\n", Color.Red, outboxcode);
                             return;
@@ -401,7 +402,8 @@ namespace UAS_MES_NEW.Packing
                 dh.ExecuteSql("update package set pa_checkno='',pa_prodcode='',pa_packtype='',pa_salecode='',pa_makecode='',pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
             }
             BaseUtil.FillDgvWithDataTable(PackageInf, dt);
-            if (PackageInf.RowCount > 0) {
+            if (PackageInf.RowCount > 0)
+            {
                 PackageInf.FirstDisplayedScrollingRowIndex = PackageInf.RowCount - 1;
             }
         }
@@ -493,26 +495,32 @@ namespace UAS_MES_NEW.Packing
             }
             else OperateResult.AppendText(">>产品" + pa_prodcode.Text + "未维护打印标签\n", Color.Red);
         }
-
-
         private bool CheckBoxNum()
         {
-            string maxbox = dh.getFieldDataByCondition("packagedetail left join package on PD_INNERBOXCODE=pa_outboxcode", "max(pa_zxcode)", "pd_makecode='" + pa_makecode.Text + "'").ToString();
+            string maxbox = dh.getFieldDataByCondition("packagedetail left join package on PD_INNERBOXCODE=pa_outboxcode left join source on sc_code=pa_sccode", "max(pa_zxcode)", "pd_makecode='" + pa_makecode.Text + "' and sc_linecode='" + User.UserLineCode + "'").ToString();
+            //已经装箱的最大箱号
             int maxnum = 0;
+            //当前装箱的箱号流水
             int currentnum = 0;
             if (maxbox != "")
             {
                 maxnum = int.Parse(maxbox.Substring(maxbox.Length - 4));
             }
-            string currentbox = dh.getFieldDataByCondition("package", "(pa_zxcode)", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
+            string currentbox = dh.getFieldDataByCondition("package left join source on sc_code=pa_sccode", "(pa_zxcode)", "pa_outboxcode='" + outboxcode.Text + "' and sc_linecode='" + User.UserLineCode + "'").ToString();
             if (currentbox != "")
             {
                 currentnum = int.Parse(currentbox.Substring(currentbox.Length - 4));
             }
+            //如果和前面的箱号连续
             if ((maxnum + 1) == currentnum)
             {
                 return true;
             }
+            //如果是换线的话,比如从2001开始的流水
+            if (maxnum == 0 && currentnum > 1)
+            {
+                return true;
+            }
             //outboxcode.Text
             return false;
         }

+ 18 - 0
UAS_MES_HYSX/FunctionCode/Packing/Packing_PalletCollectionZX.resx

@@ -791,4 +791,22 @@
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pazxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>