Эх сурвалжийг харах

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

章政 8 жил өмнө
parent
commit
66a59e8cfe

+ 2 - 1
UAS-MES/FunctionCode/Make/Make_PalletWeigh.Designer.cs

@@ -365,6 +365,7 @@
             // 
             this.weightedNum.AllPower = null;
             this.weightedNum.BackColor = System.Drawing.Color.White;
+            this.weightedNum.Enabled = false;
             this.weightedNum.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.weightedNum.ID = null;
             this.weightedNum.Location = new System.Drawing.Point(1122, 250);
@@ -456,7 +457,7 @@
             // 
             this.Printer.Font = new System.Drawing.Font("宋体", 9F);
             this.Printer.Location = new System.Drawing.Point(1122, 24);
-            this.Printer.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.Printer.Margin = new System.Windows.Forms.Padding(6);
             this.Printer.Name = "Printer";
             this.Printer.Size = new System.Drawing.Size(195, 34);
             this.Printer.TabIndex = 163;

+ 13 - 13
UAS-MES/FunctionCode/Make/Make_PositionStock.cs

@@ -162,9 +162,9 @@ 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)
-                {
+                //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 ");
@@ -173,16 +173,16 @@ namespace UAS_MES.Make
                     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);
-                }
+                //}
+                //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);
+                //}
             }
             else
             {

+ 105 - 62
UAS-MES/FunctionCode/Query/Query_ExeProgress.cs

@@ -31,7 +31,7 @@ namespace UAS_MES.Query
 
         DataTable dt;
 
-        string ms_id;//记录ms_id
+        DataTable ms_id;//记录ms_id
 
         DataTable ListA;//记录数据的当前序列号和之前序列号
 
@@ -60,9 +60,21 @@ namespace UAS_MES.Query
         {
             if (e.KeyCode == Keys.Enter)
             {
-                ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id) ms_id", "ms_sncode='" + sn_code.Text + "' or ms_beforesn='"+sn_code.Text+"'").ToString();
-                ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_sncode from makeserial where ms_id='"+ms_id+"'","select");
-                dt = (DataTable)dh.ExecuteSql("select ms_status,ms_nextstepcode,ms_paststep,ms_stepcode,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id='" + ms_id + "'", "select");
+                ms_id = (DataTable)dh.ExecuteSql("select ms_id from makeserial where ms_sncode='" + sn_code.Text + "' or ms_beforesn='"+sn_code.Text+"' order by ms_id","select");
+                if (ms_id.Rows.Count==0)
+                {
+                    //无值则提示
+                    MessageBox.Show("序列号" + sn_code.Text + "不存在");
+                    return;
+                }
+                StringBuilder ms_ids = new StringBuilder();//存所有的ms_id
+                int idCount = ms_id.Rows.Count;
+                for (int i=0;i<idCount;i++)
+                {
+                    ms_ids.Append("'"+ms_id.Rows[i]["ms_id"].ToString()+"',");
+                }
+                ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_sncode,ms_makecode from makeserial where ms_id in ("+ms_ids.ToString().Substring(0,ms_ids.ToString().Length-1)+")","select");
+                dt = (DataTable)dh.ExecuteSql("select ms_status,ms_nextstepcode,ms_paststep,ms_stepcode,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id", "select");
                 if (dt.Rows.Count > 0)
                 {
                     if (Step != null && Step.Count > 0)
@@ -71,11 +83,11 @@ namespace UAS_MES.Query
                         SerialPanel.Controls.Clear();
                         PaintColor.Clear();
                     }
-                    string ifRework = dt.Rows[0]["ms_ifrework"].ToString();
+                    string ifRework = dt.Rows[idCount-1]["ms_ifrework"].ToString();
                     //执行过的步骤
-                    PastStep = dt.Rows[0]["ms_paststep"].ToString();
+                    PastStep = dt.Rows[idCount - 1]["ms_paststep"].ToString();
                     //下一步骤
-                    nextStepCode = dt.Rows[0]["ms_nextstepcode"].ToString();
+                    nextStepCode = dt.Rows[idCount - 1]["ms_nextstepcode"].ToString();
                     //如果为不良的时候
                     string BadStep = "";
                     string RejectStep = "";
@@ -84,41 +96,49 @@ namespace UAS_MES.Query
                     if (ifRework != "0")
                     {
                         //是返工的
-                        if (dt.Rows[0]["ms_reworkstatus"].ToString() == "3")
+                        if (dt.Rows[idCount - 1]["ms_reworkstatus"].ToString() == "3")
                         {
-                            BadStep = dt.Rows[0]["ms_stepcode"].ToString();
+                            BadStep = dt.Rows[idCount - 1]["ms_stepcode"].ToString();
                         }
-                        else if (dt.Rows[0]["ms_reworkstatus"].ToString() == "4")
+                        else if (dt.Rows[idCount - 1]["ms_reworkstatus"].ToString() == "4")
                         {
-                            RejectStep = dt.Rows[0]["ms_stepcode"].ToString();
+                            RejectStep = dt.Rows[idCount - 1]["ms_stepcode"].ToString();
                         }
                     }
                     else
                     {
                         //不是返工的
-                        if (dt.Rows[0]["ms_status"].ToString() == "3")
+                        if (dt.Rows[idCount - 1]["ms_status"].ToString() == "3")
                         {
-                            BadStep = dt.Rows[0]["ms_stepcode"].ToString();
+                            BadStep = dt.Rows[idCount - 1]["ms_stepcode"].ToString();
                         }
-                        else if (dt.Rows[0]["ms_status"].ToString() == "4")
+                        else if (dt.Rows[idCount - 1]["ms_status"].ToString() == "4")
                         {
-                            RejectStep = dt.Rows[0]["ms_stepcode"].ToString();
+                            RejectStep = dt.Rows[idCount - 1]["ms_stepcode"].ToString();
                         }
                     }
-                    currentStep = dt.Rows[0]["ms_stepcode"].ToString();
-                    //添加开始节点绿色,除了返工
-                    if (BadStep==""&& ((dt.Rows[0]["ms_status"].ToString() == "3"&&ifRework=="0")||(dt.Rows[0]["ms_reworkstatus"].ToString()=="3"&&ifRework=="-1")))
+                    currentStep = dt.Rows[idCount - 1]["ms_stepcode"].ToString();
+                    //如果只有一个
+                    if (idCount == 1)
                     {
-                        PaintColor.Add(Brushes.Red);
+                        //添加开始节点绿色,除了返工单
+                        if (BadStep == "" && ((dt.Rows[idCount - 1]["ms_status"].ToString() == "3" && ifRework == "0") || (dt.Rows[idCount - 1]["ms_reworkstatus"].ToString() == "3" && ifRework == "-1")))
+                        {
+                            PaintColor.Add(Brushes.Red);
+                        }
+                        else
+                        {
+                            PaintColor.Add(Brushes.Green);
+                        }
                     }
-                    else
+                    else//有至少两个工单,之前的工单肯定是已经完工的
                     {
                         PaintColor.Add(Brushes.Green);
                     }
                     //查询执行过的步骤
                     sql.Clear();
-                    sql.Append("select CD_DETNO,CD_STEPCODE,ms_makecode from craft left join craftdetail on cd_crid = cr_id  left join makeserial ");
-                    sql.Append("on ms_craftcode=cr_code and ms_prodcode=cr_prodcode where ms_id='" + ms_id + "' order by cd_detno");
+                    sql.Append("select CD_DETNO,CD_STEPCODE,ms_makecode,ms_id from craft left join craftdetail on cd_crid = cr_id  left join makeserial ");
+                    sql.Append("on ms_craftcode=cr_code and ms_prodcode=cr_prodcode where ms_id in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id,cd_detno");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     Step = new Dictionary<int, string>();
                     for (int i = 0; i < dt.Rows.Count + 2; i++)
@@ -135,70 +155,83 @@ namespace UAS_MES.Query
                     int index = 0;
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        if (nextStepCode == dt.Rows[i]["CD_STEPCODE"].ToString())
+                        //正在生产的途程才算
+                        if (dt.Rows[i]["ms_id"].ToString()==ms_id.Rows[ms_id.Rows.Count-1]["ms_id"].ToString())
                         {
-                            index = i;
+                            if (nextStepCode == dt.Rows[i]["CD_STEPCODE"].ToString())
+                            {
+                                index = i;
+                            }
                         }
                     }
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        ////下一步不在途程中,不良或者报废或者完工
-                        if (nextStepCode == ""||nextStepCode==" ")
+                        //只考虑正在生产的途程,之前工单的途程工序必定为绿色完工
+                        if (dt.Rows[i]["ms_id"].ToString() == ms_id.Rows[ms_id.Rows.Count - 1]["ms_id"].ToString())
                         {
-                            //返工单
-                            if (currentStep=="")
-                            {
-                                passed = false;
-                            }
-                            //找到不良步骤
-                            if (BadStep == dt.Rows[i]["CD_STEPCODE"].ToString())
-                            {
-                                PaintColor.Add(Brushes.Red);
-                                //是不良品,后面就不执行
-                                passed = false;
-                            }
-                            //找到报废步骤
-                            else if (PastStep.Contains(dt.Rows[i]["CD_STEPCODE"].ToString() + "," + RejectStep)&&RejectStep!="")
+                            ////下一步不在途程中,不良或者报废或者完工
+                            if (nextStepCode == "" || nextStepCode == " ")
                             {
-                                PaintColor.Add(Brushes.Black);
-                                //是报废品,后面就不执行
-                                passed = false;
+                                //返工单
+                                if (currentStep == "")
+                                {
+                                    passed = false;
+                                }
+                                //找到不良步骤
+                                if (BadStep == dt.Rows[i]["CD_STEPCODE"].ToString())
+                                {
+                                    PaintColor.Add(Brushes.Red);
+                                    //是不良品,后面就不执行
+                                    passed = false;
+                                }
+                                //找到报废步骤
+                                else if (PastStep.Contains(dt.Rows[i]["CD_STEPCODE"].ToString() + "," + RejectStep) && RejectStep != "")
+                                {
+                                    PaintColor.Add(Brushes.Black);
+                                    //是报废品,后面就不执行
+                                    passed = false;
+                                }
+                                else
+                                {
+                                    //通过加绿色
+                                    if (passed)
+                                    {
+                                        PaintColor.Add(Brushes.Green);
+                                    }
+                                    //不通过加白色
+                                    else
+                                    {
+                                        PaintColor.Add(Brushes.White);
+                                    }
+                                }
                             }
+                            ////序列号下一步不为空
                             else
                             {
-                                //通过加绿色
-                                if (passed)
+                                /////SN下一步是否在途程中,是则标记
+                                //找到下一步
+                                if (i < index)
                                 {
+                                    //已执行
                                     PaintColor.Add(Brushes.Green);
                                 }
-                                //不通过加白色
                                 else
                                 {
+                                    //未执行
                                     PaintColor.Add(Brushes.White);
                                 }
                             }
                         }
-                        ////序列号下一步不为空
                         else
                         {
-                            /////SN下一步是否在途程中,是则标记
-                            //找到下一步
-                            if (i < index)
-                            {
-                                //已执行
-                                PaintColor.Add(Brushes.Green);
-                            }
-                            else
-                            {
-                                //未执行
-                                PaintColor.Add(Brushes.White);
-                            }
+                            //就是之前生产的途程,为绿色
+                            PaintColor.Add(Brushes.Green);
                         }
                     }
                     if (ifRework != "0")
                     {
                         //完工添加绿色,未完工添加白色
-                        if (dh.CheckExist("Makeserial", "ms_id='" + ms_id + "' and ms_reworkstatus='2'"))
+                        if (dh.CheckExist("Makeserial", "ms_id='" + ms_id.Rows[ms_id.Rows.Count - 1]["ms_id"] + "' and ms_reworkstatus='2'"))
                             PaintColor.Add(Brushes.Green);
                         else
                             PaintColor.Add(Brushes.White);
@@ -206,17 +239,27 @@ namespace UAS_MES.Query
                     else
                     {
                         //完工添加绿色,未完工添加白色
-                        if (dh.CheckExist("Makeserial", "ms_id='" + ms_id + "' and ms_status='2'"))
+                        if (dh.CheckExist("Makeserial", "ms_id='" + ms_id.Rows[ms_id.Rows.Count - 1]["ms_id"] + "' and ms_status='2'"))
                             PaintColor.Add(Brushes.Green);
                         else
                             PaintColor.Add(Brushes.White);
                     }
                     Refresh();
                     SerialPanel.Refresh();
+                    StringBuilder mp_sncodes = new StringBuilder();
+                    StringBuilder makecodes = new StringBuilder();
+                    //拼接序列号的和工单号的
+                    for (int i=0;i<ListA.Rows.Count;i++)
+                    {
+                        //sql  mp_sncode
+                        mp_sncodes.Append("'" + ListA.Rows[i]["ms_sncode"].ToString() + "',"+(ListA.Rows[i]["ms_beforesn"].ToString()==""?"":(" '"+ListA.Rows[i]["ms_beforesn"].ToString()+"',")));
+                        //sql ma_code
+                        makecodes.Append("'"+ListA.Rows[i]["ms_makecode"].ToString()+"',");
+                    }
                     sql.Clear();
                     sql.Append("select mp_makecode,ma_prodcode,sc_linecode,ma_craftcode,mp_sourcecode,mp_sncode,");
                     sql.Append("mp_indate,mp_inman,em_name from makeprocess left join make on mp_makecode=ma_code left join employee on mp_inman = em_code left join source on ");
-                    sql.Append("mp_sourcecode=sc_code where mp_sncode in ('" + ListA.Rows[0]["ms_sncode"].ToString() + "'"+(ListA.Rows[0]["ms_beforesn"].ToString()==""?"":(",'"+ListA.Rows[0]["ms_beforesn"].ToString()+"'")) +") and ma_code='" + dt.Rows[0]["ms_makecode"].ToString() + "' order by mp_indate");
+                    sql.Append("mp_sourcecode=sc_code where mp_sncode in ("+mp_sncodes.ToString().Substring(0,mp_sncodes.ToString().Length-1)+") and ma_code in (" + makecodes.ToString().Substring(0,makecodes.ToString().Length-1)+ ") order by mp_indate");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
                 }

+ 16 - 2
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.Designer.cs

@@ -31,6 +31,7 @@
             this.headBar1 = new UAS_MES.CustomControl.HeadBar();
             this.InOutDetailDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
             this.pd_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_ordercode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.outqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.getqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -55,12 +56,12 @@
             this.InOutDetailDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.InOutDetailDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.pd_prodcode,
+            this.pd_ordercode,
             this.pr_detail,
             this.outqty,
             this.getqty,
             this.ungetqty});
             this.InOutDetailDGV.EnableContentClick = true;
-            this.InOutDetailDGV.Enabled = false;
             this.InOutDetailDGV.Location = new System.Drawing.Point(32, 37);
             this.InOutDetailDGV.Margin = new System.Windows.Forms.Padding(2);
             this.InOutDetailDGV.Name = "InOutDetailDGV";
@@ -74,30 +75,42 @@
             this.pd_prodcode.HeaderText = "产品代码";
             this.pd_prodcode.MinimumWidth = 120;
             this.pd_prodcode.Name = "pd_prodcode";
+            this.pd_prodcode.ReadOnly = true;
             this.pd_prodcode.Width = 120;
             // 
+            // pd_ordercode
+            // 
+            this.pd_ordercode.DataPropertyName = "pd_ordercode";
+            this.pd_ordercode.HeaderText = "订单编号";
+            this.pd_ordercode.Name = "pd_ordercode";
+            this.pd_ordercode.ReadOnly = true;
+            // 
             // pr_detail
             // 
             this.pr_detail.DataPropertyName = "pr_detail";
             this.pr_detail.HeaderText = "产品名称";
             this.pr_detail.Name = "pr_detail";
+            this.pr_detail.ReadOnly = true;
             // 
             // outqty
             // 
             this.outqty.DataPropertyName = "outqty";
             this.outqty.HeaderText = "出货数";
             this.outqty.Name = "outqty";
+            this.outqty.ReadOnly = true;
             // 
             // getqty
             // 
             this.getqty.DataPropertyName = "getqty";
             this.getqty.HeaderText = "已采集数";
             this.getqty.Name = "getqty";
+            this.getqty.ReadOnly = true;
             // 
             // ungetqty
             // 
             this.ungetqty.HeaderText = "未采集数";
             this.ungetqty.Name = "ungetqty";
+            this.ungetqty.ReadOnly = true;
             // 
             // Warehouse_ProdDetail
             // 
@@ -112,7 +125,7 @@
             this.Text = "Warehouse_ProdDetail";
             this.Load += new System.EventHandler(this.Warehouse_ProdDetail_Load);
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
 
         }
 
@@ -121,6 +134,7 @@
         private CustomControl.HeadBar headBar1;
         private CustomControl.DataGrid_View.DataGridViewWithSerialNum InOutDetailDGV;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_ordercode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
         private System.Windows.Forms.DataGridViewTextBoxColumn outqty;
         private System.Windows.Forms.DataGridViewTextBoxColumn getqty;

+ 3 - 3
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.cs

@@ -44,9 +44,9 @@ namespace UAS_MES.Warehouse
         private void Warehouse_ProdDetail_Load(object sender, EventArgs e)
         {
             sql.Clear();
-            sql.Append("select pd_prodcode,pr_detail,outqty ,nvl((select count(1) from prodiomac where pim_inoutno='"+pim_inoutno+"' and pim_prodcode=pd_prodcode),0) getqty ");
-            sql.Append("from (select pd_prodcode,sum(pd_outqty) outqty from prodiodetail ");
-            sql.Append("where pd_piid='"+pd_piid+"'group by pd_prodcode) left join product on pr_code=pd_prodcode");
+            sql.Append("select pd_ordercode,pd_prodcode,pr_detail,outqty ,nvl((select count(1) from prodiomac where pim_inoutno='" + pim_inoutno+"' and pim_prodcode=pd_prodcode),0) getqty ");
+            sql.Append("from (select pd_ordercode,pd_prodcode,sum(pd_outqty) outqty from prodiodetail ");
+            sql.Append("where pd_piid='"+pd_piid+ "'group by pd_prodcode,pd_ordercode) left join product on pr_code=pd_prodcode");
             dbfind = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
             BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dbfind);
             for (int i = 0; i < InOutDetailDGV.Rows.Count; i++)

+ 3 - 0
UAS-MES/FunctionCode/Warehouse/Warehouse_ProdDetail.resx

@@ -117,4 +117,7 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="pd_ordercode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>