| | |
| | | import com.zy.asrs.entity.param.FullStoreParam; |
| | | import com.zy.asrs.entity.param.LocDetlAdjustParam; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.enums.ContainerType; |
| | | import com.zy.asrs.enums.LocAreaType; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.entity.result.FindLocNoAttributeVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.model.*; |
| | | import com.zy.common.model.enums.IoWorkType; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.WcsController; |
| | | import jdk.nashorn.internal.ir.annotations.Ignore; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private BasStationDetlService basStationDetlService; |
| | | @Autowired |
| | | private BasAreasService basAreasService; |
| | | @Autowired |
| | | private OrderPakoutServiceImpl orderPakoutService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | // List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | // List<String> batchs = param.getList().stream().map(FullStoreParam.MatCodeStore::getBatch).distinct().collect(Collectors.toList()); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(param.getList().get(0)); |
| | | |
| | | // BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode())); |
| | | // if (Objects.isNull(container)) { |
| | | // throw new CoolException("容器编码未维护,请维护后再操作!!"); |
| | | // } |
| | | // |
| | | // Integer whsType = 1; |
| | | // Short lcoType = 1; |
| | | // //用于判断料箱托盘,料箱,笼框 |
| | | // if (!container.getType().equals(ContainerType.CONTAINER_TYPE_BOX.type)) { |
| | | // whsType = 2; |
| | | // if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) { |
| | | // lcoType = 2; |
| | | // } |
| | | // } |
| | | |
| | | StartupDto dto = commonService.getLocNo(1, param.getDevpNo(), sourceStaNo.getDevNo(), findLocNoAttributeVo, locTypeDto); |
| | | if (Cools.isEmpty(dto)) { |
| | | throw new CoolException("查询库位失败!!==》startupFullPutStore ==》 commonService.getLocNo"); |
| | |
| | | |
| | | // 获取路径 |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta); |
| | | |
| | | //移走潜库位在库或空板信息 |
| | | moveShallowLocByF(staNo, userId, dto, locMast, staDesc, now); |
| | | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | // 生成工作档 |
| | |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void moveShallowLocByF(BasDevp staNo, Long userId, OutLocDto dto, LocMast locMast, StaDesc staDesc, Date now) { |
| | | String shallowLoc = Utils.getShallowLoc(locMast.getLocNo(), MesConstant.deepRows); |
| | | if (!Objects.isNull(shallowLoc)) { |
| | | LocMast locNo = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc)); |
| | | if (locNo.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type) || locNo.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) { |
| | | //TODO 出库前判断是浅库位是否有货,如果有货优先生成移库任务 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(staDesc.getCrnStn(), true); |
| | | sourceStaNo.setLocType1(locMast.getLocType1()); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | StartupDto mvDto = commonService.getLocNo(1, staNo.getDevNo(), 2, null, locTypeDto); |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(mvDto.getWorkNo()); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(1L); // 工作状态:11.移库任务 |
| | | wrkMast.setIoType(11); // 入出库状态 |
| | | wrkMast.setIoPri(999D); // 优先级:13 |
| | | wrkMast.setStaNo(""); |
| | | wrkMast.setCrnNo(locNo.getCrnNo()); |
| | | //源库位 |
| | | wrkMast.setSourceLocNo(locNo.getLocNo()); // 源库位 |
| | | //目标库位 |
| | | wrkMast.setLocNo(mvDto.getLocNo()); |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setBarcode(locNo.getBarcode()); |
| | | wrkMast.setAppeUser(userId); // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存移库工作档失败,移库库位号:" + locNo.getLocNo() + "目标库位号:" + dto.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setBoxType1(locDto.getBoxType1()); |
| | | wrkDetl.setBatch(locDto.getBatch()); |
| | | wrkDetl.setOrderNo(locDto.getOrderNo()); |
| | | wrkDetl.setAnfme(locDto.getAnfme()); // 数量 |
| | |
| | | wrkDetl.setOrderId(checkOrderDetls.getId()); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setBoxType1(locDto.getBoxType1()); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setBatch(locDto.getBatch()); |
| | | wrkDetl.setOrderNo(locDto.getOrderNo()); |
| | |
| | | wrkDetl.setWrkNo(workNo) |
| | | .setId(null) |
| | | .setIoTime(new Date()) |
| | | .setMatnr(locDto.getMatnr()) |
| | | .setMaktx(locDto.getMaktx()) |
| | | .setOrderNo(locDto.getOrderNo()) |
| | | .setAnfme(locDto.getAnfme()) |
| | | .setBoxType1(locDto.getBoxType1()) |
| | | .setZpallet(locCache.getBarcode()) |
| | | .setBatch(locDto.getBatch()) |
| | | .setAppeUser(userId) |
| | |
| | | // throw new CoolException("修改订单明细数量失败"); |
| | | // } |
| | | // orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.FALSE, orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), |
| | | orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), |
| | | "1", orderDetl.getBoxType2(), orderDetl.getBoxType3() |
| | | , locDto.getAnfme()); |
| | | OrderInAndOutUtil.updateOrder(Boolean.FALSE, orderDetl.getOrderId(), 2L, userId); |
| | | OrderPakout orderNo = orderPakoutService.selectOne(new EntityWrapper<OrderPakout>().eq("order_no", orderDetl.getOrderNo())); |
| | | if (!Objects.isNull(orderNo)) { |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.FALSE, orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), |
| | | orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), |
| | | "1", orderDetl.getBoxType2(), orderDetl.getBoxType3() |
| | | , locDto.getAnfme()); |
| | | OrderInAndOutUtil.updateOrder(Boolean.FALSE, orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | |
| | |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setBoxType1(locDetl.getBoxType1()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | |
| | | if (locDetl.getMatnr().equals(adjust.getMatnr()) && Cools.eq(locDetl.getBatch(), adjust.getBatch())) { |
| | | if (!locDetl.getAnfme().equals(adjust.getCount())) { |
| | | // todo 盘点记录 |
| | | // 修改库存 |
| | | if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), locDetl.getBrand(), |
| | | locDetl.getStandby1(), locDetl.getStandby2(), locDetl.getStandby3(), locDetl.getBoxType1(), locDetl.getBoxType2(), locDetl.getBoxType3())) { |
| | | throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号修改数量失败"); |
| | | locDetl.setSuppCode(adjust.getSuppCode()); |
| | | locDetl.setBoxType1(adjust.getBoxType1()); |
| | | locDetl.setAnfme(adjust.getCount()); |
| | | locDetl.setStandby1(adjust.getSuppCode()); |
| | | // locDetl.setZpallet(locDetl.getZpallet()); |
| | | |
| | | |
| | | if (!locDetlService.update(locDetl, new EntityWrapper<LocDetl>().eq("loc_no", locDetl.getLocNo()))) { |
| | | throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getSuppCode() + "供应商修改数量失败"); |
| | | } |
| | | // 修改库存 |
| | | // if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), locDetl.getBrand(), |
| | | // locDetl.getStandby1(), locDetl.getStandby2(), locDetl.getStandby3(), locDetl.getBoxType1(), locDetl.getBoxType2(), locDetl.getBoxType3())) { |
| | | // throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号修改数量失败"); |
| | | // } |
| | | // 保存调整记录 |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | | adjDetl.setLocNo(locDetl.getLocNo()); |
| | |
| | | adjDetl.setModiUser(userId); |
| | | adjDetl.setAppeTime(now); |
| | | adjDetl.setAppeUser(userId); |
| | | adjDetlService.save(adjDetl, userId); |
| | | |
| | | if (!adjDetlService.insert(adjDetl)) { |
| | | throw new CoolException("调整记录保存失败!!"); |
| | | } |
| | | // adjDetlService.save(adjDetl, userId); |
| | | if (updateFlag) { |
| | | wrkMast.setWrkNo(commonService.getWorkNo(3)); |
| | | wrkMast.setIoType(23); |
| | |
| | | WrkDetlLog wrkDetl = new WrkDetlLog(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setBoxType1(locDetl.getBoxType1()); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setAnfme(adjust.getCount()); |
| | | wrkDetl.setAppeTime(now); |
| | |
| | | // todo 盘点记录 |
| | | if (!locDetlService.updateAnfme(-1.0D, locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), locDetl.getBrand(), |
| | | locDetl.getStandby1(), locDetl.getStandby2(), locDetl.getStandby3(), locDetl.getBoxType1(), locDetl.getBoxType2(), locDetl.getBoxType3())) { |
| | | throw new CoolException("删除" + locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号库存明细失败"); |
| | | // throw new CoolException("删除" + locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号库存明细失败"); |
| | | } |
| | | // 保存调整记录 |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | |
| | | locDetl.setZpallet(locMast.getBarcode()); |
| | | locDetl.setAnfme(adjust.getCount()); // 数量 |
| | | locDetl.setModiUser(userId); // 操作人员信息 |
| | | locDetl.setSuppCode(adjust.getSuppCode()); |
| | | locDetl.setStandby1(adjust.getSuppCode()); |
| | | locDetl.setBoxType1(adjust.getBoxType1()); |
| | | locDetl.setModiTime(now); |
| | | locDetl.setAppeUser(userId); |
| | | locDetl.setAppeTime(now); |
| | |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setBoxType1(locDetl.getBoxType1()); |
| | | wrkDetl.setAnfme(adjust.getCount()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 |
| | | // wrkMast.setStaNo(staNo + ""); // 目标站 |
| | | // if (wrkMast.getIoType() == 107) { |
| | | // // 修改库位状态 Q.拣料/盘点/并板再入库 |
| | | // LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | // if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("库位不存在:" + wrkMast.getLocNo()); |
| | | // } |
| | | // locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | // .eq("loc_sts", ) |
| | | // .eq("whs_type", locMast.getWhsType())); |
| | | // |
| | | // |
| | | // } else { |
| | | // // wrkMast.setStaNo(staNo + ""); // 目标站 |
| | | // wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | // wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | // } |
| | | // wrkMast.setStaNo(staNo + ""); // 目标站 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | wrkMast.setModiTime(now); |