Browse Source

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

章政 8 years ago
parent
commit
29366b2e43

+ 25 - 35
UAS-MES/FunctionCode/Make/Make_PositionStock.cs

@@ -95,10 +95,11 @@ namespace UAS_MES.Make
                                 if (dt.Rows.Count > 0)
                                 {
                                     sql.Clear();
-                                    sql.Append("select mss_makecode,mss_linecode from makesourcestock where mss_barcode = '"+pr_batchnum.Text+"'");
+                                    sql.Append("select mss_makecode,mss_linecode from makesourcestock where mss_barcode = '" + pr_batchnum.Text + "'");
                                     DataTable BARCODE = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    if (BARCODE.Rows.Count > 0) {
-                                        OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "已经被工单:"+BARCODE.Rows[0]["mss_makecode"] +",线别:"+ BARCODE.Rows[0]["mss_linecode"] + "备料\n", Color.Red, pr_batchnum);
+                                    if (BARCODE.Rows.Count > 0)
+                                    {
+                                        OperateResult.AppendText(">>物料批号" + pr_batchnum.Text + "已经被工单:" + BARCODE.Rows[0]["mss_makecode"] + ",线别:" + BARCODE.Rows[0]["mss_linecode"] + "备料\n", Color.Red, pr_batchnum);
                                         return;
                                     }
                                     InsertMakeSourceStock(dt, int.Parse(bar_remain));
@@ -169,27 +170,14 @@ namespace UAS_MES.Make
         {
             if (!show_all_check.Checked)
             {
-                //string ma_linecode = dh.getFieldDataByCondition("make", "ma_linecode", "ma_code = '" + ma_code.Text + "'").ToString();
-                //if (User.UserLineCode == ma_linecode)
-                //{
-                    sql.Clear();
-                    sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,sp_fsoncode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
-                    sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
-                    sql.Append("pr_code=sp_mothercode left join makesourcestock on  mss_craftcode=sb_craftcode and mss_makecode='" + ma_code.Text + "' ");
-                    sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode left join make on ma_bomversion=sb_bomversion where sb_prodcode='" + ma_prodcode.Text + "' and sb_craftcode='" + ma_craftcode.Text + "' ");
-                    sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and ma_code='" + ma_code.Text + "' order by sp_soncode");
-                    DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                    BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
-                //}
-                //else if (!(last_macoe == ma_code.Text))
-                //{
-                //    OperateResult.AppendText(">>所选工单" + ma_code.Text + "所在线别为" + ma_linecode + ",与当前线别" + User.UserLineCode + "不一致\n", Color.Red);
-                //    last_macoe = ma_code.Text;
-                //    BaseUtil.CleanDGVData(BatchProductDGV);
-                //}
-                //else {
-                //    BaseUtil.CleanDGVData(BatchProductDGV);
-                //}
+                sql.Clear();
+                sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,sp_fsoncode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
+                sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
+                sql.Append("pr_code=sp_mothercode left join makesourcestock on  mss_craftcode=sb_craftcode and mss_makecode='" + ma_code.Text + "'  and mss_linecode = '" + User.UserLineCode + "' ");
+                sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode left join make on ma_bomversion=sb_bomversion where sb_prodcode='" + ma_prodcode.Text + "' and sb_craftcode='" + ma_craftcode.Text + "' ");
+                sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and ma_code='" + ma_code.Text + "' order by sp_soncode");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
             }
             else
             {
@@ -198,7 +186,7 @@ namespace UAS_MES.Make
                 sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
                 sql.Append("pr_code=sp_mothercode left join makesourcestock on  mss_craftcode=sb_craftcode ");
                 sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode where  ");
-                sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '"+User.UserLineCode+"' order  by sp_soncode");
+                sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '" + User.UserLineCode + "' order  by sp_soncode");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
             }
@@ -241,10 +229,10 @@ namespace UAS_MES.Make
                     string soncode = BatchProductDGV.Rows[e.RowIndex].Cells["sp_soncode"].Value.ToString();
                     if (id != "0")
                     {
-                            dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
-                            OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
-                            FillDataGridView();
+                        dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
+                        OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
+                        FillDataGridView();
                     }
                 }
             }
@@ -355,7 +343,8 @@ namespace UAS_MES.Make
                 pr_batchnum.Enabled = false;
                 FillDataGridView();
             }
-            else {
+            else
+            {
                 pr_batchnum.Enabled = true;
                 FillDataGridView();
             }
@@ -387,7 +376,7 @@ namespace UAS_MES.Make
                     List<string> soncodecol = new List<string>();
                     for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
                     {
-                       
+
                         string id = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
                         string useqty = BatchProductDGV.Rows[i].Cells["mss_useqty"].Value.ToString();
                         string soncode = BatchProductDGV.Rows[i].Cells["sp_soncode"].Value.ToString();
@@ -396,8 +385,8 @@ namespace UAS_MES.Make
                         {
                             idcol.Add(id);
                             makecodecol.Add(makecode);
-                            soncodecol.Add("删除物料"+soncode);
-                            OperateResult.AppendText(">>料号" + soncode + "删除成功\n");   
+                            soncodecol.Add("删除物料" + soncode);
+                            OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
                         }
                     }
                     sql.Clear();
@@ -409,8 +398,9 @@ namespace UAS_MES.Make
                     FillDataGridView();
                 }
             }
-            else {
-                OperateResult.AppendText(">>没有上料记录,无需全部下料\n",Color.Red);
+            else
+            {
+                OperateResult.AppendText(">>没有上料记录,无需全部下料\n", Color.Red);
             }
         }
     }

+ 11 - 9
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.Designer.cs

@@ -73,7 +73,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_code.Location = new System.Drawing.Point(158, 121);
+            this.pr_code.Location = new System.Drawing.Point(160, 121);
             this.pr_code.Name = "pr_code";
             this.pr_code.Size = new System.Drawing.Size(0, 31);
             this.pr_code.TabIndex = 215;
@@ -111,7 +111,8 @@
             // 
             this.pr_spec.AutoSize = true;
             this.pr_spec.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_spec.Location = new System.Drawing.Point(115, 218);
+            this.pr_spec.Location = new System.Drawing.Point(160, 228);
+            this.pr_spec.MaximumSize = new System.Drawing.Size(600, 40);
             this.pr_spec.Name = "pr_spec";
             this.pr_spec.Size = new System.Drawing.Size(0, 31);
             this.pr_spec.TabIndex = 219;
@@ -120,7 +121,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label5.Location = new System.Drawing.Point(33, 218);
+            this.label5.Location = new System.Drawing.Point(33, 228);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(62, 31);
             this.label5.TabIndex = 218;
@@ -170,7 +171,7 @@
             // 
             this.columnHeader5.Text = "时间";
             this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            this.columnHeader5.Width = 160;
+            this.columnHeader5.Width = 170;
             // 
             // panel4
             // 
@@ -241,7 +242,7 @@
             this.sncode.BackColor = System.Drawing.Color.White;
             this.sncode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.sncode.ID = null;
-            this.sncode.Location = new System.Drawing.Point(127, 72);
+            this.sncode.Location = new System.Drawing.Point(166, 72);
             this.sncode.Name = "sncode";
             this.sncode.Power = null;
             this.sncode.Size = new System.Drawing.Size(187, 31);
@@ -316,7 +317,7 @@
             this.stopWeigh.DownImage = ((System.Drawing.Image)(resources.GetObject("stopWeigh.DownImage")));
             this.stopWeigh.Image = null;
             this.stopWeigh.IsShowBorder = true;
-            this.stopWeigh.Location = new System.Drawing.Point(816, 194);
+            this.stopWeigh.Location = new System.Drawing.Point(811, 194);
             this.stopWeigh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.stopWeigh.MoveImage = ((System.Drawing.Image)(resources.GetObject("stopWeigh.MoveImage")));
             this.stopWeigh.Name = "stopWeigh";
@@ -335,7 +336,7 @@
             this.startWeigh.DownImage = ((System.Drawing.Image)(resources.GetObject("startWeigh.DownImage")));
             this.startWeigh.Image = null;
             this.startWeigh.IsShowBorder = true;
-            this.startWeigh.Location = new System.Drawing.Point(662, 194);
+            this.startWeigh.Location = new System.Drawing.Point(657, 194);
             this.startWeigh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.startWeigh.MoveImage = ((System.Drawing.Image)(resources.GetObject("startWeigh.MoveImage")));
             this.startWeigh.Name = "startWeigh";
@@ -355,7 +356,7 @@
             this.ma_code.DBTitle = "";
             this.ma_code.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ma_code.FormName = null;
-            this.ma_code.Location = new System.Drawing.Point(127, 18);
+            this.ma_code.Location = new System.Drawing.Point(166, 18);
             this.ma_code.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.ma_code.Name = "ma_code";
             this.ma_code.Power = "";
@@ -366,7 +367,8 @@
             this.ma_code.TabIndex = 213;
             this.ma_code.TableName = null;
             this.ma_code.Tag = "makecode";
-            this.ma_code.TextBoxEnable = true;
+            this.ma_code.TextBoxEnable = false;
+            this.ma_code.UserControlTextChanged += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.ma_code_UserControlTextChanged);
             // 
             // Packing_ProdWeightSet
             // 

+ 22 - 18
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.cs

@@ -52,7 +52,7 @@ namespace UAS_MES.Packing
             ma_code.TableName = "make left join product on ma_prodcode=pr_code";
             ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,pr_detail # 产品名称,pr_spec # 规格,ma_qty # 工单数量";
             ma_code.FormName = Name;
-            ma_code.SetValueField = new string[] { "ma_code,pr_code,pr_detail,pr_spec" };
+            ma_code.SetValueField = new string[] { "ma_code","pr_code","pr_detail","pr_spec" };
             ma_code.DbChange += Ma_code_DbChange;
 
             dh = new DataHelper();
@@ -63,19 +63,6 @@ namespace UAS_MES.Packing
         {
             Dbfind = ma_code.ReturnData;
             BaseUtil.SetFormValue(this.Controls, Dbfind);
-            //查询重量设置采样个数
-            try
-            {
-                samplesCount = int.Parse(dh.GetConfig("重量设置采样个数", "MESSetting").ToString());
-            }
-            catch (Exception ess)
-            {
-                //如果没维护的话默认是10
-                samplesCount = 10;
-            }
-            OperateResult.AppendText("<<重量设置需采样个数为"+samplesCount+"\n", Color.Black);
-            //清空称量记录
-            showResult.Items.Clear();
         }
         private void recordResult(int index,string palletcode, string weigh, string time)
         {
@@ -84,7 +71,7 @@ namespace UAS_MES.Packing
             //分条赋值
             lvi.SubItems.Add(index+"");
             lvi.SubItems.Add(palletcode);
-            lvi.SubItems.Add(weigh);
+            lvi.SubItems.Add(weigh+pr_cartonunit.Text);
             lvi.SubItems.Add(time);
             //添加结果的信息进去
             showResult.Items.Add(lvi);
@@ -171,8 +158,8 @@ namespace UAS_MES.Packing
                 return;
             }
             //更新彩盒重量最大值最小值
-            dh.ExecuteSql("update product set PR_COLORBOXMAXW ='"+maxValue+"', PR_COLORBOXMINW = '"+minValue+"' where pr_code='"+pr_code.Text+"'", "update");
-            OperateResult.AppendText("<<重量设置成功,最大值"+maxValue+"最小值"+minValue+"\n", Color.Green);
+            dh.ExecuteSql("update product set PR_COLORBOXMAXW ='"+maxValue+"', PR_COLORBOXMINW = '"+minValue+ "',PR_COLORBOXUNIT='"+pr_cartonunit.Text+"' where pr_code='" + pr_code.Text+"'", "update");
+            OperateResult.AppendText("<<重量设置成功,最大值"+maxValue+pr_cartonunit.Text+",最小值"+minValue+pr_cartonunit.Text+"\n", Color.Green);
         }
 
         private void sncode_KeyDown(object sender, KeyEventArgs e)
@@ -196,7 +183,7 @@ namespace UAS_MES.Packing
                     return;
                 }
                 //验证彩盒是否与工单对应
-                if (!dh.CheckExist("makeserial","where ms_makecode='"+ma_code.Text+"' and ms_sncode = '"+sncode.Text+"'"))
+                if (!dh.CheckExist("makeserial","ms_makecode='"+ma_code.Text+"' and ms_sncode = '"+sncode.Text+"'"))
                 {
                     OperateResult.AppendText("<<序列号"+sncode.Text+"不在工单"+ma_code.Text+"中\n", Color.Red, sncode);
                     return;
@@ -215,5 +202,22 @@ namespace UAS_MES.Packing
         {
             asc.controlAutoSize(this);
         }
+
+        private void ma_code_UserControlTextChanged(object sender, EventArgs e)
+        {
+            //查询重量设置采样个数
+            try
+            {
+                samplesCount = int.Parse(dh.GetConfig("重量设置采样个数", "MESSetting").ToString());
+            }
+            catch (Exception ess)
+            {
+                //如果没维护的话默认是10
+                samplesCount = 10;
+            }
+            OperateResult.AppendText("<<重量设置需采样个数为" + samplesCount + "\n", Color.Black);
+            //清空称量记录
+            showResult.Items.Clear();
+        }
     }
 }