|
|
@@ -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;
|
|
|
+ }
|
|
|
|
|
|
}
|