add 方案作废

master
yinq 2 years ago
parent e66081c54b
commit 978c5d2ca0

@ -682,6 +682,32 @@ public class AbnormalBillController {
return new ResultVo(ResultCode.SUCCESS,"bpm纠正预防成功");
}
/**
* bpmmes
* @param
* @return
*/
@PostMapping("/bpmRollbackProcessing")
public ResultVo bpmRollbackProcessing(String secretKey,AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
com.foreverwin.modular.core.util.CommonMethods.setSite("1000");
String site = com.foreverwin.modular.core.util.CommonMethods.getSite();
if (!yunBpmConfig.secretKey.equals(secretKey)){
return new ResultVo(ResultCode.FAILED,"秘钥错误");
}else if (!StringUtil.isBlank(abnormalBill.getCancelUser())){
com.foreverwin.modular.core.util.CommonMethods.setUser(abnormalBill.getCancelUser());
}
try{
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBillService.rollbackProcessing(abnormalBill,abnormalBillDispose);
return new ResultVo(ResultCode.SUCCESS,"bpm方案作废回传成功");
}catch(Exception e){
StringUtil.saveOperLog("方案作废操作日志handle" + abnormalBill.getHandle(),"rollbackProcessing",
"sfc:" + abnormalBill.getSfc() + ",操作人:" + abnormalBill.getCancelUser() + " 方案作废原因:" + abnormalBill.getCancelReason(),"方案作废调用失败!",R.failed(e.getMessage()).getMsg());
return new ResultVo(ResultCode.FAILED,R.failed(e.getMessage()).getMsg());
}
}
/**
*
* @param abnormalBill

@ -30,6 +30,7 @@ import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.mapper.SfcDispatchMapper;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import com.foreverwin.mesnac.listener.mapper.UsrMapper;
import com.foreverwin.mesnac.meapi.dto.NcCodeDto;
@ -595,21 +596,49 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public void rollbackProcessing(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String site = CommonMethods.getSite();
String commonUser = CommonMethods.getUser();
String local = LocaleContextHolder.getLocale().getLanguage();
StringBuffer buffer = new StringBuffer();
AbnormalBillDisposeDto abnormalDto = abnormalBillDisposeMapper.findAllByAbnormalNo(abnormalBill, local);
if (!abnormalDto.getStatus().equals("F")){
throw BusinessException.build("该异常单不是方案确认状态,不能进行方案作废");
}
if ((Constants.REPAIR.equals(abnormalDto.getAbnormalMethod()) || Constants.REPAIR_MATCH.equals(abnormalDto.getAbnormalMethod()))){
//异常单是否已生成新的订单号
ShopOrderDto shopOrderBo = SpringUtil.getBean(ShopOrderService.class).findByShopOrderBo(abnormalBill.getAbnormalNo());
if (Optional.ofNullable(shopOrderBo).isPresent()){
throw BusinessException.build("该异常单已生成新的订单号:" + abnormalBill.getAbnormalNo() + ",无法方案作废");
}
//计划已处理的不通过
AbnormalPlan abnormalPlan = SpringUtil.getBean(AbnormalPlanService.class).getById(HandleEnum.ABNORMAL_PLAN.getHandle(site, abnormalBill.getAbnormalNo()));
if (Optional.ofNullable(abnormalPlan).isPresent() && abnormalPlan.getStatus().equals("PR")){
throw BusinessException.build("该异常单计划已处理:" + abnormalBill.getAbnormalNo() + ",无法方案作废");
}
//异常单是否已生成新的订单号
ShopOrderDto shopOrderBo = SpringUtil.getBean(ShopOrderService.class).findByShopOrderBo(abnormalBill.getAbnormalNo());
if (Optional.ofNullable(shopOrderBo).isPresent()){
throw BusinessException.build("该异常单已生成新的订单号:" + abnormalBill.getAbnormalNo() + ",无法回退方案");
}
//计划已处理的不通过
AbnormalPlan abnormalPlan = SpringUtil.getBean(AbnormalPlanService.class).getById(HandleEnum.ABNORMAL_PLAN.getHandle(site, abnormalBill.getAbnormalNo()));
if (Optional.ofNullable(abnormalPlan).isPresent() && abnormalPlan.getStatus().equals("PR")){
throw BusinessException.build("该异常单计划已处理:" + abnormalBill.getAbnormalNo() + ",无法回退方案");
if (StringUtil.notBlank(abnormalDto.getRouterBo()) && StringUtil.notBlank(abnormalDto.getSfc())){
HashMap<String, String> paramMap=new HashMap();
paramMap.put("routerBo",abnormalDto.getRouterBo());
paramMap.put("site",site);
List<Map<String, Object>> mapList = routerStepcontentMapper.selectDisRouterInfo(paramMap);
for (Map<String, Object> map : mapList) {
String dispatchNo = abnormalDto.getSfc() + "-" + map.get("STEP_ID");
buffer.append(dispatchNo + ",");
sfcDispatchCommonService.updateSfcDispatchStatus(site,abnormalBill.getCancelUser(),dispatchNo,DispatchStatusEnum.CANCEL.getCode(),null);
}
}else if (StringUtil.notBlank(abnormalDto.getRouterBo()) && StringUtil.isBlank(abnormalDto.getSfc())){
HashMap<String, String> map = new HashMap<>();
map.put("site",site);
map.put("shopOrder",abnormalBill.getAbnormalNo());
List<SfcDispatchDto> sfcDispatchList = SpringUtil.getBean(SfcDispatchMapper.class).findSfcDispatchList(map);
for (SfcDispatchDto dispatchDto : sfcDispatchList) {
buffer.append(dispatchDto.getDispatchNo() + ",");
sfcDispatchCommonService.updateSfcDispatchStatus(site,abnormalBill.getCancelUser(),dispatchDto.getDispatchNo(),DispatchStatusEnum.CANCEL.getCode(),null);
}
}
int i = abnormalBillMapper.rollbackProcessing(abnormalBill);
}
abnormalBillMapper.rollbackProcessing(abnormalBill);
//保存操作日志
StringUtil.saveOperLog("MES方案回退操作日志handle" + abnormalBill.getHandle(),"rollbackProcessing",
"sfc:" + abnormalBill.getSfc() + ",操作人:" + commonUser + ",回退方案原因:" + abnormalBill.getCancelReason(),"修改成功条数:" + i,null);
StringUtil.saveOperLog("方案作废操作日志handle" + abnormalBill.getHandle(),"rollbackProcessing",
"sfc:" + abnormalDto.getSfc() + ",操作人:" + commonUser + " 方案作废原因:" + abnormalBill.getCancelReason(),"方案作废成功!" + buffer.toString(),null);
}
@Override

Loading…
Cancel
Save