Browse Source

DC限制修改

callm 1 year ago
parent
commit
ab8d6274d8

File diff suppressed because it is too large
+ 734 - 708
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs


+ 26 - 2
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -361,6 +361,29 @@ namespace UAS_LabelMachine
                     string close = MessageBox.Show(this.ParentForm, "物料" + Data["PRCODE"] + "【DateCode】超出校验日期\n", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                     if (close.ToString() != "Yes")
                         return;
+
+                }
+            }
+            if (CheckDC.Checked)
+            {
+                string datecode = dh.getFieldDataByCondition("prodiobarcode", "max(case when length(pib_datecode)=4 then pib_datecode else to_char(to_date(custdate(pib_datecode),'yyyy-mm-dd'),'yyiw') end )", "PIB_CUSTCODE='" + pi_cardcode.Text + "' and pib_inoutno<>'" + pi_inoutno.Text + "' and pib_prodcode='" + Data["PRCODE"] + "'").ToString();
+                string datecod1 = dh.getFieldDataByCondition("dual", "case when length('" + Data["DATECODE"] + "')=4 then  '" + Data["DATECODE"] + "' else to_char(to_date(custdate('" + Data["DATECODE"] + "'),'yyyy-mm-dd'),'yyiw') end", "1=1").ToString();
+                //客户已经出货的最大年周
+                string Year = datecode.Substring(0, 2);
+                System.DateTime dt = new DateTime(int.Parse("20" + Year), 01, 01);
+                string Week = datecode.Substring(2, 2);
+                System.DateTime dt1 = dt.AddDays(int.Parse(Week) * 7);
+
+                //当前扫码的年周
+                string Year1 = datecod1.Substring(0, 2);
+                System.DateTime dt2 = new DateTime(int.Parse("20" + Year1), 01, 01);
+                string Week1 = datecod1.Substring(2, 2);
+                System.DateTime dt3 = dt2.AddDays(int.Parse(Week1) * 7);
+                //当前扫码的年周
+                if (dt1 > dt3)
+                {
+                    MessageBox.Show("客户出货日期最近DC【" + datecode + "】,不允许采集【" + Data["DATECODE"] + "】");
+                    return;
                 }
             }
             if (Data["BRAND"] != CurrentBrand)
@@ -864,7 +887,7 @@ namespace UAS_LabelMachine
                 LoadCheck = true;
                 Input.Clear();
                 sql.Clear();
-                sql.Append("select pi_id,pi_cardcode,pi_combine_user,pi_title,to_char(pi_date,'yyyymmdd')pi_date,nvl(pi_combine_user,0)pi_combine_user from prodinout where pi_inoutno='" + pi_inoutno.Text + "' and pi_invostatuscode='AUDITED'");
+                sql.Append("select pi_id,pi_cardcode,pi_combine_user,pi_title,to_char(pi_date,'yyyymmdd')pi_date,nvl(pi_combine_user,0)pi_combine_user,nvl(cu_controlinout,0)cu_controlinout from prodinout left join customer on pi_cardcode=cu_code where pi_inoutno='" + pi_inoutno.Text + "' and pi_invostatuscode='AUDITED'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -872,6 +895,7 @@ namespace UAS_LabelMachine
                     pi_title.Text = dt.Rows[0]["pi_title"].ToString();
                     pi_date.Text = dt.Rows[0]["pi_date"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
+                    cu_controlinout.Text = dt.Rows[0]["cu_controlinout"].ToString();
                     switch (dt.Rows[0]["pi_combine_user"].ToString())
                     {
                         case "1":
@@ -2149,7 +2173,7 @@ namespace UAS_LabelMachine
             {
                 //根据DateCode计算的日期
                 string Year = DateCode.Substring(0, 2);
-                System.DateTime dt = new System.DateTime(int.Parse("20" + Year), 01, 01);
+                System.DateTime dt = new DateTime(int.Parse("20" + Year), 01, 01);
                 string Week = DateCode.Substring(2, 2);
                 System.DateTime dt1 = dt.AddDays(int.Parse(Week) * 7);
 

+ 26 - 2
UAS_MES_ODLF/CustomControl/TextBoxWithIcon/SourceStepCount.cs

@@ -17,6 +17,8 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
 
         string Source1;
 
+        string makecode1;
+
         public string Source
         {
             get
@@ -73,11 +75,25 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
             }
         }
 
+        public string Makecode
+        {
+            get
+            {
+                return makecode1;
+            }
+
+            set
+            {
+                makecode1 = value;
+            }
+        }
+
         public SourceStepCount()
         {
             InitializeComponent();
         }
 
+
         private void SourceStepCount_Load(object sender, EventArgs e)
         {
             //五分钟刷新一次
@@ -89,7 +105,11 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
             string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
             SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
             DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
-            Count.Text = "计数:" + dt.Rows[0][0].ToString();
+
+            string SQL1 = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
+            SQL1 += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' and mp_makecode='" + makecode1 + "'";
+            DataTable dt1 = (DataTable)Dh.ExecuteSql(SQL1, "select");
+            Count.Text = "计数:" + dt.Rows[0][0].ToString() + "  工单:" + dt1.Rows[0][0].ToString();
             CountRefresh.Start();
         }
 
@@ -103,7 +123,11 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
             string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
             SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
             DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
-            Count.Text = "计数:" + dt.Rows[0][0].ToString();
+
+            string SQL1 = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
+            SQL1 += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' and mp_makecode='" + makecode1 + "'";
+            DataTable dt1 = (DataTable)Dh.ExecuteSql(SQL1, "select");
+            Count.Text = "计数:" + dt.Rows[0][0].ToString() + "  工单:" + dt1.Rows[0][0].ToString();
         }
     }
 }

Some files were not shown because too many files changed in this diff