callm 5 өдөр өмнө
parent
commit
83ff6f90ae

+ 9 - 11
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionBadOnlyNEW.cs

@@ -66,8 +66,6 @@ namespace UAS_MES_NEW.Make
 
         List<string> SPID = new List<string>();
 
-        List<string> SpType = new List<string>();
-
         List<string> SpSNType = new List<string>();
 
         List<string> ReturnUseRate = new List<string>();
@@ -177,13 +175,14 @@ namespace UAS_MES_NEW.Make
                             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 sptype = dt1.Rows[RemainIndex]["sptype"].ToString();
+                         
                             string sp_sntype = dt1.Rows[RemainIndex]["sp_sntype"].ToString();
                             string resultstr = "";
                             string subfix = "";
                             string userate = "0";
                             string soncode = "";
-                            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 userate, out subfix, out soncode, out ErrorMessage))
+                            string sntype = "";
+                            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, sp_sntype, out resultstr, out userate, out subfix, out soncode,out sntype, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -213,7 +212,7 @@ namespace UAS_MES_NEW.Make
                                     sp_soncode = ErrorMessage;
                                 }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上物料", sn_code.Text + "上物料" + code.Text + "料号" + sp_fsoncode, sn_code.Text, "");
-                                Save_OtherCode(soncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sptype, sp_sntype);
+                                Save_OtherCode(soncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sp_sntype);
                             }
                             else
                             {
@@ -553,13 +552,12 @@ namespace UAS_MES_NEW.Make
         }
 
         //此类中通用的保存逻辑
-        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix, string sptype, string sp_sntype)
+        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix,string sp_sntype)
         {
             LogicHandler.CheckBarcode(ma_code, ms_sncode, code.Text, resultstr, Tag.ToString());
             CollectDataSonCode.Add(sp_fsoncode);
             ReturnUseRate.Add(userate);
             ReturnSubFix.Add(subfix);
-            SpType.Add(sptype);
             SpSNType.Add(sp_sntype);
             //采集成功提示
             ResultStr.Add(resultstr);
@@ -587,10 +585,10 @@ namespace UAS_MES_NEW.Make
                 sql.Append("cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate,cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn,cm_substr,cm_subfix,cm_rate,cm_type,cm_sntype)");
                 sql.Append("select Craftmaterial_seq.nextval,sp_prodtype, ma_code, ma_id, ma_prodcode,:soncode,ms_code,ms_sncode,mcd_stepcode,");
                 sql.Append("mcd_stepname,sp_fsoncode,ms_craftcode,ms_craftname,:barcode,1,sysdate,'" + User.UserCode + "','" + User.UserLineCode + "',ma_wccode,");
-                sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn,:substr,:subfix,:rate,:sptype,:spsntype from make left join makecraftdetail on mcd_maid=ma_id  left join stepproduct on sp_stepcode=mcd_stepcode ");
+                sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn,:substr,:subfix,:rate,:spsntype from make left join makecraftdetail on mcd_maid=ma_id  left join stepproduct on sp_stepcode=mcd_stepcode ");
                 sql.Append(" and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode ");
                 sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1  and ms_sncode='" + ms_sncode + "'");
-                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "sptype", "spsntype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(), ReturnUseRate.ToArray(), SpType.ToArray(), SpSNType.ToArray(), SPID.ToArray());
+                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "spsntype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(), ReturnUseRate.ToArray(),  SpSNType.ToArray(), SPID.ToArray());
                 try
                 {
                     string Log = "";
@@ -624,7 +622,7 @@ namespace UAS_MES_NEW.Make
                 SPID.Clear();
                 ReturnUseRate.Clear();
                 ReturnSubFix.Clear();
-                SpType.Clear();
+           
                 SpSNType.Clear();
                 ResultStr.Clear();
                 CheckBarcode.Clear();
@@ -644,7 +642,7 @@ namespace UAS_MES_NEW.Make
             CheckBarcode.Clear();
             ReturnUseRate.Clear();
             ReturnSubFix.Clear();
-            SpType.Clear();
+       
             SpSNType.Clear();
             ResultStr.Clear();
             CollectData.Clear();

+ 13 - 12
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionNEW.cs

@@ -67,7 +67,7 @@ namespace UAS_MES_NEW.Make
 
         List<string> CollectDataSonCode = new List<string>();
 
-        List<string> SpType = new List<string>();
+        List<string> SpSNType = new List<string>();
 
         List<string> SPID = new List<string>();
 
@@ -174,12 +174,13 @@ namespace UAS_MES_NEW.Make
                             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 sptype = dt1.Rows[RemainIndex]["sptype"].ToString();
+                            string sp_sntype = dt1.Rows[RemainIndex]["sp_sntype"].ToString();
                             string resultstr = "";
                             string subfix = "";
                             string userate = "0";
                             string fsoncode = "";
-                            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 userate, out subfix, out fsoncode, out ErrorMessage))
+                            string sntype = "";
+                            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, sp_sntype, out resultstr, out userate, out subfix, out fsoncode, out sntype, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -209,7 +210,7 @@ namespace UAS_MES_NEW.Make
                                     sp_soncode = ErrorMessage;
                                 }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上物料", sn_code.Text + "上物料" + code.Text + "料号" + sp_fsoncode, sn_code.Text, "");
-                                Save_OtherCode(fsoncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sptype);
+                                Save_OtherCode(fsoncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sntype);
                             }
                             else
                             {
@@ -423,7 +424,7 @@ namespace UAS_MES_NEW.Make
             sql.Clear();
             sql.Append("select max(sptype)sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end A,SP_ID, max(sp_rate)sp_rate,replace(wm_concat(sp_fsoncode),',','?')sp_fsoncode,replace(wm_concat(sp_prefix),',','?')sp_prefix,max(pr_lightbox)pr_lightbox,replace(wm_concat(nvl(sp_subnum,0)),',','?')sp_subnum,replace(wm_concat(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,max(sp_barcoderule)sp_barcoderule,replace(wm_concat(sp_sntype),',','?')sp_sntype,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)sp_ifforsn,replace(wm_concat(sp_length),',','?')sp_length,max(sp_type)sp_type,max(sp_regex)sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from(");
             sql.Append("select '主料' sptype,0 spr_id,-1 spr_isreplace,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,max(sp_sntype)sp_sntype,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
+            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,max(nvl(sp_sntype,'原厂'))sp_sntype,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 ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
@@ -431,14 +432,14 @@ namespace UAS_MES_NEW.Make
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
             sql.Append("select '替代' sptype,spr_id,max(spr_isreplace),max(spr_rate)spr_rate,max(pr_lightbox)pr_lightbox,spr_spid,max(nvl(spr_subnum,0))spr_subnum,max(nvl(spr_subnumlength,0))spr_subnumlength,max(spr_detno)spr_detno,min(spr_ifrepeat)spr_ifrepeat,max(spr_checkbarcode)spr_checkbarcode,min(spr_checksalecode)spr_checksalecode,");
-            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,max(spr_sntype)spr_sntype,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
+            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,max(nvl(spr_sntype,'原厂'))spr_sntype,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
             sql.Append("spr_ifforsn,max(spr_length)spr_length,max(spr_type)spr_type,replace(wm_concat(spr_prefix),',','|')spr_prefix,max(spr_regex)");
             sql.Append("spr_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproductrep left join product on pr_code=spr_fsoncode where ");
             sql.Append("spr_bomversion='" + ms_bomversion.Text + "' and spr_craftcode='" + ms_craftcode.Text + "' and spr_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("And spr_mothercode ='" + ma_prodcode.Text + "' and spr_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("spr_fsoncode and cm_status=0 and cm_stepcode=spr_stepcode) group by spr_fsoncode,spr_id,spr_spid ");
-            sql.Append(") group by case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sp_id order by sp_id");
+            sql.Append(") group by sp_sntype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sp_id order by sp_id");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             //用于记录提醒的数据长度
@@ -560,7 +561,7 @@ namespace UAS_MES_NEW.Make
         }
 
         //此类中通用的保存逻辑
-        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix, string sptype)
+        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix, string spsntype)
         {
             LogicHandler.CheckBarcode(ma_code, ms_sncode, code.Text, resultstr, Tag.ToString());
             CollectDataSonCode.Add(sp_fsoncode);
@@ -569,7 +570,7 @@ namespace UAS_MES_NEW.Make
             ReturnUseRate.Add(userate);
             ReturnSubFix.Add(subfix);
             CollectData.Add(code.Text);
-            SpType.Add(sptype);
+            SpSNType.Add(spsntype);
             if (!CheckBarcode.ContainsKey(sp_fsoncode))
             {
                 CheckBarcode.Add(sp_fsoncode, code.Text);
@@ -596,7 +597,7 @@ namespace UAS_MES_NEW.Make
                 sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn,:substr,:subfix,:rate,:sptype from make left join makecraftdetail on mcd_maid=ma_id  left join stepproduct on sp_stepcode=mcd_stepcode ");
                 sql.Append(" and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode ");
                 sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1 and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode + "'");
-                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "sptype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(), ReturnUseRate.ToArray(), SpType.ToArray(), SPID.ToArray());
+                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "sptype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(), ReturnUseRate.ToArray(), SpSNType.ToArray(), SPID.ToArray());
                 try
                 {
                     string Log = "";
@@ -630,7 +631,7 @@ namespace UAS_MES_NEW.Make
                 SPID.Clear();
                 ReturnUseRate.Clear();
                 ReturnSubFix.Clear();
-                SpType.Clear();
+                SpSNType.Clear();
                 ResultStr.Clear();
                 CheckBarcode.Clear();
                 CollectDataSonCode.Clear();
@@ -671,7 +672,7 @@ namespace UAS_MES_NEW.Make
             CheckBarcode.Clear();
             ReturnUseRate.Clear();
             ReturnSubFix.Clear();
-            SpType.Clear();
+            SpSNType.Clear();
             ResultStr.Clear();
             CollectData.Clear();
             CollectDataSonCode.Clear();

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

@@ -177,7 +177,7 @@ namespace UAS_MES_NEW.Make
                             string subfix = "";
                             string userate = "0";
                             string fsoncode = "";
-                            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 userate, out subfix,out fsoncode, 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 userate, out subfix, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")

+ 5 - 1
UAS_MES_YDCY/PublicMethod/LogicHandler.cs

@@ -1473,7 +1473,7 @@ namespace UAS_MES_NEW.PublicMethod
             return false;
         }
 
-        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 UseRate, out string MatchFix, out string Fsoncode, 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,string iSNType, out string Resultstr, out string UseRate, out string MatchFix, out string Fsoncode,out string oSNType, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1481,6 +1481,7 @@ namespace UAS_MES_NEW.PublicMethod
             UseRate = "0";
             MatchFix = "";
             Fsoncode = "";
+            oSNType = "";
             switch (iRule)
             {
                 case "TSN":
@@ -1563,6 +1564,7 @@ namespace UAS_MES_NEW.PublicMethod
                     if (iIfRepeat != "-1")
                     {
                         string[] subnum = iSubNum.Split('?');
+                     
                         string[] subnumlength = iSubNumLength.Split('?');
                         for (int i = 0; i < subnum.Length; i++)
                         {
@@ -1648,6 +1650,7 @@ namespace UAS_MES_NEW.PublicMethod
                     string[] prerep = iPrefix.Split('?');
                     string[] fsoncode = iFSonCode.Split('?');
                     string[] length = iLength.Split('?');
+                    string[] sntype = iSNType.Split('?');
                     for (int i = 0; i < fsoncode.Length; i++)
                     {
                         ErrMessage = "";
@@ -1700,6 +1703,7 @@ namespace UAS_MES_NEW.PublicMethod
                             if (iSN.Length == sp_length || sp_length == 0)
                             {
                                 Fsoncode = fsoncode[i];
+                                oSNType = sntype[i];
                                 ErrMessage = "";
                                 return true;
                             }