Browse Source

修改召回上料

callm 6 days ago
parent
commit
6a804fd03b
1 changed files with 17 additions and 6 deletions
  1. 17 6
      UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionReCall.cs

+ 17 - 6
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionReCall.cs

@@ -176,7 +176,8 @@ namespace UAS_MES_NEW.Make
                             string resultstr = "";
                             string subfix = "";
                             string userate = "0";
-                            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))
+                            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 (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -206,7 +207,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(sp_fsoncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix);
+                                Save_OtherCode(fsoncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix);
                             }
                             else
                             {
@@ -418,14 +419,24 @@ namespace UAS_MES_NEW.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             sql.Clear();
-            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("select 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,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 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,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 + "' ");
             sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_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("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
+            sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
+            sql.Append("select 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,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");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             //用于记录提醒的数据长度
@@ -549,7 +560,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)
         {
-            CollectDataSonCode.Add(sp_soncode);
+            CollectDataSonCode.Add(sp_fsoncode);
             ReturnUseRate.Add(userate);
             ReturnSubFix.Add(subfix);
             //采集成功提示
@@ -560,7 +571,7 @@ namespace UAS_MES_NEW.Make
                 CheckBarcode.Add(sp_fsoncode, code.Text);
             }
             SPID.Add(sp_id);
-            OperateResult.AppendText(">>物料" + sp_soncode + "采集成功,条码" + code.Text + "\n", Color.Green);
+            OperateResult.AppendText(">>物料" + sp_fsoncode + "采集成功,条码" + code.Text + "\n", Color.Green);
             LabelDataGridView.Rows[RemainIndex].Cells["BarCode"].Value = code.Text;
             if (code.Text.Length > 80)
                 OperateResult.AppendText(">>采集条码" + code.Text + "程度超过长度限制80,内容截取前80位进行采集\n", Color.Red);