拣货完成消除异常报警信息

main
judy 11 months ago
parent 5d80b7d6c4
commit f0cf89abe6
  1. 122
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java

@ -14,7 +14,15 @@ import com.shkj.common.utils.DateUtils;
import com.shkj.common.utils.SecurityUtils;
import com.shkj.common.utils.StringUtils;
import com.shkj.common.utils.bean.BeanUtils;
import com.shkj.plc.sdk.device.PLCReadAndWrite;
import com.shkj.plc.sdk.device.PlcOperate;
import com.shkj.system.service.ISysParameterService;
import com.shkj.wcs.domain.WcsPlcConnect;
import com.shkj.wcs.domain.WcsPlcProperty;
import com.shkj.wcs.plc.PlcInit;
import com.shkj.wcs.service.IWcsPlcConnectService;
import com.shkj.wcs.service.IWcsPlcPropertyService;
import com.shkj.wcs.vo.WcsPlcConnectVo;
import com.shkj.wms.bo.*;
import com.shkj.wms.constants.ParameterConstants;
import com.shkj.wms.constants.RedisLockConstants;
@ -99,6 +107,11 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
@Autowired
private ISysParameterService isysParameterService;
@Autowired
private PlcInit plcInit;
@Autowired
IWcsPlcPropertyService iWcsPlcPropertyService;
@Override
public List<BusinOutInPlanVo> queryList(BusinOutInPlanQueryBo bo) {
@ -506,42 +519,6 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
}
/**
* 呼叫托盘入库
*
* @param containerCode 托盘代码
*/
/* private Result callEmptyLocationNotContainerCode(String containerCode) {
log.info("呼叫托盘 = {}", containerCode);
StockDetailLocationVo vo = sysStockDetailService.findLocationNotContainerCode(containerCode);
if (vo == null) {
log.info("没有货位可以呼叫了 = {}", containerCode);
return Result.err().msg("没有货位可以呼叫了");
}
String code = CollectionUtils.isEmpty(vo.getStockDetailList()) ? "" : vo.getStockDetailList().get(0).getContainerCode();
Long containerId = CollectionUtils.isEmpty(vo.getStockDetailList()) ? 0L : vo.getStockDetailList().get(0).getContainerId();
Long orderNo = IntIdUtil.generateIntId();;
BusinOutInPlan businOutInPlan = initCallPlan(containerId, StringUtils.isNoneBlank(containerCode) ? containerCode : code, orderNo,0);
businOutInPlan.setLocationId(vo.getId());
OutStockDetailVo detailVo = new OutStockDetailVo();
detailVo.setLocationId(vo.getId());
detailVo.setLocationCode(vo.getLocationCode());
detailVo.setLocationRow(vo.getLocationRow());
detailVo.setLayer(vo.getLayer());
detailVo.setLocationColumn(vo.getLocationColumn());
detailVo.setOrderNo(orderNo);
detailVo.setBranchId(vo.getBranchId());
Result result = wmsCallWcsUtil.callOutStock(detailVo);
if (Result.isOk(result)) {
businOutInPlan.setPlanStatus(PlanStatusEnum.DOING.getValue());
}
this.save(businOutInPlan);
//并且这个时候不需要做库存处理、因为是空托盘 所以直接删除库存记录
sysStockDetailService.deleteByLocationId(vo.getId());
return Result.ok();
}*/
/**
* 确认出库
*
@ -555,6 +532,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
if (null == lockInfo) {
throw new RuntimeException("业务处理中,请稍后再试");
}
Integer layer=0;
try {
List<BusinOutInPlan> updList = new ArrayList<>();
for (BusinOutPlanConfirmBo bo : bos) {
@ -569,12 +547,12 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
if (!plan.getPlanStatus().equals(PlanStatusEnum.DOING.getValue())) {
return Result.err().msg("出库计划状态异常");
}
layer=plan.getLayer();
plan.setPlanStatus(PlanStatusEnum.FINISH.getValue());
updList.add(plan);
}
log.info("要删除的库存明细:"+updList);
log.info("要删除的库存明细:"+JsonUtil.toJSONString(updList));
//如果存在相同的托盘中的有待出库的任务 就需要更新为执行中
LambdaQueryWrapper<BusinOutInPlan> in = new LambdaQueryWrapper<BusinOutInPlan>()
@ -633,6 +611,8 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
redisTemplate.delete(RedisConstant.redisTaskOut);
}
//出库成功写入wcs异常点位为0
outEliminateAlarms(layer);
}catch (Exception e){
log.info("出库确认异常 手动回滚 {}", bos+e.getMessage());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@ -643,6 +623,72 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
}
public void outEliminateAlarms(Integer layer){
Long plcId =51L;
PlcOperate plcOperate_dps = plcInit.getPlcOperate_dps();
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite();
List<WcsPlcProperty> propertyList = (List<WcsPlcProperty>) redisTemplate.opsForValue().get(RedisConstant.redisPlcProperty + plcId);
if (propertyList == null || propertyList.size() == 0) {
propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(plcId);
}
if (propertyList !=null && propertyList.size()>0){
String oneWcsErrExit = "", twoWcsErrExit = "",oneWcsExitOutExit="",twoWcsExitOutExit="";
String oneWcsErrExitVt = "", twoWcsErrExitVt = "",oneWcsExitOutExitVt="",twoWcsExitOutExitVt="";
for (WcsPlcProperty plcProperty : propertyList) {
String pointType = plcProperty.getPointType();
//请求分配
if (pointType.equals("ontExit")) {
oneWcsErrExit = plcProperty.getAddress();
oneWcsErrExitVt = plcProperty.getValueType();
} else if (pointType.equals("twoExit")) {
twoWcsErrExit = plcProperty.getAddress();
twoWcsErrExitVt = plcProperty.getValueType();
} else if (pointType.equals("oneExitOut")) {
oneWcsExitOutExit = plcProperty.getAddress();
oneWcsExitOutExitVt= plcProperty.getValueType();
} else if (pointType.equals("twoExitOut")) {
twoWcsExitOutExit = plcProperty.getAddress();
twoWcsExitOutExitVt = plcProperty.getValueType();
}
Map<String, Object> allMap = new HashMap<>(1);
if (layer ==1){
//出库拣货尚未拣货时写入异常给plc
Map<String, Integer> oneWcsErrExitMap = new HashMap<>(1);
oneWcsErrExitMap.put(oneWcsErrExitVt, 0);
allMap.put(oneWcsErrExit, oneWcsErrExitMap);
Map<String, Integer> oneWcsExitOutExitMap = new HashMap<>(1);
oneWcsExitOutExitMap.put(oneWcsExitOutExitVt, 0);
allMap.put(oneWcsExitOutExit, oneWcsExitOutExitMap);
Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate_dps, JsonUtil.toJSONString(allMap));
if (errBoolean) {
log.info("1楼出库确认后消除报警信息,写入点位成功{}", allMap);
} else {
log.info("1楼出库确认后消除报警信息,写入点位失败{}", allMap);
}
}else if (layer == 2){
//2楼出库尚未拣货时,写入异常给plc
Map<String, Integer> twoWcsErrExitMap = new HashMap<>(1);
twoWcsErrExitMap.put(twoWcsErrExitVt, 0);
allMap.put(twoWcsErrExit, twoWcsErrExitMap);
Map<String, Integer> twoWcsErrExitOutMap = new HashMap<>(1);
twoWcsErrExitOutMap.put(twoWcsExitOutExitVt, 0);
allMap.put(twoWcsExitOutExit, twoWcsErrExitOutMap);
Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate_dps, JsonUtil.toJSONString(allMap));
if (errBoolean) {
log.info("2楼出库确认后消除报警信息,写入点位成功{}", allMap);
} else {
log.info("2楼出库确认后消除报警信息,写入点位失败{}", allMap);
}
}
}
}
}
/**
* 下发出库任务
*

Loading…
Cancel
Save