Browse Source

【微浦MES】条码上料判定增加制造单明细表校验(河源工单)

caosy 3 years ago
parent
commit
d9261ef634
1 changed files with 28 additions and 24 deletions
  1. 28 24
      src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

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

@@ -251,9 +251,12 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				if(!rs1.next()){
 					rs1 = baseDao.queryForRowSet("select bd_mothercode,bd_soncode,prr_reprodcode from PRODUCTRELATION left join bomdetail on bd_id = prr_bdid where bd_mothercode = ? and bd_soncode = ? and prr_reprodcode = ?",ps_prodcode,psl_prodcode,rs.getString("bar_prodcode"));
 					if(!rs1.next()) {
-						rs1 = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@WP where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%"+rs.getString("bar_prodcode")+"%'",dl_macode,ps_prodcode,psl_prodcode);
-						if(!rs1.next()) {
-							showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+						rs1 = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@WP where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%" + rs.getString("bar_prodcode") + "%'", dl_macode, ps_prodcode, psl_prodcode);
+						if (!rs1.next()) {
+							rs1 = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@HY where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%" + rs.getString("bar_prodcode") + "%'", dl_macode, ps_prodcode, psl_prodcode);
+							if (!rs1.next()) {
+								showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+							}
 						}
 					}
 				}
@@ -298,7 +301,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			showSmtError(APIErrorCode.DATA_NOT_FOUND,"物料["+bar_code+"]不是该站位需要上料的物料",handleType,linecode,location,ps_prodcode,"料号"+bar_code,bool,table);
 		}
 		//更新飞达所在站位
-		baseDao.updateByCondition("feeder","fe_location='"+location+"'","fe_code='"+fe_code+"'");
+		baseDao.updateByCondition("feeder","fe_location='"+ location + "'","fe_code='"+fe_code+"'");
 		double ma_qty=0;
 		rs = baseDao.queryForRowSet("select ma_qty from make where ma_id=?",map.get("MA_ID"));
 		if(rs.next()){
@@ -606,7 +609,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		SqlRowList rs1 = null;
 		SqlRowList rs2 = null;
 		String psl_prodcode = null;
-		Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
+			Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
 		Map<Object, Object> map1 = FlexJsonUtil.fromJson(dsl);
 		Object ma_code = map.get("DL_MACODE"),linecode=map.get("DL_LINECODE"),location=map1.get("dsl_location"),table = map.get("DL_TABLE");
 		Object bar_code = map1.get("dsl_barcode");
@@ -744,18 +747,18 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					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)):"");
 		}else{
-			showSmtError(APIErrorCode.BUSINESS_FAILED,"没有排位图信息",handleType,linecode,"",ps_prodcode,"",bool,map.get("DL_TABLE"));
-		}
-		 /**
-		 * @author wuyx
-		 * @Date 2018-01-22
-		 *  上料、接料、换料 更新状态为“已上线” 并记录日志
-		 * */
-		if(checkMsdBarCode(bar_code)){
-			updateMsdbarcodeOnLine(bar_code);
-		}
-		//记录日志接料
-		baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料","接料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+","+(("product").equals(type)?"物料编号":"料卷号")+":"+bar_code,linecode,location,0,ps_prodcode,(("product").equals(type)?"物料":"料卷")+":"+bar_code,map.get("DL_TABLE"),has_make == -1?ma_code:"");
+			showSmtError(APIErrorCode.BUSINESS_FAILED, "没有排位图信息", handleType, linecode, "", ps_prodcode, "", bool, map.get("DL_TABLE"));
+		}
+			/**
+			 * @author wuyx
+			 * @Date 2018-01-22
+			 *  上料、接料、换料 更新状态为“已上线” 并记录日志
+			 * */
+			if (checkMsdBarCode(bar_code)) {
+				updateMsdbarcodeOnLine(bar_code);
+			}
+			//记录日志接料
+			baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料","接料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+","+(("product").equals(type)?"物料编号":"料卷号")+":"+bar_code,linecode,location,0,ps_prodcode,(("product").equals(type)?"物料":"料卷")+":"+bar_code,map.get("DL_TABLE"),has_make == -1?ma_code:"");
 		Map<String,Object> mapReturn = new HashMap <String, Object>();
 		mapReturn.put("DSL_LOCATION",location);
 		mapReturn.put("DSL_BARCODE",(("product").equals(type)?"":bar_code));
@@ -922,11 +925,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+map1.get("dsl_location")+" ]无上料数据,无需换料",handleType,linecode,location,ps_prodcode,"",bool,table);
 		}
 		rs=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"));
-		String dsl_fespec = null;
-		if(rs.next()){
-			dsl_fespec = rs.getString("psl_feeder");
-			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,?,?,?,?,sysdate)",map.get("MA_ID"),ma_code,map1.get("dsl_location"),pr_code,rs.getString("repcode"),
+				+ "where psl_psid=? and psl_location=? and psl_table=?", map.get("PS_ID"), location, map.get("DL_TABLE"));
+			String dsl_fespec = null;
+			if (rs.next()) {
+				dsl_fespec = rs.getString("psl_feeder");
+				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,?,?,?,?,sysdate)", map.get("MA_ID"), ma_code, map1.get("dsl_location"), pr_code, rs.getString("repcode"),
 					dsl_fespec,rs.getDouble("psl_baseqty"),map.get("DL_TABLE"),rs.getDouble("psl_baseqty")*ma_qty,
 					bar_remain,bar_remain,(("product").equals(type)?"":bar_code),linecode,map.get("DL_DECODE"),SystemSession.getUser().getEm_name(),0,rs.getString("psl_prodcode"),1);
 		}
@@ -1781,16 +1784,17 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				map.put("record", rs.getResultList());
 				return map;
 			} else {
-				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"无对应接料数据");
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED, "无对应接料数据");
 			}
 
 		}
+
 	/**
 	 * @author wuyx
 	 * @Date 2018-01-22
 	 * 校验是否湿敏条码
 	 * */
-	private boolean checkMsdBarCode(Object bar_code){
+	private boolean checkMsdBarCode(Object bar_code) {
 		SqlRowList rs = baseDao.queryForRowSet("select mb_status,"
 				+ "(nvl(mb_floorlife,0) * 60.0 - nvl(mb_exposuretime,0) - ceil((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0) ) restTime,"
 				+ "round((nvl(mb_exposuretime,0) + ceil((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0))/60,2) exposureTime,"