Pārlūkot izejas kodu

【漳州万利达MES】【2020030462】【漳州万利达MES工单备料替代料问题补充】

caosy 5 gadi atpakaļ
vecāks
revīzija
4dcdfa74a4

+ 16 - 6
src/com/uas/mes/pm/service/impl/MakePrepareServiceImpl.java

@@ -629,7 +629,7 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 		}else {
 			//备料信息整合
 		 matList = baseDao.getJdbcTemplate().query("select max(md_repcode) partNumber,MD_NEEDQTY quantity,'" + lineCode + "' productLine,MD_LOCATION feederLocation " +
-					"from makePreparedetail where md_barcode is null and md_prodcode <> md_repcode and md_mpid = " + id + " group by MD_NEEDQTY,MD_LOCATION", new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
+					"from makePreparedetail where md_barcode is null and md_prodcode <> md_repcode and md_repcode is not null and md_mpid = " + id + " group by MD_NEEDQTY,MD_LOCATION", new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
 		}
 
 		if(!CollectionUtil.isEmpty(matList)){
@@ -671,11 +671,21 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 									List<Map<Object, Object>> resMatlist = (List<Map<Object, Object>>) resMatlistStr;
 									for (Iterator iterator = resMatlist.iterator(); iterator.hasNext();) {
 										Map<Object, Object> map = (Map<Object, Object>) iterator.next();
-										sqls.add("update makePreparedetail set MD_COLOR = "+color+"," +
-												"MD_BARCODE = (case when MD_BARCODE is null then '"+map.get("uid")+"|' else MD_BARCODE||'"+map.get("uid")+"|' end), " +
-												" md_qty = nvl(md_qty,0) + "+map.get("qty")+", " +
-												"MD_SHELFID = (case when MD_SHELFID is null then '"+map.get("shelfid")+"|' else MD_SHELFID||'"+map.get("shelfid")+"|' end)"
-												+ "where md_repcode = '"+map.get("matid")+"' and MD_LOCATION ='"+map.get("feederLocation")+"' and md_mpid = "+id);
+										if (times ==1) {
+											sqls.add("update makePreparedetail set MD_COLOR = " + color + "," +
+													"MD_BARCODE = (case when MD_BARCODE is null then '" + map.get("uid") + "|' else MD_BARCODE||'" + map.get("uid") + "|' end), " +
+													" md_qty = nvl(md_qty,0) + " + map.get("qty") + ", " +
+													"MD_SHELFID = (case when MD_SHELFID is null then '" + map.get("shelfid") + "|' else MD_SHELFID||'" + map.get("shelfid") + "|' end)"
+													+ "where MD_PRODCODE = '" + map.get("matid") + "' and MD_LOCATION ='" + map.get("feederLocation") + "' and md_mpid = " + id);
+										}
+										else
+										{
+											sqls.add("update makePreparedetail set MD_COLOR = " + color + "," +
+													"MD_BARCODE = (case when MD_BARCODE is null then '" + map.get("uid") + "|' else MD_BARCODE||'" + map.get("uid") + "|' end), " +
+													" md_qty = nvl(md_qty,0) + " + map.get("qty") + ", " +
+													"MD_SHELFID = (case when MD_SHELFID is null then '" + map.get("shelfid") + "|' else MD_SHELFID||'" + map.get("shelfid") + "|' end)"
+													+ "where md_repcode = '" + map.get("matid") + "' and MD_LOCATION ='" + map.get("feederLocation") + "' and md_mpid = " + id);
+										}
 										sqls.add("insert into MakePrepareDetaildet (MDD_ID,MDD_MPID,MDD_PRODCODE,MDD_LOCATION,MDD_BARCODE,MDD_QTY,MD_SHELFID) " +
 												"values (MAKEPREPAREDETAILDET_SEQ.nextval,"+id+",'"+map.get("matid")+"','"+map.get("feederLocation")+"','"+map.get("uid")+"',"+map.get("qty")+",'"+map.get("shelfid")+"')");
 										//sqls.add("update barcode set bar_place='"+mpCode+"' where bar_code='" + map.get("uid") + "'");