Kaynağa Gözat

Merge branch 'mes_malata_prod' of ssh://10.10.100.21/source/mes into mes_malata_prod

caosy 5 yıl önce
ebeveyn
işleme
924cf545e8

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

@@ -227,4 +227,40 @@ public class PdaMsdController extends BaseApiController{
 			return bar_code;
 		}
 	}
+	/**
+	 * 真空密封登记 - 校验
+	 * @param bar_code 条码号
+	 * @return
+	 */
+	@RequestMapping(value="/checkSealBarcode.action")
+	@ResponseBody
+	public ModelMap checkSealBarcode(HttpServletRequest request,String bar_code){
+		Employee employee = (Employee) request.getSession().getAttribute(
+				"employee");
+		if (employee == null){
+			throw new APIErrorException(APIErrorCode.NOT_AUTHENTED, "会话已断开!");
+		}
+		if(StringUtil.isEmpty(bar_code)){
+			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "请输入条码编号");
+		}
+		return success(pdaMsdService.checkSealBarcode(parseBarCode(bar_code)));
+	}
+	/**
+	 * 真空密封登记 - 确认
+	 * @param bar_code 条码号
+	 * @return
+	 */
+	@RequestMapping(value="/confirmSealBarcode.action",method = RequestMethod.POST)
+	@ResponseBody
+	public ModelMap confirmSealBarcode(HttpServletRequest request,String bar_code){
+		Employee employee = (Employee) request.getSession().getAttribute(
+				"employee");
+		if (employee == null){
+			throw new APIErrorException(APIErrorCode.NOT_AUTHENTED, "会话已断开!");
+		}
+		if(StringUtil.isEmpty(bar_code)){
+			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "请输入条码编号");
+		}
+		return success(pdaMsdService.confirmSealBarcode(parseBarCode(bar_code)));
+	}
 }

+ 6 - 0
src/com/uas/mes/common/service/impl/CommonSeriveImpl.java

@@ -39,6 +39,12 @@ public class CommonSeriveImpl implements CommonService {
 		Map<Object, Object> store = FlexJsonUtil.fromJson(formStore);
 		// 执行保存前的其它逻辑
 		handlerService.beforeSave(caller, new Object[] { store });
+		if(caller.equals("SNProblemColl")){
+		 	Object sn=	store.get("spc_sncode");
+		 	if(!baseDao.checkIf("Makeserial","ms_sncode='"+sn.toString()+"'")){
+		 		BaseUtil.showError("SN"+sn.toString()+"不存在");
+			}
+		}
 		// 保存form
 		Object[] objs = baseDao.getFieldsDataByCondition("form", new String[] { "fo_table", "fo_keyfield", "fo_detailmainkeyfield" },
 				"fo_caller='" + caller + "'");// 先根据caller拿到对应table和主键

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

@@ -25,4 +25,8 @@ public interface PdaMsdService {
 
 	Map<String, Object> confirmOutBox(String bar_code);
 
+	Map<String, Object> checkSealBarcode(String parseBarCode);
+
+	Map<String, Object> confirmSealBarcode(String parseBarCode);
+
 }

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

@@ -250,15 +250,17 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 				if (ismsd) {
 					SqlRowList orMsdbarcode = baseDao.queryForRowSet("select nvl(mb_floorlife,pr_msdlifetime) mb_floorlife from msdbarcode left join product on pr_code = mb_prodcode where mb_barcode = '"+or_barcode+"'");
 					if(orMsdbarcode.next()){
-						restTime = orMsdbarcode.getGeneralDouble("mb_floorlife");
+						if(orMsdbarcode.getGeneralString("mb_status").equals("密封中")){
+							pdaMsdService.register(or_barcode,0.0,null);
+						}
 					}else{
 						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
-							+ "','" + level + "'," + restTime + ",'拆封','" + SystemSession.getUser().getEm_name() + "','"
-							+ mp1.get("bar_location") + "','" + mp1.get("bar_prodcode") + "','" + mp1.get("bar_batchcode") + "'," + rest
-							+ ",'拆封成功')");
+//					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
+//							+ "','" + level + "'," + restTime + ",'拆封','" + SystemSession.getUser().getEm_name() + "','"
+//							+ mp1.get("bar_location") + "','" + mp1.get("bar_prodcode") + "','" + mp1.get("bar_batchcode") + "'," + rest
+//							+ ",'拆封成功')");
 				}
 			}
 			SqlRowList rs = baseDao.queryForRowSet("select bar_code,bar_remain,bar_id from barcode where bar_lastid=" + or_barid+" order by bar_id desc");

+ 61 - 5
src/com/uas/mes/pda/service/impl/PdaMsdServiceImpl.java

@@ -110,7 +110,7 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "暴露时长不可小于0!");
 		}
 //		2、要求输入的bar_code 值不在 msdbarcode 表中存在,即必须是唯一
-		if(baseDao.checkIf("MSDBARCODE", "MB_BARCODE = '"+bar_code+"'")){
+		if(baseDao.checkIf("MSDBARCODE", "MB_BARCODE = '"+bar_code+"' AND MB_STATUS <> '密封中'")){
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"已登记!");
 		}
 //		3、通过bar_code 能够解析出物料(物料包含在barcode中),如果无法解析则不能进行登记
@@ -214,10 +214,15 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"对应物料:"+pr_code+"车间寿命单位小于0!");
 		}
 //		5、将条码解析出来的物料,物料对应的湿敏等级,插入到湿敏条码库存表中
-		baseDao.execute("Insert into msdbarcode(MB_ID,MB_BARCODE,MB_PRODCODE,"
-				+ " MB_EXPOSURETIME,MB_STATUS,MB_FLOORLIFE,MB_ACTIONDATE,MB_INDATE,MB_MSDLEVEL,mb_inman) values "
-				+ "(msdbarcode_SEQ.NEXTVAL,'"+bar_code+"','"+pr_code+"',"
-				+ expTime*60 + ",'暴露中',"+pr_msdlifetime+",sysdate,sysdate,'"+pr_msdlevel+"','"+SystemSession.getUser().getEm_name()+"')");
+		int countBar = baseDao.getCount("SELECT * FROM msdbarcode WHERE MB_BARCODE = '"+bar_code+"'");
+		if(countBar > 0){
+			baseDao.execute("UPDATE MSDBARCODE SET MB_STATUS = '暴露中',MB_EXPOSURETIME = "+expTime*60+",MB_ACTIONDATE=SYSDATE WHERE MB_BARCODE = '"+bar_code+"'");
+		}else {
+			baseDao.execute("Insert into msdbarcode(MB_ID,MB_BARCODE,MB_PRODCODE,"
+					+ " MB_EXPOSURETIME,MB_STATUS,MB_FLOORLIFE,MB_ACTIONDATE,MB_INDATE,MB_MSDLEVEL,mb_inman) values "
+					+ "(msdbarcode_SEQ.NEXTVAL,'"+bar_code+"','"+pr_code+"',"
+					+ expTime*60 + ",'暴露中',"+pr_msdlifetime+",sysdate,sysdate,'"+pr_msdlevel+"','"+SystemSession.getUser().getEm_name()+"')");
+		}
 		// 6、插入日志到msdlog 记录拆封条码登记
 		baseDao.execute("Insert into msdlog (MS_ID,MS_DATE,MS_MAN,MS_BARCODE,MS_PRODCODE,MS_LIFETIME,MS_ACTION,MS_REMARK) "
 				+ "values (MSDLOG_SEQ.NEXTVAL,sysdate,'"+SystemSession.getUser().getEm_name()+"','"+bar_code+"','"+pr_code+"',"+pr_msdlifetime*60+",'拆封','拆封成功。')");
@@ -246,6 +251,8 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 			}else if(rs.getString("mb_status").equals("防潮柜")){
 //				如果是防潮柜则提示:目前是入防潮柜状态请先出防潮柜再入烘烤
 				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",入防潮柜状态请先出防潮柜再入烘烤!");
+			}else if(rs.getString("mb_status").equals("密封中")){
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",密封中请重新登记再入烘烤!");
 			}else if(rs.getString("mb_status").equals("暴露中")){
 //				3、获取物料资料表中维护的烘烤温度,烘烤时长返回至客户端
 				Object msdLevel = rs.getGeneralString("mb_msdlevel");
@@ -355,6 +362,8 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 			}else if(rs.getString("mb_status").equals("防潮柜")){
 //				如果是防潮柜则提示:目前是入防潮柜状态请先出防潮柜再入烘烤
 				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",目前是入防潮柜状态请勿重复操作!");
+			}else if(rs.getString("mb_status").equals("密封中")){
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",密封中请重新登记再操作!");
 			}else if(rs.getString("mb_status").equals("暴露中")){
 				return rs.getCurrentMap();
 			}
@@ -429,5 +438,52 @@ public class PdaMsdServiceImpl implements PdaMsdService {
 		}
 	}
 
+	@Override
+	public Map<String, Object> checkSealBarcode(String bar_code) {
+		//		1、判断bar_code 条码号不能为空并且在msdbarcode 表中存在
+		getLog(bar_code);
+		SqlRowList rs = baseDao.queryForRowSet("select mb_barcode,mb_prodcode,mb_status,mb_planoventime planoventime,round((sysdate - mb_actiondate) * 24.0,2) oventime," +
+				" (nvl(mb_planoventime,0)*60 - ceil((sysdate - mb_actiondate) * 24.0 * 60.0)) restOventime from MSDBARCODE left join product on pr_code = mb_prodcode where mb_barcode = ?",bar_code);
+		if(rs.next()){
+			if(rs.getString("mb_status").equals("密封中")){
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",目前是密封中状态请勿重复操作!");
+			}else if(rs.getString("mb_status").equals("暴露中")){
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ",目前是暴露中状态请放入烘烤箱烘烤足够后再操作!");
+			}else if(rs.getString("mb_status").equals("防潮柜")||rs.getString("mb_status").equals("烘烤中")){//暴露中状态可以直接重新密封
+				if(rs.getString("mb_status").equals("烘烤中")){//烘烤中 则判断是否烘烤足够
+					if(rs.getDouble("restOventime") > 0.0 ){
+						throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"烘烤时长不足,不允许出烘烤!" +
+								"计划烘烤时长为:"+rs.getDouble("planoventime")+"(H),已烘烤时长为:"+rs.getDouble("oventime")+"(H)");
+					}
+				}
+				return rs.getCurrentMap();
+			}else {
+				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码:" + bar_code + ","+rs.getString("mb_status")+",不允许此操作!");
+			}
+		}else{
+			throw new APIErrorException(APIErrorCode.ILLEGAL_ARGUMENTS, "条码:"+bar_code+"尚未登记!");
+		}
+	}
+	/**
+	 * 重新密封确认
+	 * @param bar_code
+	 * @return
+	 */
+	@Override
+	public  Map<String, Object>  confirmSealBarcode(String bar_code) {
+		Map<String, Object> barMsg = checkSealBarcode(bar_code);
+		baseDao.updateByCondition("MSDBARCODE","mb_status='密封中',mb_actiondate=sysdate,MB_EXPOSURETIME=0", "mb_barcode='"+bar_code+"'");
+		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) "
+				+ " select msdlog_seq.nextval,sysdate,ms_barcode,ms_level,ms_lifetime,'重新密封','" +
+				SystemSession.getUser().getEm_name()+"',ms_location,ms_prodcode,ms_batchcode,ms_qty,'重新密封成功。' "
+				+ "from (select msdlog.* from msdlog where ms_barcode='"+bar_code+"' order by ms_id desc) where rownum=1");
+		SqlRowList rs = baseDao.queryForRowSet("select MB_BARCODE,MB_PRODCODE,PR_DETAIL,PR_SPEC,MB_MSDLEVEL,round(MB_EXPOSURETIME/60,2) MB_EXPOSURETIME,MB_FLOORLIFE from msdbarcode left join product on pr_code = mb_prodcode where mb_barcode =?"
+				, bar_code);
+		if(rs.next()){
+			return rs.getCurrentMap();
+		}
+		return null;
+	}
 
 }

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

@@ -1730,7 +1730,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 	private void updateMsdbarcodeOnLine(Object bar_code) {
 		Map<String, Object> mapB = pdaMsdService.getLog(bar_code.toString());
 		//确认可以上线,更新湿敏条码状态为已上线,mb_actiondate 为sysdate,记录日志msdlog : SMT-上线
-		baseDao.updateByCondition("MSDBARCODE", "mb_actiondate=sysdate,mb_status='已上线'", "mb_barcode='"+bar_code+"'");
+		//baseDao.updateByCondition("MSDBARCODE", "mb_actiondate=sysdate,mb_status='已上线'", "mb_barcode='"+bar_code+"'");
 		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) "
 				+ " select msdlog_seq.nextval,sysdate,ms_barcode,ms_level,ms_lifetime,'上线','" +

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

@@ -858,22 +858,22 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 			throw new SystemException("料卷号:" + barcode + "不存在!");
 		}
 		//MD_COLOR 不为空 料架备料不允许退回
-		rs = baseDao.queryForRowSet("select md_location,md_barcode,md_color,md_status,md_prodcode from MakePrepareDetail where instr(MD_barcode,'"+barcode+"'||'|')>0 ");
+		rs = baseDao.queryForRowSet("select md_location,md_barcode,md_color,md_status,md_prodcode from MakePrepareDetail " +
+				" where instr(MD_barcode,'"+barcode+"'||'|')>0 and md_mpid ="+mpid);
 		if(!rs.next()){
 			throw new SystemException("料卷号:" + barcode + ",未备料!");
 		}
 //		if(rs.getGeneralInt("md_color") > 0){
 //			BaseUtil.showError("料卷号:" + barcode + ",为料架备料,不允许退回!");
 //		}
-		if(rs.getGeneralString("md_status").equals("已领料")){
+		/*if(rs.getGeneralString("md_status").equals("已领料")){
 			BaseUtil.showError("料卷号:" + barcode + ",已领料,不允许退回!");
-		}
+		}*/
 		// 更新备料明细中料卷已备数量为空
 		baseDao.execute("update  MakePrepareDetail set md_barcode = replace(MD_BARCODE,'"+barcode+"|','')," +
 				"md_qty = md_qty - nvl((select sum(MDD_QTY) from MakePrepareDetaildet where MDD_MPID = md_mpid and MDD_PRODCODE = md_prodcode and MDD_LOCATION = MD_LOCATION and MDD_barcode = '"+barcode+"' ),0) " +
 				"where md_mpid=" + mpid + " and md_prodcode ='"+rs.getGeneralString("md_prodcode")+"' and MD_LOCATION ='"+rs.getGeneralString("md_location")+"' and instr(MD_barcode,'"+barcode+"'||'|')>0 ");
 		baseDao.execute("delete MakePrepareDetaildet where MDD_MPID ="+mpid+" and MDD_PRODCODE = '"+rs.getGeneralString("md_prodcode")+"' and MDD_LOCATION = '"+rs.getGeneralString("md_location")+"' and MDD_barcode='"+barcode+"'");
-
 		// 更新条码所在场所bar_place
 		//baseDao.updateByCondition("barcode", "bar_place=''", "bar_code='" + barcode + "'");
 		baseDao.execute(baseDao.logger.getMessageLog("备料退回", "退回成功,料卷号:"+barcode, "MakePrepare2", "mp_id", mpid).getSql());