| | |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.utils.LocManageUtil; |
| | | import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized R generateAGVTasks(WaitPakin pakins, String locCode, String orgSta,String targSite, Long loginUserId) { |
| | | public synchronized R generateAGVTasks(WaitPakin pakins, String locCode, String orgSta, Long loginUserId,String areaId) { |
| | | if (Cools.isEmpty(pakins) || Cools.isEmpty(locCode)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | |
| | | throw new CoolException("任务明细保存失败!!"); |
| | | } |
| | | waitPakinItems.forEach(item -> { |
| | | boolean b = new WarehouseLocationRetrievalUtil().retrieveMatnrIsItAvailable(areaId, item.getMatnrId()); |
| | | if (!b){ |
| | | throw new CoolException("入库失败!!物料Id:"+item.getMatnrId()+"不支持此目标库区:"+areaId); |
| | | } |
| | | if (!waitPakinItemService.update(new LambdaUpdateWrapper<WaitPakinItem>() |
| | | .set(WaitPakinItem::getWorkQty, item.getAnfme()) |
| | | .eq(WaitPakinItem::getId, item.getId()))) { |
| | |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getById(waitPakin.getSiteId()); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite())); |
| | | // DeviceSite deviceSite = deviceSiteService.getById(); |
| | | // if (Objects.isNull(deviceSite)) { |
| | | // throw new CoolException("站点不存在!!"); |
| | | // } |
| | | DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(waitPakin.getSiteNo())); |
| | | if (Cools.isEmpty(deviceBind)) { |
| | | throw new CoolException("库位规则未知"); |
| | | } |
| | |
| | | // } |
| | | |
| | | //验证基础信息 |
| | | checkStaStatus(pakin.getBarcode(), deviceSite.getSite(),warehouseArea.getId().toString()); |
| | | checkStaStatus(pakin.getBarcode(),waitPakin.getSiteNo(),warehouseArea.getId().toString()); |
| | | /**获取库位*/ |
| | | String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null); |
| | | if (Cools.isEmpty(targetLoc)) { |
| | |
| | | .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val) |
| | | .setTargLoc(targetLoc) |
| | | .setBarcode(pakin.getBarcode()) |
| | | .setOrgSite(deviceSite.getSite()) |
| | | .setTargSite(deviceSite.getDeviceSite()) |
| | | .setOrgSite(waitPakin.getSiteNo()) |
| | | .setTargSite(waitPakin.getSiteNo()) |
| | | .setCreateBy(loginUserId) |
| | | .setUpdateBy(loginUserId); |
| | | // if (!Objects.isNull(waitPakin.getSiteId()) && waitPakin.getSiteId() > 0) { |
| | |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, deviceSite.getSite())); |
| | | .eq(BasStation::getStationName, waitPakin.getSiteNo())); |
| | | if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("站点不存在或站点不处于空库状态!!"); |
| | | } |