Procházet zdrojové kódy

[SMT 工单全部下料和工单切换中的更新barcode 的exists 写法改成in 并且在没有bar_place条件的地方增加该条件]

xiaost před 4 roky
rodič
revize
afaa7d2676

+ 4 - 4
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -461,13 +461,13 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 	    //进行扣料操作
 		List<String> sqls = new ArrayList<String>();
 			//dsl_usable=2的直接更新bar_place为1,remain为0
-		sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where exists (select 1 from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_table='"+dl_table+"' and nvl(dsl_usable,0) = 2 and dsl_barcode = bar_code)");
+		sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where bar_place='"+dl_macode+"' and bar_code in (select dsl_barcode from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_table='"+dl_table+"' and nvl(dsl_usable,0) = 2)");
 
 		rs = baseDao.queryForRowSet("select dsl_location,cn,dsl_remainqty,dsl_id,dsl_barcode,dsl_baseqty,case when "+actAddQty+">0 then round(dsl_baseqty*(1+0.01*"+lossrate+")*(1/"+pcbacount+")*"+actAddQty+",4) else 0 end remainAddQty " +
 				"from (select dsl_location,count(1)cn,sum(dsl_remainqty)dsl_remainqty,max(dsl_id)dsl_id,max(dsl_barcode)dsl_barcode," +
 				"max(dsl_baseqty)dsl_baseqty " +
 				"from devsmtlocation " +
-				"where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_usable<>2 group by dsl_location)",dl_linecode,dl_macode,dl_table);
+				"where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_usable,0)<>2 group by dsl_location)",dl_linecode,dl_macode,dl_table);
 		if(rs.hasNext()){
 			double remainAddQty,dsl_remainqty;
 			String dsl_location; 
@@ -1058,11 +1058,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 								+ " where dsl_linecode=? and "
 								+" dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_invalidtime is null order by dsl_id asc)A",rs.getInt("ps_id"),table,dl_linecode,ma_oldcode,dl_table);//原工单号
 						   baseDao.execute("update barcode set bar_place=?"
-									+" where exists(select 1 from devsmtlocation where dsl_linecode=? and dsl_makecode=?  and  dsl_barcode=bar_code "
+									+" where bar_code in (select dsl_barcode from devsmtlocation where dsl_linecode=? and dsl_makecode=?  "
 									+" and dsl_table=? and dsl_status=0 and dsl_invalidtime is null and dsl_usable<>2) and bar_place=?",ma_code,dl_linecode,ma_code,table,ma_oldcode);//原制造单号
 							 	
 						    baseDao.execute("update barcode set bar_place=1"
-										+" where exists(select 1 from devsmtlocation where dsl_linecode=? and dsl_makecode=?  and  dsl_barcode=bar_code "
+										+" where bar_code in (select dsl_barcode from devsmtlocation where dsl_linecode=? and dsl_makecode=?   "
 										+" and dsl_table=? and dsl_status=0 and dsl_usable<>2) and bar_place=? and (bar_remain<0 or bar_remain=0)",dl_linecode,ma_oldcode,dl_table,ma_oldcode);//原制造单号
 						   //更新湿敏条码状态为暴露中,操作日志为全部下料
 						   //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志