Browse Source

【镝泰MES】SMT接料逻辑优化

caosy 5 years ago
parent
commit
0f93504375
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

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

@@ -541,6 +541,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		Object bar_code = map1.get("dsl_barcode");
 		Boolean isBarcode = isOurBarcode(bar_code);
 		int has_make=0;
+		double remain = 0;
 		double bar_remain=0;
 		String pr_code = null;
 		String dsl_barcode = null;
@@ -629,6 +630,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		if(rs2.next()){
 			ma_qty=rs2.getDouble("ma_qty");
 		}
+		rs = baseDao.queryForRowSet("select sum(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id, count(1) cn from"
+				+" devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_location =? ",linecode,ma_code,map.get("DL_TABLE"),location);
+		if(rs.next()) {
+			remain = rs.getDouble("dsl_remainqty")>0?rs.getDouble("dsl_remainqty"):0;  //将第一个料卷剩余料加给第二个料卷
+		}
 		rs2 = baseDao.queryForRowSet("select wm_concat(psl_repcode)repcode ,count(1) cn ,max(psl_prodcode)psl_prodcode,count(1) cn ,max(psl_feeder) psl_feeder, max(psl_baseqty) psl_baseqty from productsmtlocation "
 				+"where psl_psid=? and psl_location=? and psl_table=?",map.get("PS_ID"),location,map.get("DL_TABLE"));
 		if(rs2.next()){
@@ -652,7 +658,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 			baseDao.execute("insert into devsmtlocation (dsl_id,dsl_maid,dsl_makecode,dsl_location,dsl_prodcode,dsl_repcode,dsl_fespec,dsl_baseqty,dsl_table,dsl_needqty,dsl_getqty,dsl_remainqty,dsl_barcode,dsl_linecode,dsl_devcode,dsl_status, dsl_indate,dsl_inman,dsl_ifcheck,dsl_fprodcode,dsl_usable,dsl_validtime)values( DEVSMTLOCATION_SEQ.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,sysdate,?,?,?,?,?)",map.get("MA_ID"),ma_code,location,pr_code,rs2.getString("repcode"),
 					rs2.getString("psl_feeder"),rs2.getDouble("psl_baseqty"),map.get("DL_TABLE"),rs2.getDouble("psl_baseqty")*ma_qty,
-					bar_remain,bar_remain,(("product").equals(type)?"":bar_code),linecode,map.get("DL_DECODE"),SystemSession.getUser().getEm_name(),0,rs2.getString("psl_prodcode"),usable,(usable==1)?Timestamp.valueOf(DateUtil.currentDateString(Constant.YMD_HMS)):"");
+					bar_remain+remain,bar_remain+remain,(("product").equals(type)?"":bar_code),linecode,map.get("DL_DECODE"),SystemSession.getUser().getEm_name(),0,rs2.getString("psl_prodcode"),usable,(usable==1)?Timestamp.valueOf(DateUtil.currentDateString(Constant.YMD_HMS)):"");
 		}else{
 			showSmtError(APIErrorCode.BUSINESS_FAILED,"没有排位图信息",handleType,linecode,"",ps_prodcode,"",bool,map.get("DL_TABLE"));
 		}