Browse Source

【万利达MES】【湿敏元件管理】【功能优化】【非湿敏元件支持移动端请求调整湿敏等级】

wuyx 6 years ago
parent
commit
25bc326d8d

+ 2 - 2
src/com/uas/mes/api/pda/PdaMsdController.java

@@ -85,7 +85,7 @@ public class PdaMsdController extends BaseApiController{
 	 */
 	@RequestMapping(value="/register.action")
 	@ResponseBody
-	public ModelMap register(HttpServletRequest request,String bar_code,Double expTime){
+	public ModelMap register(HttpServletRequest request,String bar_code,Double expTime,String msdRank){
 		Employee employee = (Employee) request.getSession().getAttribute(
 				"employee");
 		if (employee == null){
@@ -97,7 +97,7 @@ public class PdaMsdController extends BaseApiController{
 		if(expTime == null){
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "请输入暴露时长!");
 		}
-		return success(pdaMsdService.register(parseBarCode(bar_code),expTime));
+		return success(pdaMsdService.register(parseBarCode(bar_code),expTime,msdRank));
 	}
 	/**
 	 * 入烘烤 - 校验条码是否在湿敏条码条中

+ 1 - 1
src/com/uas/mes/pda/service/PdaMsdService.java

@@ -13,7 +13,7 @@ public interface PdaMsdService {
 
 	Map<String, Object> loadMSDLog(String code);
 
-	Map<String, Object> register(String bar_code, Double expTime);
+	Map<String, Object> register(String bar_code, Double expTime,String msdRank);
 
 	List<Map<String, Object>> checkOvenBarcode(String bar_code);
 

+ 3 - 3
src/com/uas/mes/pda/service/impl/PdaBatchServiceImpl.java

@@ -165,7 +165,7 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 					restTime = Double.valueOf(msdMap.get("mb_floorlife").toString());
 					exposuretime = Double.valueOf(msdMap.get("exposuretime").toString());
 				}else{
-					msdMap = pdaMsdService.register(or_barcode,0.0);
+					msdMap = pdaMsdService.register(or_barcode,0.0,null);
 				}
 				//记录新条码 msdbarcode
 				baseDao.execute("Insert into msdbarcode(mb_id,mb_barcode,mb_prodcode,"
@@ -227,7 +227,7 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 						restTime = Double.valueOf(msdMap.get("mb_floorlife").toString());
 						exposuretime = Double.valueOf(msdMap.get("exposuretime").toString());
 					}else{
-						msdMap = pdaMsdService.register(or_barcode,0.0);
+						msdMap = pdaMsdService.register(or_barcode,0.0,null);
 					}
 					//记录新条码 msdbarcode
 					baseDao.execute("Insert into msdbarcode(MB_ID,MB_BARCODE,MB_PRODCODE,"
@@ -251,7 +251,7 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 					if(orMsdbarcode.next()){
 						restTime = orMsdbarcode.getGeneralDouble("mb_floorlife");
 					}else{
-						pdaMsdService.register(or_barcode,0.0);
+						pdaMsdService.register(or_barcode,0.0,null);
 					}
 					baseDao.execute("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"
 							+ " ms_man,ms_location,ms_prodcode,ms_batchcode,ms_qty,MS_REMARK)" + " values (msdlog_seq.nextval,sysdate,'" + or_barcode

+ 44 - 11
src/com/uas/mes/pda/service/impl/PdaMsdServiceImpl.java

@@ -103,7 +103,8 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 	}
 
 	@Override
-	public Map<String, Object> register(String bar_code, Double expTime) {
+	public Map<String, Object> register(String bar_code, Double expTime,String msdRank) {
+		Map<String, Object> resMap = new HashMap<String,Object>();
 //		1、判断bar_code 条码号不能为空,已暴露时间必须大于等于0
 		if(expTime<0.0){
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "暴露时长不可小于0!");
@@ -123,11 +124,22 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 		if(barrs.next()){
 			pr_code = barrs.getGeneralString("pr_code");
 			if(StringUtil.hasText(pr_code)){
+				if(StringUtil.hasText(msdRank) && !msdRank.equals("")){//非MSD物料强制登记,先根据选择湿敏等级先更新湿敏元件为-1 并记录湿敏等级
+					String res = baseDao.callProcedure("MES_TOMSDPROD",new Object[] {pr_code,msdRank});
+					if(StringUtil.hasText(res)){
+						throw new APIErrorException(APIErrorCode.BUSINESS_FAILED, res);
+					}
+					barrs = baseDao.queryForRowSet("select bar_code,bar_prodcode,pr_code,nvl(pr_msdlevel,'无') pr_msdlevel," +
+							"max(mi_msdlifttime) mi_msdlifttime,pr_ismsd,max(pr_statuscode) pr_statuscode " +
+							"from barcode left join product on pr_code = bar_prodcode left join msdinfo on mi_msdlevel = pr_msdlevel " +
+							"where  bar_code=? group by bar_code,bar_prodcode,pr_code,pr_msdlevel,pr_ismsd", bar_code);
+					barrs.next();
+				}
 				if(!barrs.getGeneralString("pr_statuscode").equals("AUDITED")){
 					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+",尚未审核!");
 				}
 				pr_msdlevel = barrs.getGeneralString("pr_msdlevel");
-				if(NumberUtil.isEmpty(barrs.getGeneralString("mi_msdlifttime"))){
+				if(NumberUtil.isEmpty(barrs.getGeneralDouble("mi_msdlifttime"))){
 					int count = baseDao.getCount("select count(1) from msdinfo where mi_msdlevel = '"+barrs.getGeneralString("pr_msdlevel")+"'");
 					if(count == 0){
 						throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"湿敏元件,湿敏等级"+barrs.getGeneralString("pr_msdlevel")+",尚未维护对应湿敏基础资料!");
@@ -135,14 +147,18 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 						throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"湿敏元件,湿敏等级"+barrs.getGeneralString("pr_msdlevel")+",尚未维护车间寿命或车间寿命为0!");
 					}
 				}else{
-					pr_msdlifetime = Double.valueOf(barrs.getGeneralString("mi_msdlifttime"));
+					pr_msdlifetime = Double.valueOf(barrs.getGeneralDouble("mi_msdlifttime"));
 				}
-				if(NumberUtil.isEmpty(barrs.getGeneralInt("pr_ismsd"))){
-					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"非湿敏元件,不能进行登记!");
+				if(NumberUtil.isEmpty(barrs.getGeneralInt("pr_ismsd")) || (!StringUtil.hasText(pr_msdlevel) || (StringUtil.hasText(pr_msdlevel) && pr_msdlevel.equals("无")) )){
+					//非湿敏元件 需要前端处理选择湿敏等级
+					List<String> msdRankList = baseDao.queryForList("select mi_msdlevel from MsdInfo group by mi_msdlevel order by mi_msdlevel asc",String.class);
+					resMap.put("isnotmsd",true);
+					resMap.put("msdranklist",msdRankList);
+					return resMap;
 				}
-				if(!StringUtil.hasText(pr_msdlevel) && pr_msdlevel.equals("无")){
+				/*if(!StringUtil.hasText(pr_msdlevel) && pr_msdlevel.equals("无")){
 					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"湿敏元件,湿敏等级为空或为\"无\"!");
-				}
+				}*/
 				if(NumberUtil.isEmpty(pr_msdlifetime)){
 					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料"+pr_code+",湿敏等级"+pr_msdlevel+",尚未维护湿敏车间寿命!");
 				}
@@ -155,12 +171,27 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 				Object[] prods = baseDao.getFieldsDataByCondition("product left join msdinfo on mi_msdlevel = pr_msdlevel",
 						"pr_code,pr_msdlevel,pr_ismsd,max(mi_msdlifttime)", "instr('"+bar_code+"',PR_CODE)>0 and nvl(pr_Statuscode,' ') ='AUDITED' group by PR_CODE, PR_MSDLEVEL, PR_ISMSD");
 				pr_code = prods[0];
-				if(NumberUtil.isEmpty(prods[2])){
+				if(StringUtil.hasText(msdRank) && !msdRank.equals("")){//非MSD物料强制登记,先根据选择湿敏等级先更新湿敏元件为-1 并记录湿敏等级
+					String res = baseDao.callProcedure("MES_TOMSDPROD",new Object[] {pr_code,msdRank});
+					if(StringUtil.hasText(res)){
+						throw new APIErrorException(APIErrorCode.BUSINESS_FAILED, res);
+					}
+					prods = baseDao.getFieldsDataByCondition("product left join msdinfo on mi_msdlevel = pr_msdlevel",
+							"pr_code,pr_msdlevel,pr_ismsd,max(mi_msdlifttime)", "instr('"+bar_code+"',PR_CODE)>0 and nvl(pr_Statuscode,' ') ='AUDITED' group by PR_CODE, PR_MSDLEVEL, PR_ISMSD");
+				}
+				if(NumberUtil.isEmpty(prods[2])|| !StringUtil.hasText(prods[1])  || ( StringUtil.hasText(prods[1]) && prods[1].toString().equals("无") ) ){
+					//非湿敏元件 需要前端处理选择湿敏等级
+					List<String> msdRankList = baseDao.queryForList("select mi_msdlevel from MsdInfo group by mi_msdlevel order by mi_msdlevel asc",String.class);
+					resMap.put("isnotmsd",true);
+					resMap.put("msdranklist",msdRankList);
+					return resMap;
+				}
+				/*if(NumberUtil.isEmpty(prods[2])){
 					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"非湿敏元件,不能进行登记!");
 				}
 				if(!StringUtil.hasText(prods[1]) || ( StringUtil.hasText(prods[1]) && prods[1].toString().equals("无") )){
 					throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"湿敏元件,湿敏等级为空或为\"无\"!");
-				}
+				}*/
 				if(NumberUtil.isEmpty(prods[3])){
 					int countMsd = baseDao.getCount("select count(1) from msdinfo where mi_msdlevel = '"+prods[1]+"'");
 					if(countMsd == 0){
@@ -237,7 +268,7 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 	/**
 	 * 入烘烤 - 入烘烤按钮确认
 	 * @param bar_code 条码号
-	 * @param String data 将对应的烘烤温度等值封装在里面 
+	 * @param  data 将对应的烘烤温度等值封装在里面
 	 * 烘烤温度(必填填写数字大于0),湿度(必填填写数字大于0),时长(必填填写大于0的数字),储位 
 	 * {“temp”:54 //温度,“humidity”:23 //湿度,“time”:1.5 //时长,”location”:“L01” //储位}
 	 * @return
@@ -267,7 +298,7 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 	}
 	/**
 	 * 出烘烤-确认出烘烤
-	 * @param code
+	 * @param bar_code
 	 * @return
 	 */
 	@Override
@@ -387,4 +418,6 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"尚未登记!");
 		}
 	}
+
+
 }