Просмотр исходного кода

工单设置物料比例修改

callm 1 неделя назад
Родитель
Сommit
c55edde641

+ 3 - 2
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollection.cs

@@ -167,8 +167,9 @@ namespace UAS_MES_NEW.Make
                             string sp_checksalecode = dt1.Rows[RemainIndex]["sp_checksalecode"].ToString();
                             string sp_subnum = dt1.Rows[RemainIndex]["sp_subnum"].ToString();
                             string sp_subnumlength = dt1.Rows[RemainIndex]["sp_subnumlength"].ToString();
+                            string sp_rate = dt1.Rows[RemainIndex]["sp_rate"].ToString();
                             string resultstr = "";
-                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, sn_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, sp_subnum, sp_subnumlength, "0", out resultstr, out ErrorMessage))
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, sn_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, sp_subnum, sp_subnumlength, "0", sp_rate, out resultstr, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -410,7 +411,7 @@ namespace UAS_MES_NEW.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             sql.Clear();
-            sql.Append("select max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
+            sql.Append("select max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
             sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");

+ 1 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionBadOnly.cs

@@ -302,7 +302,7 @@ namespace UAS_MES_NEW.Make
             //将录入框的值给序列号
             sn_code.Text = code.Text;
             sql.Clear();
-            sql.Append("select ma_prodcode,ma_ecncode,ms_sncode,ma_softversion,ms_firstsn,ma_bomversion,ma_qty,ma_code,pr_spec,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
+            sql.Append("select ma_prodcode,ma_ecncode,ms_sncode,ma_softversion,ms_firstsn,ms_bomversion ma_bomversion,ma_qty,ma_code,pr_spec,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
             sql.Append(",ms_prodcode,ms_makecode,ms_code,ms_stepname  from makeserial left join make on ma_code=ms_makecode ");
             sql.Append("left join product on ms_prodcode=pr_code where ms_sncode='" + code.Text + "' order by ms_id desc");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");

+ 3 - 2
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionReCall.cs

@@ -167,8 +167,9 @@ namespace UAS_MES_NEW.Make
                             string sp_checksalecode = dt1.Rows[RemainIndex]["sp_checksalecode"].ToString();
                             string sp_subnum = dt1.Rows[RemainIndex]["sp_subnum"].ToString();
                             string sp_subnumlength = dt1.Rows[RemainIndex]["sp_subnumlength"].ToString();
+                            string sp_rate = dt1.Rows[RemainIndex]["sp_rate"].ToString();
                             string resultstr = "";
-                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, sn_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, sp_subnum, sp_subnumlength,ms_edistatus, out resultstr, out ErrorMessage))
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, sn_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, sp_subnum, sp_subnumlength, ms_edistatus, sp_rate, out resultstr, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -410,7 +411,7 @@ namespace UAS_MES_NEW.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             sql.Clear();
-            sql.Append("select max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
+            sql.Append("select max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
             sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");

+ 23 - 2
UAS_MES_YDCY/PublicMethod/LogicHandler.cs

@@ -1,4 +1,5 @@
-using System;
+using LabelManager2;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
@@ -1220,7 +1221,7 @@ namespace UAS_MES_NEW.PublicMethod
             return param[4];
         }
 
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iMsSncode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, string iSubNum, string iSubNumLength, string iEdiStatus, out string Resultstr, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iMsSncode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, string iSubNum, string iSubNumLength, string iEdiStatus, string iRate, out string Resultstr, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1345,6 +1346,26 @@ namespace UAS_MES_NEW.PublicMethod
                                 return false;
                             }
                         }
+                        if (iRate != "")
+                        {
+                            int ma_qty = int.Parse(dh.getFieldDataByCondition("make", "ma_qty", "ma_code='" + iMakeCode + "'").ToString());
+                            string[] kind = iRate.Split('|');
+                            for (int i = 0; i < kind.Length; i++)
+                            {
+                                double precent = double.Parse(kind[i].Split('#')[1]);
+                                string subfix = (kind[i].Split('#')[0]);
+                                if (iSN.Substring(iSN.Length - 1) == subfix)
+                                {
+                                    double total = ma_qty * precent;
+                                    int count = dh.getRowCount("craftmaterial", "cm_makecode='" + iMakeCode + "' and cm_fsoncode='" + iFSonCode + "' and cm_status=0 and substr(cm_barcode,-1)='" + subfix + "'");
+                                    if (count >= total)
+                                    {
+                                        ErrMessage = "条码" + iSN + "比例不允许超过工单设置比例,已上料" + count + "工单设置数量" + total;
+                                        return false;
+                                    }
+                                }
+                            }
+                        }
                     }
                     int sp_length = int.Parse(iLength != "" ? iLength : "0");
                     //若有多个,以|分割