Browse Source

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

Hcsy 8 years ago
parent
commit
7f032047bb

+ 4 - 1
UAS-MES/DataOperate/DataHelper.cs

@@ -32,7 +32,7 @@ namespace UAS_MES.DataOperate
                     connection = new OracleConnection(DBConnectionString);
                     connection = new OracleConnection(DBConnectionString);
                 connection.Open();
                 connection.Open();
             }
             }
-            catch (Exception e) { /*OracleConnection.ClearPool(connection);*/ LogManager.DoLog(e.Message); }
+            catch (Exception e) { LogManager.DoLog(e.Message); }
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -1092,7 +1092,10 @@ namespace UAS_MES.DataOperate
         private void Reconnect(OracleCommand cmd)
         private void Reconnect(OracleCommand cmd)
         {
         {
             if (cmd.Connection.State == ConnectionState.Closed)
             if (cmd.Connection.State == ConnectionState.Closed)
+            {
                 cmd.Connection.Open();
                 cmd.Connection.Open();
+                LogManager.DoLog("超时重连");
+            }
         }
         }
     }
     }
 }
 }

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

@@ -207,6 +207,7 @@
             this.headBar1.Size = new System.Drawing.Size(548, 32);
             this.headBar1.Size = new System.Drawing.Size(548, 32);
             this.headBar1.TabIndex = 98;
             this.headBar1.TabIndex = 98;
             this.headBar1.Title = null;
             this.headBar1.Title = null;
+            this.headBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.headBar1_MouseDown);
             // 
             // 
             // badgroup
             // badgroup
             // 
             // 

+ 23 - 0
UAS-MES/FunctionCode/Make/Make_NewBadCode.cs

@@ -4,6 +4,7 @@ using System.ComponentModel;
 using System.Data;
 using System.Data;
 using System.Drawing;
 using System.Drawing;
 using System.Linq;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Text;
 using System.Windows.Forms;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
 using UAS_MES.DataOperate;
@@ -14,6 +15,22 @@ namespace UAS_MES.Make
 {
 {
     public partial class Make_NewBadCode : Form
     public partial class Make_NewBadCode : Form
     {
     {
+        //所有用到了headBar的部分都需要这段代码
+        [DllImport("user32.dll")]
+        public static extern bool ReleaseCapture();
+
+        [DllImport("user32.dll")]
+        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
+
+        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
+        public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
+
+        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
+        public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
+
+        public const int WM_SYSCOMMAND = 0x0112;
+        public const int SC_MOVE = 0xF010;
+        public const int HTCAPTION = 0x0002;
         /// <summary>
         /// <summary>
         /// 序列号
         /// 序列号
         /// </summary>
         /// </summary>
@@ -219,5 +236,11 @@ namespace UAS_MES.Make
             }
             }
             WaitRejectList.EndUpdate();
             WaitRejectList.EndUpdate();
         }
         }
+
+        private void headBar1_MouseDown(object sender, MouseEventArgs e)
+        {
+            ReleaseCapture();
+            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
+        }
     }
     }
 }
 }

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

@@ -319,6 +319,7 @@
             this.headBar1.Size = new System.Drawing.Size(624, 32);
             this.headBar1.Size = new System.Drawing.Size(624, 32);
             this.headBar1.TabIndex = 0;
             this.headBar1.TabIndex = 0;
             this.headBar1.Title = "新增维修信息";
             this.headBar1.Title = "新增维修信息";
+            this.headBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.headBar1_MouseDown);
             // 
             // 
             // Make_NewMatainInf
             // Make_NewMatainInf
             // 
             // 

+ 48 - 21
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -4,6 +4,7 @@ using System.ComponentModel;
 using System.Data;
 using System.Data;
 using System.Drawing;
 using System.Drawing;
 using System.Linq;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Text;
 using System.Windows.Forms;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
 using UAS_MES.DataOperate;
@@ -14,6 +15,23 @@ namespace UAS_MES.Make
 {
 {
     public partial class Make_NewMatainInf : Form
     public partial class Make_NewMatainInf : Form
     {
     {
+        //所有用到了headBar的部分都需要这段代码
+        [DllImport("user32.dll")]
+        public static extern bool ReleaseCapture();
+
+        [DllImport("user32.dll")]
+        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
+
+        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
+        public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
+
+        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
+        public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
+
+        public const int WM_SYSCOMMAND = 0x0112;
+        public const int SC_MOVE = 0xF010;
+        public const int HTCAPTION = 0x0002;
+
         /// <summary>
         /// <summary>
         /// 序列号
         /// 序列号
         /// </summary>
         /// </summary>
@@ -125,12 +143,12 @@ namespace UAS_MES.Make
             return CheckedNum;
             return CheckedNum;
         }
         }
 
 
-        private string GetListViewSelectedItemText(ListView lsv)
+        private string GetListViewSelectedItemText(ListView lsv, int ItemIndex)
         {
         {
             for (int i = lsv.Items.Count - 1; i >= 0; i--)
             for (int i = lsv.Items.Count - 1; i >= 0; i--)
             {
             {
                 if (lsv.Items[i].Selected)
                 if (lsv.Items[i].Selected)
-                    return lsv.Items[i].SubItems[0].Text;
+                    return lsv.Items[i].SubItems[ItemIndex].Text;
             }
             }
             return null;
             return null;
         }
         }
@@ -159,23 +177,29 @@ namespace UAS_MES.Make
             if (ErrorMessage == "")
             if (ErrorMessage == "")
             {
             {
                 ErrorMessage = "";
                 ErrorMessage = "";
-                string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv);
-                string nrgcode = GetListViewSelectedItemText(nrg_name_lsv);
-                string nrcode = GetListViewSelectedItemText(nr_name_lsv);
-                string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv);
-                string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv);
+                string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv, 0);
+                string nrgcode = GetListViewSelectedItemText(nrg_name_lsv, 0);
+                string nrcode = GetListViewSelectedItemText(nr_name_lsv, 0);
+                string nrname = GetListViewSelectedItemText(nr_name_lsv, 1);
+                string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv, 0);
+                string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv, 0);
                 dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + sncode + "' and ms_status=3", "select");
                 dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + sncode + "' and ms_status=3", "select");
                 if (dt.Rows.Count > 0)
                 if (dt.Rows.Count > 0)
                 {
                 {
                     string macode = dt.Rows[0]["ms_makecode"].ToString();
                     string macode = dt.Rows[0]["ms_makecode"].ToString();
                     string mbr_id = dh.GetSEQ("makebadreason_seq");
                     string mbr_id = dh.GetSEQ("makebadreason_seq");
-                    sql.Clear();
-                    sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
-                    sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
-                    sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
-                    sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrgcode + "','" + bccode + "',");
-                    sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
-                    dh.ExecuteSql(sql.GetString(), "insert");
+                    if (!dh.CheckExist("makebadreason", "mbr_badcode='" + bccode + "' and mbr_sncode='" + sncode + "' and mbr_brcode='" + nrcode + "'"))
+                    {
+                        sql.Clear();
+                        sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
+                        sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
+                        sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
+                        sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrgcode + "','" + bccode + "',");
+                        sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
+                        dh.ExecuteSql(sql.GetString(), "insert");
+                        MessageBox.Show("不良原因保存成功");
+                    }
+                    else MessageBox.Show("不良代码【" + bc_name.Text + "】已存在不良原因【" + nrname+"】");
                     if (mbccomponent != "" || mbccomponent != null)
                     if (mbccomponent != "" || mbccomponent != null)
                     {
                     {
                         if (!dh.CheckExist("makebadrscom", "mbc_sncode='" + sncode + "' and mbc_component='" + mbccomponent + "'"))
                         if (!dh.CheckExist("makebadrscom", "mbc_sncode='" + sncode + "' and mbc_component='" + mbccomponent + "'"))
@@ -187,18 +211,15 @@ namespace UAS_MES.Make
                             sql.Append("'" + bccode + "','" + nrcode + "','" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "')");
                             sql.Append("'" + bccode + "','" + nrcode + "','" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "')");
                             dh.ExecuteSql(sql.GetString(), "insert");
                             dh.ExecuteSql(sql.GetString(), "insert");
                         }
                         }
-                        else ErrorMessage += "序列号" + sncode + "已存在不良组件" + mbccomponent;
+                        else ErrorMessage += "序列号" + sncode + "已存在不良组件" + mbccomponent+"】";
                     }
                     }
                     if (ErrorMessage != "")
                     if (ErrorMessage != "")
                         MessageBox.Show(ErrorMessage);
                         MessageBox.Show(ErrorMessage);
-                    else
-                        Close();
+                    Close();
                 }
                 }
-                else
-                    MessageBox.Show("序列号错误,不存在或者不处于维修状态");
+                else MessageBox.Show("序列号错误,不存在或者不处于维修状态");
             }
             }
-            else
-                MessageBox.Show(ErrorMessage + "未勾选");
+            else MessageBox.Show(ErrorMessage + "未勾选");
         }
         }
 
 
         private void ListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
         private void ListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
@@ -224,5 +245,11 @@ namespace UAS_MES.Make
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             AddDataToListView(nr_name_lsv, dt);
             AddDataToListView(nr_name_lsv, dt);
         }
         }
+
+        private void headBar1_MouseDown(object sender, MouseEventArgs e)
+        {
+            ReleaseCapture();
+            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
+        }
     }
     }
 }
 }

+ 9 - 2
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -165,6 +165,13 @@ namespace UAS_MES.Make
             }
             }
             if (e.Node.Level == 1)
             if (e.Node.Level == 1)
             {
             {
+                //展示父节点信息
+                mb_id = e.Node.Parent.Tag.ToString();
+                bc_name.Text = BadInf_1[mb_id]["bc_name"];
+                bc_code.Text = BadInf_1[mb_id]["mb_badcode"];
+                bg_name.Text = BadInf_1[mb_id]["bg_name"];
+                bg_code.Text = BadInf_1[mb_id]["mb_bgcode"];
+                //展示子节点信息
                 mbr_id = e.Node.Tag.ToString();
                 mbr_id = e.Node.Tag.ToString();
                 nrg_name.Text = BadInf_2[mbr_id]["nrg_name"];
                 nrg_name.Text = BadInf_2[mbr_id]["nrg_name"];
                 nr_name.Text = BadInf_2[mbr_id]["nr_name"];
                 nr_name.Text = BadInf_2[mbr_id]["nr_name"];
@@ -236,7 +243,7 @@ namespace UAS_MES.Make
                     dic1.Add("nrg_name", dt1.Rows[j]["nrg_name"].ToString());
                     dic1.Add("nrg_name", dt1.Rows[j]["nrg_name"].ToString());
                     dic1.Add("nr_name", dt1.Rows[j]["nr_name"].ToString());
                     dic1.Add("nr_name", dt1.Rows[j]["nr_name"].ToString());
                     dic1.Add("nr_code", dt1.Rows[j]["nr_code"].ToString());
                     dic1.Add("nr_code", dt1.Rows[j]["nr_code"].ToString());
-                    tnode_1.Text = dt1.Rows[j]["mbr_brgcode"].ToString();
+                    tnode_1.Text = dt1.Rows[j]["nr_name"].ToString();
                     if (!BadInf_2.ContainsKey(mbr_id))
                     if (!BadInf_2.ContainsKey(mbr_id))
                         BadInf_2.Add(mbr_id, dic1);
                         BadInf_2.Add(mbr_id, dic1);
                     tnode_0.Nodes.Add(tnode_1);
                     tnode_0.Nodes.Add(tnode_1);
@@ -287,7 +294,7 @@ namespace UAS_MES.Make
                 else
                 else
                 {
                 {
                     dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
                     dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
-                    dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
+                    LogicHandler.InsertMakeProcess(ms_sncode.Text,ms_makecode.Text,User.UserSourceCode,"回流工序","完成维修回流",User.UserCode);
                     OperatResult.AppendText(">>" + ms_sncode.Text + " 序列号回流成功\n", Color.Green);
                     OperatResult.AppendText(">>" + ms_sncode.Text + " 序列号回流成功\n", Color.Green);
                     BaseUtil.CleanForm(this);
                     BaseUtil.CleanForm(this);
                     BadCodeTree.Nodes.Clear();
                     BadCodeTree.Nodes.Clear();

+ 2 - 0
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -479,12 +479,14 @@ namespace UAS_MES.Make
                 bc_code.Enabled = false;
                 bc_code.Enabled = false;
                 WaitReject.Enabled = false;
                 WaitReject.Enabled = false;
                 ChooseedReject.Enabled = false;
                 ChooseedReject.Enabled = false;
+                Save.Visible = false;
             }
             }
             else
             else
             {
             {
                 bc_code.Enabled = true;
                 bc_code.Enabled = true;
                 WaitReject.Enabled = true;
                 WaitReject.Enabled = true;
                 ChooseedReject.Enabled = true;
                 ChooseedReject.Enabled = true;
+                Save.Visible = true;
             }
             }
         }
         }
     }
     }

+ 30 - 15
UAS-MES/FunctionCode/OQC/OQC_BatchResultJudge.cs

@@ -40,7 +40,6 @@ namespace UAS_MES.OQC
                 BaseUtil.CleanForm(this);
                 BaseUtil.CleanForm(this);
                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
             }
             }
-            Console.WriteLine(ob_result.Text);
             switch (ob_result.Text)
             switch (ob_result.Text)
             {
             {
                 case "OK":
                 case "OK":
@@ -230,29 +229,45 @@ namespace UAS_MES.OQC
         /// <returns></returns>
         /// <returns></returns>
         private bool CheckBefore()
         private bool CheckBefore()
         {
         {
-            //如果AQL标准为空
-            if (ob_aqlcode.Text == "")
+            if (ob_maxngacceptqty.Text == "" || ob_maxngacceptqty.Text=="0")
             {
             {
-                if (ob_maxngacceptqty.Text == "")
-                    OperateResult.AppendText(">>AQL标准为空的时候必须填写最大不合格允许通过数\n", Color.Red);
+                if (ob_aqlcode.Text == "")
+                    OperateResult.AppendText(">>最大不合格允许通过数为空的时候必须填写维护AQL标准\n", Color.Red);
                 else
                 else
                 {
                 {
-                    sql.Clear();
-                    sql.Append("select wm_concat(oi_itemcode) codes from OQCitems where ");
-                    sql.Append("nvl(oi_checkqty,0)<oi_sampleqty  and oi_sampleqty>0 and rownum<30 and oi_checkno='" + ob_checkno.Text + "'");
-                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    dt = (DataTable)dh.ExecuteSql("select nvl(ad_minqty,0)ad_minqty,nvl(ad_maxqty,0)ad_maxqty,nvl(ad_maxngacceptqty,0)ad_maxngacceptqty from QUA_Aql left join qua_aqldetail on ad_alid=al_id where al_code='" + ob_aqlcode.Text + "'", "select");
                     if (dt.Rows.Count > 0)
                     if (dt.Rows.Count > 0)
                     {
                     {
-                        if (dt.Rows[0]["codes"].ToString() != "")
+                        for (int i = 0; i < dt.Rows.Count; i++)
                         {
                         {
-                            OperateResult.AppendText(">>项目编号抽检数未达到样本数,项目编号['" + ob_makecode.Text + "']\n", Color.Red);
-                            return false;
+                            int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+                            int minqty = int.Parse(dt.Rows[i]["ad_minqty"].ToString());
+                            int maxqty = int.Parse(dt.Rows[i]["ad_maxqty"].ToString());
+                            if (batchqty > minqty && batchqty <= maxqty)
+                            {
+                                ob_maxngacceptqty.Text = dt.Rows[i]["ad_maxngacceptqty"].ToString();
+                                return true;
+                            }
                         }
                         }
-                        else
-                            return true;
                     }
                     }
                 }
                 }
             }
             }
+            else {
+                sql.Clear();
+                sql.Append("select wm_concat(oi_itemcode) codes from OQCitems where ");
+                sql.Append("nvl(oi_checkqty,0)<oi_sampleqty  and oi_sampleqty>0 and rownum<30 and oi_checkno='" + ob_checkno.Text + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                if (dt.Rows.Count > 0)
+                {
+                    if (dt.Rows[0]["codes"].ToString() != "")
+                    {
+                        OperateResult.AppendText(">>项目编号抽检数未达到样本数,项目编号[" + dt.Rows[0]["codes"].ToString() + "]\n", Color.Red);
+                        return false;
+                    }
+                    else
+                        return true;
+                }
+            }
             return false;
             return false;
         }
         }
 
 
@@ -286,7 +301,7 @@ namespace UAS_MES.OQC
                     string ErrorMessage = "";
                     string ErrorMessage = "";
                     LogicHandler.UpdateMakeMessage(ms_sncode.Text, ob_makecode.Text, "OQC批判过", User.UserSourceCode, User.UserName, "批次通过", out ErrorMessage);
                     LogicHandler.UpdateMakeMessage(ms_sncode.Text, ob_makecode.Text, "OQC批判过", User.UserSourceCode, User.UserName, "批次通过", out ErrorMessage);
                     //记录操作日志
                     //记录操作日志
-                    LogicHandler.InsertMakeProcess(ms_sncode.Text, ob_makecode.Text, User.UserSourceCode,"批结果判定", Operate, User.UserName);
+                    LogicHandler.InsertMakeProcess(ms_sncode.Text, ob_makecode.Text, User.UserSourceCode, "批结果判定", Operate, User.UserName);
                 }
                 }
             }
             }
         }
         }

+ 2 - 16
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.Designer.cs

@@ -46,7 +46,6 @@
             this.ob_status = new System.Windows.Forms.Label();
             this.ob_status = new System.Windows.Forms.Label();
             this.ob_aqlcode_label = new System.Windows.Forms.Label();
             this.ob_aqlcode_label = new System.Windows.Forms.Label();
             this.ob_maxngacceptqty_label = new System.Windows.Forms.Label();
             this.ob_maxngacceptqty_label = new System.Windows.Forms.Label();
-            this.ChooseAll = new System.Windows.Forms.CheckBox();
             this.ob_projectcode_label = new System.Windows.Forms.Label();
             this.ob_projectcode_label = new System.Windows.Forms.Label();
             this.ob_maxngacceptqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_maxngacceptqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_aqlcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_aqlcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -187,7 +186,7 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             | System.Windows.Forms.AnchorStyles.Right)));
             this.label6.AutoSize = true;
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(807, 71);
+            this.label6.Location = new System.Drawing.Point(807, 72);
             this.label6.Name = "label6";
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(58, 21);
             this.label6.Size = new System.Drawing.Size(58, 21);
             this.label6.TabIndex = 189;
             this.label6.TabIndex = 189;
@@ -282,17 +281,6 @@
             this.ob_maxngacceptqty_label.TabIndex = 216;
             this.ob_maxngacceptqty_label.TabIndex = 216;
             this.ob_maxngacceptqty_label.Text = "最大不合格通过数";
             this.ob_maxngacceptqty_label.Text = "最大不合格通过数";
             // 
             // 
-            // ChooseAll
-            // 
-            this.ChooseAll.AutoSize = true;
-            this.ChooseAll.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseAll.Location = new System.Drawing.Point(16, 502);
-            this.ChooseAll.Name = "ChooseAll";
-            this.ChooseAll.Size = new System.Drawing.Size(61, 25);
-            this.ChooseAll.TabIndex = 199;
-            this.ChooseAll.Text = "全选";
-            this.ChooseAll.UseVisualStyleBackColor = true;
-            // 
             // ob_projectcode_label
             // ob_projectcode_label
             // 
             // 
             this.ob_projectcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             this.ob_projectcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -611,7 +599,7 @@
             this.oi_checkqty.BackColor = System.Drawing.Color.White;
             this.oi_checkqty.BackColor = System.Drawing.Color.White;
             this.oi_checkqty.Enabled = false;
             this.oi_checkqty.Enabled = false;
             this.oi_checkqty.ID = null;
             this.oi_checkqty.ID = null;
-            this.oi_checkqty.Location = new System.Drawing.Point(908, 72);
+            this.oi_checkqty.Location = new System.Drawing.Point(908, 73);
             this.oi_checkqty.Name = "oi_checkqty";
             this.oi_checkqty.Name = "oi_checkqty";
             this.oi_checkqty.Power = null;
             this.oi_checkqty.Power = null;
             this.oi_checkqty.Size = new System.Drawing.Size(147, 21);
             this.oi_checkqty.Size = new System.Drawing.Size(147, 21);
@@ -891,7 +879,6 @@
             this.Controls.Add(this.ob_remark_label);
             this.Controls.Add(this.ob_remark_label);
             this.Controls.Add(this.sncode);
             this.Controls.Add(this.sncode);
             this.Controls.Add(this.label10);
             this.Controls.Add(this.label10);
-            this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.CheckTypeDGV);
             this.Controls.Add(this.CheckTypeDGV);
             this.Controls.Add(this.ChooseedReject);
             this.Controls.Add(this.ChooseedReject);
             this.Controls.Add(this.WaitReject);
             this.Controls.Add(this.WaitReject);
@@ -983,7 +970,6 @@
         private System.Windows.Forms.Label ob_maxngacceptqty_label;
         private System.Windows.Forms.Label ob_maxngacceptqty_label;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_code1;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_code1;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_name1;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_name1;
-        private System.Windows.Forms.CheckBox ChooseAll;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Column3;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Column3;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_code;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_code;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_name;
         private System.Windows.Forms.DataGridViewTextBoxColumn bg_name;

+ 29 - 13
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -274,29 +274,45 @@ namespace UAS_MES.OQC
 
 
         private bool CheckBefore()
         private bool CheckBefore()
         {
         {
-            //如果AQL标准为空
-            if (ob_aqlcode.Text == "")
+            if (ob_maxngacceptqty.Text == "" || ob_maxngacceptqty.Text == "0")
             {
             {
-                if (ob_maxngacceptqty.Text == "")
-                    OperateResult.AppendText(">>AQL标准为空的时候必须填写最大不合格允许通过数\n", Color.Red);
+                if (ob_aqlcode.Text == "")
+                    OperateResult.AppendText(">>最大不合格允许通过数为空的时候必须填写维护AQL标准\n", Color.Red);
                 else
                 else
                 {
                 {
-                    sql.Clear();
-                    sql.Append("select wm_concat(oi_itemcode) codes from OQCitems where ");
-                    sql.Append("nvl(oi_checkqty,0)<oi_sampleqty  and oi_sampleqty>0 and rownum<30 and oi_checkno='" + ob_checkno.Text + "'");
-                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    dt = (DataTable)dh.ExecuteSql("select nvl(ad_minqty,0)ad_minqty,nvl(ad_maxqty,0)ad_maxqty,nvl(ad_maxngacceptqty,0)ad_maxngacceptqty from QUA_Aql left join qua_aqldetail on ad_alid=al_id where al_code='" + ob_aqlcode.Text + "'", "select");
                     if (dt.Rows.Count > 0)
                     if (dt.Rows.Count > 0)
                     {
                     {
-                        if (dt.Rows[0]["codes"].ToString() != "")
+                        for (int i = 0; i < dt.Rows.Count; i++)
                         {
                         {
-                            OperateResult.AppendText(">>项目编号抽检数未达到样本数,项目编号['" + ob_makecode.Text + "']\n", Color.Red);
-                            return false;
+                            int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+                            int minqty = int.Parse(dt.Rows[i]["ad_minqty"].ToString());
+                            int maxqty = int.Parse(dt.Rows[i]["ad_maxqty"].ToString());
+                            if (batchqty > minqty && batchqty <= maxqty)
+                            {
+                                ob_maxngacceptqty.Text = dt.Rows[i]["ad_maxngacceptqty"].ToString();
+                                return true;
+                            }
                         }
                         }
-                        else
-                            return true;
                     }
                     }
                 }
                 }
             }
             }
+            else {
+                sql.Clear();
+                sql.Append("select wm_concat(oi_itemcode) codes from OQCitems where ");
+                sql.Append("nvl(oi_checkqty,0)<oi_sampleqty  and oi_sampleqty>0 and rownum<30 and oi_checkno='" + ob_checkno.Text + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                if (dt.Rows.Count > 0)
+                {
+                    if (dt.Rows[0]["codes"].ToString() != "")
+                    {
+                        OperateResult.AppendText(">>项目编号抽检数未达到样本数,项目编号[" + dt.Rows[0]["codes"].ToString() + "]\n", Color.Red);
+                        return false;
+                    }
+                    else
+                        return true;
+                }
+            }
             return false;
             return false;
         }
         }
 
 

+ 1 - 1
UAS-MES/Login.cs

@@ -98,7 +98,7 @@ namespace UAS_MES
                 {
                 {
                     this.Hide();
                     this.Hide();
                     SetInf();//设置User的全局变量
                     SetInf();//设置User的全局变量
-                    LogManager.DoLog("登陆成功" + User.UserName + ",超级用户");
+                    LogManager.DoLog("登陆成功" + User.UserName +"  "+User.UserAccountType);
                     Main dialog = new Main();
                     Main dialog = new Main();
                     dialog.ShowDialog();
                     dialog.ShowDialog();
                     this.Close();
                     this.Close();

+ 1 - 0
UAS-MES/Program.cs

@@ -41,6 +41,7 @@ namespace UAS_MES
                     Directory.CreateDirectory(sysdisc + @":\Log");
                     Directory.CreateDirectory(sysdisc + @":\Log");
                 FileStream fs = new FileStream(sysdisc + @":\Log\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 FileStream fs = new FileStream(sysdisc + @":\Log\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 fs.Close();
                 fs.Close();
+                LogManager.DoLog(Application.StartupPath);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                     Application.Run(new Login());
                     Application.Run(new Login());
                 else
                 else

+ 4 - 7
UAS-MES/PublicMethod/LogicHandler.cs

@@ -421,7 +421,6 @@ namespace UAS_MES.PublicMethod
 
 
         public static bool CheckStepSNAndMacode(string iMakeCode, string iSourceCode, string iSN, string iUserCode, out string oMakeCode, out string oMsID, out string oErrorMessage)
         public static bool CheckStepSNAndMacode(string iMakeCode, string iSourceCode, string iSN, string iUserCode, out string oMakeCode, out string oMsID, out string oErrorMessage)
         {
         {
-            Console.WriteLine("iMakeCode" + iMakeCode);
             oErrorMessage = "";
             oErrorMessage = "";
             oMakeCode = "";
             oMakeCode = "";
             oMsID = "";
             oMsID = "";
@@ -898,7 +897,7 @@ namespace UAS_MES.PublicMethod
                     dh.ExecuteSql(sql.ToString(), "update");
                     dh.ExecuteSql(sql.ToString(), "update");
                     //查询Form数据
                     //查询Form数据
                     sql.Clear();
                     sql.Clear();
-                    sql.Append("select ob_id,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
+                    sql.Append("select ob_id,ob_aqlcode,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
                     sql.Append("ob_batchqty,nvl(ob_okqty,0) ob_okqty,nvl(ob_ngqty,0) ob_ngqty,ob_maxngacceptqty,ob_source,ob_checkno,ob_result from OQCBatch where ob_checkno='" + iCheckNo + "'");
                     sql.Append("ob_batchqty,nvl(ob_okqty,0) ob_okqty,nvl(ob_ngqty,0) ob_ngqty,ob_maxngacceptqty,ob_source,ob_checkno,ob_result from OQCBatch where ob_checkno='" + iCheckNo + "'");
                     Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     if (Form.Rows.Count == 0)
                     if (Form.Rows.Count == 0)
@@ -919,8 +918,8 @@ namespace UAS_MES.PublicMethod
         /// <param name="iMakeCode"></param>
         /// <param name="iMakeCode"></param>
         /// <param name="iMPKind"></param>
         /// <param name="iMPKind"></param>
         /// <param name="result"></param>
         /// <param name="result"></param>
-        /// <param name="iUserName"></param>
-        public static void InsertMakeProcess(string iSnCode, string iMakeCode,string iSourceCode, string iMPKind, string result, string iUserName)
+        /// <param name="iUserCode"></param>
+        public static void InsertMakeProcess(string iSnCode, string iMakeCode,string iSourceCode, string iMPKind, string result, string iUserCode)
         {
         {
             string CurrentStep = "";
             string CurrentStep = "";
             string LineCode = "";
             string LineCode = "";
@@ -930,7 +929,7 @@ namespace UAS_MES.PublicMethod
             sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
             sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
             sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
             sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
             sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,");
             sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,");
-            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserName + "',ma_wccode,'"+ LineCode + "','"+ iSourceCode + "',");
+            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'"+ LineCode + "','"+ iSourceCode + "',");
             sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code ");
             sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code ");
             sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='"+ CurrentStep + "'");
             sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='"+ CurrentStep + "'");
             dh.ExecuteSql(sql.ToString(), "insert");
             dh.ExecuteSql(sql.ToString(), "insert");
@@ -993,8 +992,6 @@ namespace UAS_MES.PublicMethod
             oErrorMessage = "";
             oErrorMessage = "";
             string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
             string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
             string CurrentStep = GetStepCodeBySource(iSourceCode);
-            Console.WriteLine("StepCode" + StepCode);
-            Console.WriteLine("CurrentStep" + CurrentStep);
             if (StepCode == CurrentStep)
             if (StepCode == CurrentStep)
             {
             {
                 InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
                 InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);

+ 1 - 1
UAS-MES/UAS-MES.csproj

@@ -41,7 +41,7 @@
     <MinimumRequiredVersion>1.0.0.201</MinimumRequiredVersion>
     <MinimumRequiredVersion>1.0.0.201</MinimumRequiredVersion>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>248</ApplicationRevision>
+    <ApplicationRevision>249</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>true</UseApplicationTrust>
     <UseApplicationTrust>true</UseApplicationTrust>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>