Procházet zdrojové kódy

获取箱号通过存储过程获取

章政 před 8 roky
rodič
revize
370fcdc562

+ 33 - 8
UAS-MES/CustomControl/TextBoxWithIcon/TextBoxGeneratePaCode.cs

@@ -39,18 +39,46 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
             }
         }
 
-        private string errorMsg;
+        private string MakeCode1;
+        private string Caller1;
+        private string ProdCode1;
 
-        public string ErrorMsg
+        public string MakeCode
         {
             get
             {
-                return errorMsg;
+                return MakeCode1;
             }
 
             set
             {
-                errorMsg = value;
+                MakeCode1 = value;
+            }
+        }
+
+        public string Caller
+        {
+            get
+            {
+                return Caller1;
+            }
+
+            set
+            {
+                Caller1 = value;
+            }
+        }
+
+        public string ProdCode
+        {
+            get
+            {
+                return ProdCode1;
+            }
+
+            set
+            {
+                ProdCode1 = value;
             }
         }
 
@@ -58,10 +86,7 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
         {
             IconClick?.Invoke(sender, new EventArgs());
             //如果未实现则继续
-            if (pr_id != "" && pr_id != null)
-            {
-                enterTextBox1.Text = LogicHandler.GetOutBoxCode(pr_id, "2");
-            }
+            enterTextBox1.Text = LogicHandler.GetOutBoxCode(Caller1, MakeCode1, ProdCode1, Entity.User.UserLineCode);
         }
 
         //定义委托

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -176,7 +176,7 @@ namespace UAS_MES.Make
                                 if (RemainIndex == ListA.Rows.Count)
                                 {
                                     OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的工单已经采集完成\n", Color.Green);
-                                    Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, code.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
+                                    Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
                                     RemainIndex = 0;
                                     if (LogicHandler.UpdateMakeMessage(ms_sncode.Text, ms_makecode.Text, "彩盒上料打印", User.UserSourceCode, User.UserCode, "上料成功", out ErrorMessage))
                                     {

+ 0 - 1
UAS-MES/FunctionCode/Make/Make_NewPallet.Designer.cs

@@ -83,7 +83,6 @@
             // 
             // pa_outboxcode
             // 
-            this.pa_outboxcode.ErrorMsg = null;
             this.pa_outboxcode.Location = new System.Drawing.Point(96, 151);
             this.pa_outboxcode.Name = "pa_outboxcode";
             this.pa_outboxcode.Pr_id = null;

+ 6 - 4
UAS-MES/FunctionCode/Make/Make_NewPallet.cs

@@ -13,22 +13,24 @@ namespace UAS_MES.Make
         //生成的箱类型,2表示大箱号,3表示栈板号
         string pa_type = "";
 
-        public Make_NewPallet(string Caller)
+        public Make_NewPallet(string Caller,string MakeCode)
         {
             InitializeComponent();
             switch (Caller)
             {
-                case "Make!BigBoxWeigh":
+                case "PACKAGE":
                     title.Text = "新增大箱号";
                     pa_type = "2";
                     break;
-                case "Make!PalletWeigh":
+                case "PALLET":
                     title.Text = "新增栈板号";
                     pa_type = "3";
                     break;
                 default:
                     break;
             }
+            pa_outboxcode.Caller = Caller;
+            pa_outboxcode.MakeCode = MakeCode;
         }
 
         private void 新增栈板_Load(object sender, EventArgs e)
@@ -49,7 +51,7 @@ namespace UAS_MES.Make
 
         private void pr_code_UserControlTextChanged(object sender, EventArgs e)
         {
-            pa_outboxcode.Pr_id = dh.getFieldDataByCondition("product", "pr_id", "pr_code='" + pr_code.Text + "'").ToString();
+            pa_outboxcode.ProdCode = pr_code.Text;
         }
 
         private void pa_outboxcode_IconClick(object sender, EventArgs e)

+ 0 - 17
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -46,7 +46,6 @@
             this.pa_id = new System.Windows.Forms.Label();
             this.PrintLabel = new System.Windows.Forms.ComboBox();
             this.label3 = new System.Windows.Forms.Label();
-            this.pr_id = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.PrintNum = new System.Windows.Forms.NumericUpDown();
             this.pa_outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxGeneratePaCode();
@@ -250,19 +249,6 @@
             this.label3.TabIndex = 160;
             this.label3.Text = "打印标签";
             // 
-            // pr_id
-            // 
-            this.pr_id.AutoSize = true;
-            this.pr_id.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_id.Location = new System.Drawing.Point(964, 79);
-            this.pr_id.Name = "pr_id";
-            this.pr_id.Size = new System.Drawing.Size(47, 21);
-            this.pr_id.TabIndex = 161;
-            this.pr_id.Tag = "pr_id";
-            this.pr_id.Text = "pr_id";
-            this.pr_id.Visible = false;
-            this.pr_id.TextChanged += new System.EventHandler(this.pr_id_TextChanged);
-            // 
             // label2
             // 
             this.label2.AutoSize = true;
@@ -288,7 +274,6 @@
             // 
             // pa_outboxcode
             // 
-            this.pa_outboxcode.ErrorMsg = null;
             this.pa_outboxcode.Location = new System.Drawing.Point(109, 54);
             this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4);
             this.pa_outboxcode.Name = "pa_outboxcode";
@@ -535,7 +520,6 @@
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.label2);
-            this.Controls.Add(this.pr_id);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.PrintLabel);
             this.Controls.Add(this.PrintList);
@@ -611,7 +595,6 @@
         private CustomControl.ComBoxWithFocus.PrinterCombox PrintList;
         private System.Windows.Forms.ComboBox PrintLabel;
         private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label pr_id;
         private System.Windows.Forms.Label label2;
         private CustomControl.TextBoxWithIcon.TextBoxGeneratePaCode pa_outboxcode;
         private System.Windows.Forms.NumericUpDown PrintNum;

+ 3 - 5
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -273,6 +273,9 @@ namespace UAS_MES.Make
 
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
+            pa_outboxcode.MakeCode = ma_code.Text;
+            pa_outboxcode.ProdCode = pr_code.Text;
+            pa_outboxcode.Caller = "PACKAGE";
             dt = (DataTable)dh.ExecuteSql("select pl_labelcode||':'||pl_labelname pl_laname,pl_labelname,pl_labelcode,pl_labelurl,pl_indate from productlabel where pl_prodcode='" + pr_code.Text + "' order by pl_isdefault desc ", "select");
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "pl_laname";
@@ -286,11 +289,6 @@ namespace UAS_MES.Make
             }
         }
 
-        private void pr_id_TextChanged(object sender, EventArgs e)
-        {
-            pa_outboxcode.Pr_id = pr_id.Text;
-        }
-
         private void 包装采集_FormClosing(object sender, FormClosingEventArgs e)
         {
             lbl.Quit();

+ 0 - 15
UAS-MES/FunctionCode/Make/Make_PackageCollection.resx

@@ -395,19 +395,4 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_outboxcode1.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="pa_indate.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>
 </root>

+ 3 - 3
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -59,7 +59,7 @@ namespace UAS_MES.Make
                     SearchPallet.Text = "大箱查询";
                     CheckOutBoxCondition = " pa_type=1 ";
                     break;
-                case "Make!PalletWeigh":
+                case "Make!PalletCollection":
                     palletcode_label.Text = "栈板号";
                     pa_type = "3";
                     pl_labeltype1 = "栈板标";
@@ -90,7 +90,7 @@ namespace UAS_MES.Make
                 sql.Append("select pa_prodcode,nvl(pd_barcode,PD_INNERBOXCODE) code ,pd_innerqty,");
                 sql.Append("pa_salecode,pa_makecode,pa_custcode,pa_packageqty  from package left join product ");
                 sql.Append("on pr_code=pa_prodcode left join  packagedetail on pd_paid=pa_id  where ");
-                sql.Append("pa_outboxcode='" + palletcode.Text + "' and pa_type=" + pa_type);
+                sql.Append("pa_outboxcode='" + palletcode.Text + "' and pa_type='" + pa_type+"'");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -190,7 +190,7 @@ namespace UAS_MES.Make
 
         private void NewPallet_Click(object sender, EventArgs e)
         {
-            Make_NewPallet NewPallet = new Make_NewPallet(Tag.ToString());
+            Make_NewPallet NewPallet = new Make_NewPallet("PALLET",pa_makecode.Text);
             BaseUtil.SetFormCenter(NewPallet);
             NewPallet.ShowDialog();
         }

+ 5 - 30
UAS-MES/PublicMethod/LogicHandler.cs

@@ -1381,43 +1381,18 @@ namespace UAS_MES.PublicMethod
             return dh.getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
         }
 
-        private static string lpad(int length, string number)
-        {
-            while (number.Length < length)
-            {
-                number = "0" + number;
-            }
-            number = number.Substring(number.Length - length, length);
-            return number;
-        }
-
         /// <summary>
         /// 获取箱号
         /// </summary>
         /// <param name="pr_id">物料主表的ID</param>
         /// <param name="kind">管控类型</param>
         /// <returns></returns>
-        public static string GetOutBoxCode(string pr_id, string kind)
+        public static string GetOutBoxCode(string Caller, string iMakeCode, string iProdCode, string iUserCode)
         {
-            StringBuilder code = new StringBuilder();
-            object pr_kind = dh.getFieldDataByCondition("product", "pr_tracekind", "pr_id=" + pr_id);
-            //if (pr_kind.ToString() != "")
-            //{
-            //if ((kind.Equals("1") && pr_kind.ToString() == "1") || (kind.Equals("2") && pr_kind.ToString() == "2"))
-            //{
-            // 单间管控或者批管控
-            DataTable dt = dh.getFieldsDataByCondition("barcodeSet", new string[] { "bs_id ,bs_lenprid,bs_lennum,bs_maxnum" }, "bs_type='PACK'");
-            if (dt.Rows.Count > 0)
-            {
-                code.Append(lpad(int.Parse(dt.Rows[0]["bs_lenprid"].ToString()), pr_id));// PR_ID物料ID的长度
-                code.Append(lpad(int.Parse(dt.Rows[0]["bs_lennum"].ToString()), dt.Rows[0]["bs_maxnum"].ToString()));// 当前流水号
-                dh.UpdateByCondition("barcodeSet", "bs_maxnum=bs_maxnum+1", "bs_type='PACK' and  bs_id=" + dt.Rows[0]["bs_id"]);// 流水号增加1
-            }
-            else BaseUtil.ShowError("未定义包装箱号产生规则或规则未审核");
-            //}
-            //else BaseUtil.ShowError("物料管控类型错误!该物料管控类型为不管控");
-            //}
-            return code.ToString();
+            string BoxCode="";
+            string[] param = new string[] { Caller, iMakeCode, iProdCode, iUserCode, BoxCode };
+            dh.CallProcedure("SP_GETPACKORPALLETCODE", ref param);
+            return param[4];
         }
     }
 }