Explorar el Código

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

章政 hace 8 años
padre
commit
10e99bf245

+ 71 - 74
UAS-MES/FunctionCode/Employee/Employee_Group.Designer.cs

@@ -28,22 +28,22 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Employee_Group));
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Employee_Group));
             this.ug_code_label = new System.Windows.Forms.Label();
             this.ug_name_label = new System.Windows.Forms.Label();
             this.UserGroupDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.NewGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.DeleteGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.Screen = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.ug_name = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
-            this.ug_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.ug_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ug_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ug_name1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.UserSetting = new System.Windows.Forms.DataGridViewLinkColumn();
             this.PowerSetting = new System.Windows.Forms.DataGridViewLinkColumn();
+            this.NewGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.DeleteGroup = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.Screen = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.ug_name = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.ug_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.UserGroupDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -51,10 +51,9 @@
             // 
             this.ug_code_label.AutoSize = true;
             this.ug_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ug_code_label.Location = new System.Drawing.Point(12, 30);
-            this.ug_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ug_code_label.Location = new System.Drawing.Point(9, 24);
             this.ug_code_label.Name = "ug_code_label";
-            this.ug_code_label.Size = new System.Drawing.Size(112, 27);
+            this.ug_code_label.Size = new System.Drawing.Size(90, 21);
             this.ug_code_label.TabIndex = 237;
             this.ug_code_label.Text = "用户组代码";
             // 
@@ -62,10 +61,9 @@
             // 
             this.ug_name_label.AutoSize = true;
             this.ug_name_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ug_name_label.Location = new System.Drawing.Point(352, 30);
-            this.ug_name_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ug_name_label.Location = new System.Drawing.Point(264, 24);
             this.ug_name_label.Name = "ug_name_label";
-            this.ug_name_label.Size = new System.Drawing.Size(72, 27);
+            this.ug_name_label.Size = new System.Drawing.Size(58, 21);
             this.ug_name_label.TabIndex = 239;
             this.ug_name_label.Text = "用户组";
             // 
@@ -79,14 +77,54 @@
             this.ug_name1,
             this.UserSetting,
             this.PowerSetting});
-            this.UserGroupDGV.Location = new System.Drawing.Point(12, 71);
-            this.UserGroupDGV.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.UserGroupDGV.Location = new System.Drawing.Point(9, 57);
+            this.UserGroupDGV.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.UserGroupDGV.Name = "UserGroupDGV";
             this.UserGroupDGV.RowTemplate.Height = 27;
-            this.UserGroupDGV.Size = new System.Drawing.Size(869, 598);
+            this.UserGroupDGV.Size = new System.Drawing.Size(652, 478);
             this.UserGroupDGV.TabIndex = 244;
             this.UserGroupDGV.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.UserGroupDGV_CellClick);
             // 
+            // ug_id
+            // 
+            this.ug_id.DataPropertyName = "ug_id";
+            this.ug_id.HeaderText = "ug_id";
+            this.ug_id.Name = "ug_id";
+            this.ug_id.Visible = false;
+            // 
+            // ug_code1
+            // 
+            this.ug_code1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ug_code1.DataPropertyName = "ug_code";
+            this.ug_code1.HeaderText = "用户组代码";
+            this.ug_code1.Name = "ug_code1";
+            // 
+            // ug_name1
+            // 
+            this.ug_name1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ug_name1.DataPropertyName = "ug_name";
+            this.ug_name1.HeaderText = "用户组";
+            this.ug_name1.Name = "ug_name1";
+            // 
+            // UserSetting
+            // 
+            this.UserSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.UserSetting.DataPropertyName = "UserSetting";
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.UserSetting.DefaultCellStyle = dataGridViewCellStyle1;
+            this.UserSetting.HeaderText = "成员设置";
+            this.UserSetting.Name = "UserSetting";
+            this.UserSetting.Width = 120;
+            // 
+            // PowerSetting
+            // 
+            this.PowerSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.PowerSetting.DataPropertyName = "PowerSetting";
+            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.PowerSetting.DefaultCellStyle = dataGridViewCellStyle2;
+            this.PowerSetting.HeaderText = "权限分配";
+            this.PowerSetting.Name = "PowerSetting";
+            // 
             // NewGroup
             // 
             this.NewGroup.AllPower = null;
@@ -95,13 +133,13 @@
             this.NewGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.NewGroup.Image = null;
             this.NewGroup.IsShowBorder = true;
-            this.NewGroup.Location = new System.Drawing.Point(743, 29);
-            this.NewGroup.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.NewGroup.Location = new System.Drawing.Point(557, 23);
+            this.NewGroup.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.NewGroup.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewGroup.MoveImage")));
             this.NewGroup.Name = "NewGroup";
             this.NewGroup.NormalImage = ((System.Drawing.Image)(resources.GetObject("NewGroup.NormalImage")));
             this.NewGroup.Power = null;
-            this.NewGroup.Size = new System.Drawing.Size(60, 32);
+            this.NewGroup.Size = new System.Drawing.Size(45, 26);
             this.NewGroup.TabIndex = 243;
             this.NewGroup.Tag = "ShowDialogWindow";
             this.NewGroup.Text = "新增";
@@ -116,13 +154,13 @@
             this.DeleteGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.DeleteGroup.Image = null;
             this.DeleteGroup.IsShowBorder = true;
-            this.DeleteGroup.Location = new System.Drawing.Point(821, 29);
-            this.DeleteGroup.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.DeleteGroup.Location = new System.Drawing.Point(616, 23);
+            this.DeleteGroup.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.DeleteGroup.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteGroup.MoveImage")));
             this.DeleteGroup.Name = "DeleteGroup";
             this.DeleteGroup.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteGroup.NormalImage")));
             this.DeleteGroup.Power = null;
-            this.DeleteGroup.Size = new System.Drawing.Size(60, 32);
+            this.DeleteGroup.Size = new System.Drawing.Size(45, 26);
             this.DeleteGroup.TabIndex = 242;
             this.DeleteGroup.Text = "删除";
             this.DeleteGroup.UseVisualStyleBackColor = false;
@@ -136,13 +174,13 @@
             this.Screen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Screen.Image = null;
             this.Screen.IsShowBorder = true;
-            this.Screen.Location = new System.Drawing.Point(667, 29);
-            this.Screen.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.Screen.Location = new System.Drawing.Point(500, 23);
+            this.Screen.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Screen.MoveImage = ((System.Drawing.Image)(resources.GetObject("Screen.MoveImage")));
             this.Screen.Name = "Screen";
             this.Screen.NormalImage = ((System.Drawing.Image)(resources.GetObject("Screen.NormalImage")));
             this.Screen.Power = null;
-            this.Screen.Size = new System.Drawing.Size(60, 32);
+            this.Screen.Size = new System.Drawing.Size(45, 26);
             this.Screen.TabIndex = 241;
             this.Screen.Text = "筛选";
             this.Screen.UseVisualStyleBackColor = false;
@@ -155,17 +193,17 @@
             this.ug_name.Condition = null;
             this.ug_name.DBTitle = null;
             this.ug_name.FormName = null;
-            this.ug_name.Location = new System.Drawing.Point(443, 30);
-            this.ug_name.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ug_name.Location = new System.Drawing.Point(332, 24);
+            this.ug_name.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.ug_name.Name = "ug_name";
             this.ug_name.Power = null;
             this.ug_name.ReturnData = null;
             this.ug_name.SelectField = null;
             this.ug_name.SetValueField = null;
-            this.ug_name.Size = new System.Drawing.Size(183, 26);
+            this.ug_name.Size = new System.Drawing.Size(137, 21);
             this.ug_name.TabIndex = 240;
             this.ug_name.TableName = null;
-            this.ug_name.Tag = "ug_code";
+            this.ug_name.Tag = "ug_name";
             this.ug_name.TextBoxEnable = true;
             // 
             // ug_code
@@ -175,64 +213,24 @@
             this.ug_code.Condition = null;
             this.ug_code.DBTitle = null;
             this.ug_code.FormName = null;
-            this.ug_code.Location = new System.Drawing.Point(139, 30);
-            this.ug_code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ug_code.Location = new System.Drawing.Point(104, 24);
+            this.ug_code.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.ug_code.Name = "ug_code";
             this.ug_code.Power = null;
             this.ug_code.ReturnData = null;
             this.ug_code.SelectField = null;
             this.ug_code.SetValueField = null;
-            this.ug_code.Size = new System.Drawing.Size(180, 26);
+            this.ug_code.Size = new System.Drawing.Size(135, 21);
             this.ug_code.TabIndex = 238;
             this.ug_code.TableName = null;
             this.ug_code.Tag = "ug_code";
             this.ug_code.TextBoxEnable = true;
             // 
-            // ug_id
-            // 
-            this.ug_id.DataPropertyName = "ug_id";
-            this.ug_id.HeaderText = "ug_id";
-            this.ug_id.Name = "ug_id";
-            this.ug_id.Visible = false;
-            // 
-            // ug_code1
-            // 
-            this.ug_code1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.ug_code1.DataPropertyName = "ug_code";
-            this.ug_code1.HeaderText = "用户组代码";
-            this.ug_code1.Name = "ug_code1";
-            // 
-            // ug_name1
-            // 
-            this.ug_name1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.ug_name1.DataPropertyName = "ug_name";
-            this.ug_name1.HeaderText = "用户组";
-            this.ug_name1.Name = "ug_name1";
-            // 
-            // UserSetting
-            // 
-            this.UserSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.UserSetting.DataPropertyName = "UserSetting";
-            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.UserSetting.DefaultCellStyle = dataGridViewCellStyle1;
-            this.UserSetting.HeaderText = "成员设置";
-            this.UserSetting.Name = "UserSetting";
-            this.UserSetting.Width = 120;
-            // 
-            // PowerSetting
-            // 
-            this.PowerSetting.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.PowerSetting.DataPropertyName = "PowerSetting";
-            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.PowerSetting.DefaultCellStyle = dataGridViewCellStyle2;
-            this.PowerSetting.HeaderText = "权限分配";
-            this.PowerSetting.Name = "PowerSetting";
-            // 
             // Employee_Group
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(959, 695);
+            this.ClientSize = new System.Drawing.Size(719, 556);
             this.Controls.Add(this.UserGroupDGV);
             this.Controls.Add(this.NewGroup);
             this.Controls.Add(this.DeleteGroup);
@@ -242,7 +240,6 @@
             this.Controls.Add(this.ug_code);
             this.Controls.Add(this.ug_code_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Employee_Group";
             this.Tag = "Employee!Data";
             this.Text = "人员资料";

+ 17 - 0
UAS-MES/FunctionCode/Employee/Employee_Group.cs

@@ -16,6 +16,9 @@ namespace UAS_MES.Employee
 
         DataTable dt;
 
+        DataTable Dbfind;
+        DataTable Dbfind1;
+
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
         public Employee_Group()
@@ -40,16 +43,30 @@ namespace UAS_MES.Employee
             ug_code.TableName = "CS$USERGROUP";
             ug_code.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
             ug_code.SetValueField = new string[] { "ug_code" };
+            ug_code.DbChange += Ug_code_Dbchage;
 
             ug_name.FormName = Name;
             ug_name.TableName = "CS$USERGROUP";
             ug_name.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
             ug_name.SetValueField = new string[] { "ug_name" };
+            ug_name.DbChange += Ug_name_Dbchage;
 
             ug_code.KeyDown += KeyDownEvent;
             ug_name.KeyDown += KeyDownEvent;
         }
 
+        private void Ug_name_Dbchage(object sender, EventArgs e)
+        {
+            Dbfind = ug_name.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
+        private void Ug_code_Dbchage(object sender, EventArgs e)
+        {
+            Dbfind1 = ug_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind1);
+        }
+
         private void 人员分组_SizeChanged(object sender, EventArgs e)
         {
             asc.controlAutoSize(this);

+ 8 - 0
UAS-MES/FunctionCode/Employee/Employee_Power.cs

@@ -25,6 +25,7 @@ namespace UAS_MES.Employee
         Thread thread;
 
         SetLoadingWindow stw;
+        DataTable Dbfind;
 
         ItemObject item;
 
@@ -69,6 +70,7 @@ namespace UAS_MES.Employee
             ug_code.TableName = "CS$USERGROUP";
             ug_code.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
             ug_code.SetValueField = new string[] { "ug_code" };
+            ug_code.DbChange += Ug_code_Dbchage;
             //由于需要额外添加一个全部值,需要手动添加Item
             dt = (DataTable)dh.ExecuteSql("select DISTINCT sn_module from CS$SYSNAVATION where sn_using=1", "select");
             item = new ItemObject("全部", "");
@@ -85,6 +87,12 @@ namespace UAS_MES.Employee
           
         }
 
+        private void Ug_code_Dbchage(object sender, EventArgs e)
+        {
+            Dbfind = ug_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
         private void Screen_Click(object sender, EventArgs e)
         {
             //拼接条件,获取按照用户输入条件的数据集

+ 9 - 0
UAS-MES/FunctionCode/Employee/Employee_PowerSarch.cs

@@ -18,6 +18,8 @@ namespace UAS_MES.Employee
 
         DataHelper dh;
 
+        DataTable Dbfind;
+
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
         LogStringBuilder sql = new LogStringBuilder();
@@ -35,6 +37,7 @@ namespace UAS_MES.Employee
             ug_code.TableName = "CS$USERGROUP";
             ug_code.SelectField = "ug_code # 分组编号,ug_name # 分组名称,ug_inman # 录入人,ug_indate #录入日期";
             ug_code.SetValueField = new string[] { "ug_code" };
+            ug_code.DbChange += Ug_code_Dbchage;
 
             dt = (DataTable)dh.ExecuteSql("select DISTINCT sn_module from CS$SYSNAVATION where sn_using=1", "select");
             ItemObject item = new ItemObject("全部", "");
@@ -47,6 +50,12 @@ namespace UAS_MES.Employee
             }
         }
 
+        private void Ug_code_Dbchage(object sender, EventArgs e)
+        {
+            Dbfind = ug_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
         private void 权限查看_SizeChanged(object sender, EventArgs e)
         {
             asc.controlAutoSize(this);

+ 16 - 15
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -174,24 +174,25 @@ namespace UAS_MES.Make
                         else if (step == 1)
                         {
                             OperateResult.AppendText(">>" + code.Text + "\n", Color.Black);
+                            //判断用户是否锁定输入SN长度,
+                            if (!checkLengthOrPre(SNLength_checkBox, SNLength, "长度", "SN"))
+                            {
+                                return;
+                            }
+                            //判断用户是否锁定输入SN前缀,
+                            if (!checkLengthOrPre(SNPre_checkBox, SNPre, "前缀", "SN"))
+                            {
+                                return;
+                            }
+                            //判断转换后序列号的范围是否合法
+                            if (!checkStartAndEnd())
+                            {
+                                OperateResult.AppendText(">>序列号" + code.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red, code);
+                                return;
+                            }
                             //开始录入SN
                             if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id='"+oMsid+"'"))||!dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "'"))
                             {
-                                //判断用户是否锁定输入SN长度,
-                                if (!checkLengthOrPre(SNLength_checkBox, SNLength, "长度", "SN"))
-                                {
-                                    return;
-                                }
-                                //判断用户是否锁定输入SN前缀,
-                                if (!checkLengthOrPre(SNPre_checkBox, SNPre, "前缀", "SN"))
-                                {
-                                    return;
-                                }
-                                //判断转换后序列号的范围是否合法
-                                if (!checkStartAndEnd()) {
-                                    OperateResult.AppendText(">>序列号" + code.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red,code);
-                                    return;
-                                }
                                 //SN校验成功,合法,记录下SN
                                 SN = code.Text;
                                 code.Text = "";

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

@@ -143,7 +143,7 @@ namespace UAS_MES.Make
                                         else
                                         //不为空,进行过转换。不勾选修改结果,就不能再修改
                                         {
-                                            OperateResult.AppendText(">>序列号" + sncode.Text + "错误,或者已经转换过\n", Color.Red,sncode);
+                                            OperateResult.AppendText(">>序列号" + sncode.Text + "已经转换过\n", Color.Red,sncode);
                                             OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
                                         }
                                         break;

+ 11 - 11
UAS-MES/FunctionCode/Packing/Packing_CartonTransfer.Designer.cs

@@ -58,7 +58,7 @@
             this.pr_code_label = new System.Windows.Forms.Label();
             this.pr_outboxinnerqty_label = new System.Windows.Forms.Label();
             this.pa_code_label = new System.Windows.Forms.Label();
-            this.button1 = new System.Windows.Forms.Button();
+            this.清除 = new System.Windows.Forms.Button();
             this.groupBoxWithBorder2.SuspendLayout();
             this.groupBoxWithBorder1.SuspendLayout();
             this.SuspendLayout();
@@ -420,22 +420,22 @@
             this.pa_code_label.TabIndex = 113;
             this.pa_code_label.Text = "原箱号";
             // 
-            // button1
+            // 清除
             // 
-            this.button1.Location = new System.Drawing.Point(608, 477);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(75, 23);
-            this.button1.TabIndex = 178;
-            this.button1.Text = "button1";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
+            this.清除.Location = new System.Drawing.Point(608, 477);
+            this.清除.Name = "清除";
+            this.清除.Size = new System.Drawing.Size(75, 23);
+            this.清除.TabIndex = 178;
+            this.清除.Text = "清除";
+            this.清除.UseVisualStyleBackColor = true;
+            this.清除.Click += new System.EventHandler(this.button1_Click);
             // 
             // Packing_CartonTransfer
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(910, 527);
-            this.Controls.Add(this.button1);
+            this.Controls.Add(this.清除);
             this.Controls.Add(this.sn_code);
             this.Controls.Add(this.sn_code_label);
             this.Controls.Add(this.OperateResult);
@@ -489,6 +489,6 @@
         private CustomControl.ValueLabel.ValueLabel pa_custcode;
         private CustomControl.ValueLabel.ValueLabel pa_type;
         private CustomControl.ValueLabel.ValueLabel pa_packtype;
-        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button 清除;
     }
 }

+ 156 - 50
UAS-MES/FunctionCode/Packing/Packing_CartonTransfer.cs

@@ -28,6 +28,17 @@ namespace UAS_MES.Packing
 
         DataHelper dh;
 
+        //目标箱号相关变量
+
+        string new_pa_downstatus;
+        string new_pa_currentqty;
+        string new_pa_standardqty;
+        string new_pa_packtype;
+        string new_pa_prodcode;
+        string new_pa_salecode;
+        string new_pa_checkno;
+        string new_ob_result;
+
         public Packing_CartonTransfer()
         {
             InitializeComponent();
@@ -79,47 +90,12 @@ namespace UAS_MES.Packing
                 }
                 else if (movepack.Checked)
                 {
-                    CheckBoxCode();       
+                    CheckBoxCode();
                 }
             }
         }
 
-        private Boolean CheckBoxCode()
-        {
-            sql.Clear();
-            sql.Append("select pa_id,pa_outboxcode,pa_standardqty,nvl(pa_currentqty,0) pa_currentqty,pa_prodcode,nvl(pa_downstatus,0) pa_downstatus from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
-            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            if (dt.Rows.Count > 0)
-            {
-                string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
-                string pa_currentqty = dt.Rows[0]["pa_currentqty"].ToString();
-                string pa_standardqty = dt.Rows[0]["pa_standardqty"].ToString();
-                if (pa_downstatus != "0")
-                {
-                    OperateResult.AppendText(">>该箱号" + pa_outboxcode.Text + "处于下地状态,不允许操作\n", Color.Red, pa_outboxcode);
-                    OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
-                    pa_outboxcode.Focus();
-                    return false;
 
-                }
-                else if (pa_currentqty == pa_standardqty)
-                {
-                    OperateResult.AppendText(">>目标箱号" + pa_outboxcode.Text + "已装满\n", Color.Red, pa_outboxcode);
-                    OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
-                    pa_outboxcode.Focus();
-                    return false;
-                }
-                BaseUtil.SetFormValue(this.Controls, dt);
-                return true;
-            }
-            else
-            {
-                OperateResult.AppendText(">>该箱号" + pa_outboxcode.Text + "不存在\n", Color.Red, pa_outboxcode);
-                OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
-                pa_outboxcode.Focus();
-                return false;
-            }
-        }
 
         private void sn_code_KeyDown(object sender, KeyEventArgs e)
         {
@@ -135,6 +111,8 @@ namespace UAS_MES.Packing
                     sql.Append("ms_checkno from makeserial where ms_id='" + ms_id + "'");
                     dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     string ms_outboxcode = dt1.Rows[0]["ms_outboxcode"].ToString();
+                    string msprodcode = dt1.Rows[0]["ms_prodcode"].ToString();
+                    string ms_makecode = dt1.Rows[0]["ms_msmakecode"].ToString();
                     if (ms_outboxcode != "")
                     {
                         sql.Clear();
@@ -142,13 +120,24 @@ namespace UAS_MES.Packing
                         dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         if (dtbar.Rows.Count > 0)
                         {
+                            string PA_PACKTYPE = dtbar.Rows[0]["PA_PACKTYPE"].ToString();
                             string pa_checkno = dtbar.Rows[0]["pa_checkno"].ToString();
                             string PA_DOWNSTATUS = dtbar.Rows[0]["PA_DOWNSTATUS"].ToString();
-                            string ob_result = dh.getFieldDataByCondition("oqcbatch","ob_result","ob_checkno = '"+ pa_checkno + "'").ToString();
+                            string old_pa_id = dtbar.Rows[0]["pa_id"].ToString();
+                            string ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_result", "ob_checkno = '" + pa_checkno + "'").ToString();
                             if (PA_DOWNSTATUS == "0")
                             {
                                 BaseUtil.SetFormValue(this.Controls, dtbar);
                                 BaseUtil.SetFormValue(this.Controls, dt1);
+                                if (PA_PACKTYPE == "MIX")
+                                {
+                                    ms_prodcode.Text = "混包";
+                                }
+                                else if (PA_PACKTYPE == "SALE")
+                                {
+                                    ms_msmakecode.Text = pa_salecode.Text;
+                                }
+
                                 if (newpack.Checked)
                                 {
                                     if (ob_result == "")
@@ -163,52 +152,126 @@ namespace UAS_MES.Packing
                                                     pa_outboxcode.Focus();
                                                     return;
                                                 }
-                                                else {
+                                                else
+                                                {
                                                     string pa_id = dh.GetSEQ("package_seq");
                                                     //新增箱
                                                     sql.Clear();
                                                     sql.Append("insert into package (PA_ID, PA_OUTBOXCODE,PA_PRODCODE, PA_PACKDATE,");
                                                     sql.Append("PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,");
                                                     sql.Append("PA_SALECODE,PA_CUSTCODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY)");
-                                                    sql.Append("values ('"+pa_id+"','" + pa_outboxcode.Text+"','"+ ms_prodcode.Text + "',sysdate,'"+pa_level.Text+"','0','0'");
-                                                    sql.Append(",'"+ ms_msmakecode.Text + "','0',sysdate,'"+pa_salecode.Text+"','"+pa_custcode.Text+"','"+pa_type.Text+"','0','"+ pa_packtype.Text + "','"+pa_standardqty.Text+"')");
+                                                    sql.Append("values ('" + pa_id + "','" + pa_outboxcode.Text + "','" + msprodcode + "',sysdate,'" + pa_level.Text + "','0','0'");
+                                                    sql.Append(",'" + ms_makecode + "','0',sysdate,'" + pa_salecode.Text + "','" + pa_custcode.Text + "','" + pa_type.Text + "','0','" + pa_packtype.Text + "','" + pa_standardqty.Text + "')");
                                                     dh.ExecuteSql(sql.GetString(), "insert");
+
                                                     sql.Clear();
                                                     sql.Append("insert into packagedetail (PD_ID,PD_PAID,PD_OUTBOXCODE,PD_BARCODE,PD_INNERQTY,PD_PRODCODE,PD_MAKECODE,PD_BUILDDATE,PD_YMD)");
-                                                    sql.Append("values (packagedetail_seq.nextval,'"+pa_id+"','"+ pa_outboxcode.Text + "','"+sn_code.Text+"','1','"+ ms_prodcode.Text + "','"+ ms_msmakecode.Text + "',sysdate,to_char(sysdate,'yymmdd'))");
+                                                    sql.Append("values (packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + sn_code.Text + "','1','" + msprodcode + "','" + ms_makecode + "',sysdate,to_char(sysdate,'yymmdd'))");
                                                     dh.ExecuteSql(sql.GetString(), "insert");
 
                                                     //更新原箱数量
                                                     dh.UpdateByCondition("package", "pa_currentqty=pa_currentqty-1", "pa_outboxcode = '" + ms_outboxcode + "'");
                                                     //更新目标箱数量
                                                     dh.UpdateByCondition("package", "pa_currentqty=1, pa_totalqty=1,pa_packageqty=1", "pa_outboxcode = '" + pa_outboxcode.Text + "'");
-                                                    dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'","ms_id = '"+ ms_id + "'");
-                                                    LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode,ms_msmakecode.Text,User.UserLineCode,User.UserSourceCode,"卡通箱转移", "卡通箱转移,生成目标箱号"+pa_outboxcode.Text+"",sn_code.Text,"");
-                                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_msmakecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:"+sn_code.Text+",从原箱号:"+ms_outboxcode+"转移至目标箱号:"+pa_outboxcode.Text+"", sn_code.Text, "");
-                                                    OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n",Color.Green);
+                                                    dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_id = '" + ms_id + "'");
+                                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "卡通箱转移,生成目标箱号" + pa_outboxcode.Text + "", sn_code.Text, "");
+                                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
+                                                    OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
                                                     movepack.Focus();
-                                                    pa_outboxcode_KeyDown(sender,e);
+                                                    pa_outboxcode_KeyDown(sender, e);
                                                 }
                                             }
-                                            else {
+                                            else
+                                            {
                                                 OperateResult.AppendText(">>必须填写新增目标箱号\n", Color.Red);
                                                 return;
                                             }
                                         }
-                                        else {
+                                        else
+                                        {
                                             OperateResult.AppendText(">>新增目标箱号必须填写标准容量\n", Color.Red);
                                             return;
                                         }
                                     }
-                                    else {
+                                    else
+                                    {
                                         OperateResult.AppendText(">>原箱" + ms_outboxcode + "处于送检状态,不允许转移\n", Color.Red, sn_code);
                                         return;
                                     }
                                 }
                                 else if (movepack.Checked)
                                 {
-                                    if (CheckBoxCode()) {
+                                    if (CheckBoxCode())
+                                    {
+                                        if (PA_PACKTYPE != new_pa_packtype)
+                                        {
+                                            OperateResult.AppendText(">>原箱" + ms_outboxcode + "和目标箱号" + pa_outboxcode.Text + "的包装方式不一致,不允许转移\n", Color.Red, sn_code);
+                                            return;
+                                        }
+                                        if (PA_PACKTYPE != "MIX")
+                                        {
+                                            if (ms_prodcode.Text != new_pa_prodcode)
+                                            {
+                                                OperateResult.AppendText(">>原箱号和目标箱号(目标箱产品编号" + new_pa_prodcode + ")的产品编号不一致,不允许转移\n", Color.Red, sn_code);
+                                                return;
+                                            }
+                                            if (PA_PACKTYPE != "SALE")
+                                            {
+                                                if (pa_salecode.Text != new_pa_salecode)
+                                                {
+                                                    OperateResult.AppendText(">>原箱号和目标箱号的合同号不一致,不允许转移\n", Color.Red, sn_code);
+                                                    return;
+                                                }
+                                            }
+                                        }
+                                        if (pa_checkno != new_pa_checkno)
+                                        {
+                                            if ((pa_checkno == "" && new_pa_checkno != "") || (pa_checkno != "" && new_pa_checkno == ""))
+                                            {
+                                                if (pa_checkno != "" && ob_result == "")
+                                                {
+                                                    OperateResult.AppendText(">>原箱号处于送检状态,不允许转移\n", Color.Red, sn_code);
+                                                    return;
+                                                }
+                                                if (new_pa_checkno != "" && new_pa_checkno == "")
+                                                {
+                                                    OperateResult.AppendText(">>目标箱号处于送检状态,不允许转移\n", Color.Red, sn_code);
+                                                    return;
+                                                }
+                                            }
+                                            if (pa_checkno != "" && new_pa_checkno != "")
+                                            {
+                                                string a_ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + pa_checkno + "'").ToString();
+                                                string b_ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + new_pa_checkno + "'").ToString();
+                                                if (!((a_ob_result == b_ob_result) && (b_ob_result == "OK" || b_ob_result == "NG")))
+                                                {
+                                                    OperateResult.AppendText(">>原箱号和目标箱号必须抽检完成,并且结果一致才可以转移\n", Color.Red, sn_code);
+                                                    return;
+                                                }
+                                            }
+                                        }
+                                        string new_laststepcode = dh.getFieldDataByCondition("packagedetail inner join makeserial on ms_outboxcode=pd_outboxcode and ms_sncode=pd_barcode and ms_prodcode = pd_prodcode", "max(nvl(ms_currentstepcode,ms_stepcode))", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                                        if (new_laststepcode != laststepcode.Text)
+                                        {
+                                            OperateResult.AppendText(">>目标箱号中的序列号最后所在工序与所录入序列号最后所在工序不一致\n", Color.Red, sn_code);
+                                            return;
+                                        }
 
+                                        //更新操作
+                                        sql.Clear();
+                                        sql.Append("insert into packagedetail (PD_ID,PD_PAID,PD_OUTBOXCODE,PD_BARCODE,PD_INNERQTY,PD_PRODCODE,PD_MAKECODE,PD_BUILDDATE,PD_YMD)");
+                                        sql.Append("values (packagedetail_seq.nextval,'" + old_pa_id + "','" + pa_outboxcode.Text + "','" + sn_code.Text + "','1','" + msprodcode + "','" + ms_makecode + "',sysdate,to_char(sysdate,'yymmdd'))");
+                                        dh.ExecuteSql(sql.GetString(), "insert");
+
+                                        //更新原箱数量
+                                        dh.UpdateByCondition("package", "pa_currentqty=pa_currentqty-1", "pa_outboxcode = '" + ms_outboxcode + "'");
+                                        //更新目标箱数量
+                                        dh.UpdateByCondition("package", "pa_currentqty=nvl(pa_currentqty,0)+ 1,pa_totalqty=nvl(pa_totalqty,0)+1,pa_packageqty=nvl(pa_packageqty ,0)+1", "pa_outboxcode = '" + pa_outboxcode.Text + "'");
+                                        dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_id = '" + ms_id + "'");
+                                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
+                                        OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
+                                        movepack.Focus();
+                                        pa_outboxcode_KeyDown(sender, e);
                                     }
                                 }
                             }
@@ -239,6 +302,49 @@ namespace UAS_MES.Packing
 
         }
 
+
+        private Boolean CheckBoxCode()
+        {
+            sql.Clear();
+            sql.Append("select pa_id,pa_outboxcode,pa_checkno,pa_standardqty,nvl(pa_currentqty,0) pa_currentqty,pa_packtype,pa_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_salecode from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
+            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                new_pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
+                new_pa_currentqty = dt.Rows[0]["pa_currentqty"].ToString();
+                new_pa_standardqty = dt.Rows[0]["pa_standardqty"].ToString();
+                new_pa_packtype = dt.Rows[0]["pa_packtype"].ToString();
+                new_pa_prodcode = dt.Rows[0]["pa_prodcode"].ToString();
+                new_pa_salecode = dt.Rows[0]["pa_salecode"].ToString();
+                new_pa_checkno = dt.Rows[0]["pa_checkno"].ToString();
+                new_ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_result", "ob_checkno = '" + new_pa_checkno + "'").ToString();
+                if (new_pa_downstatus != "0")
+                {
+                    OperateResult.AppendText(">>该目标箱号" + pa_outboxcode.Text + "处于下地状态,不允许操作\n", Color.Red, pa_outboxcode);
+                    OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
+                    pa_outboxcode.Focus();
+                    return false;
+
+                }
+                else if (new_pa_currentqty == new_pa_standardqty)
+                {
+                    OperateResult.AppendText(">>目标箱号" + pa_outboxcode.Text + "已装满\n", Color.Red, pa_outboxcode);
+                    OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
+                    pa_outboxcode.Focus();
+                    return false;
+                }
+                BaseUtil.SetFormValue(this.Controls, dt);
+                return true;
+            }
+            else
+            {
+                OperateResult.AppendText(">>该目标箱号" + pa_outboxcode.Text + "不存在\n", Color.Red, pa_outboxcode);
+                OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
+                pa_outboxcode.Focus();
+                return false;
+            }
+        }
+
         private void button1_Click(object sender, EventArgs e)
         {
             BaseUtil.CleanControls(this.Controls);