| | |
| | | generateCacheOutTask(station, locCache, userId); |
| | | |
| | | /**生成立库出库任务*/ |
| | | generateCRNOutTask(station, locCache, userId); |
| | | // generateCRNOutTask(station, locCache, userId); |
| | | |
| | | return R.ok(); |
| | | } |
| | |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setWrkSts(1L) // 工作状态:11.生成出库ID |
| | | .setWrkSts(201L) // 工作状态:11.生成入库库ID |
| | | .setIoType(1) // 入出库状态: 11.库格移载 |
| | | .setTaskType("agv") |
| | | .setIoPri(10D) |
| | |
| | | throw new CoolException("容器编码未维护,请维护后再操作!!"); |
| | | } |
| | | |
| | | Integer whsType = 1; |
| | | Integer whsType = 2; |
| | | Short lcoType = 1; |
| | | //用于判断料箱托盘,料箱,笼框 |
| | | if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) { |
| | | whsType = 3; |
| | | } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_CAGE.type)) { |
| | | if (!container.getType().equals(ContainerType.CONTAINER_TYPE_BOX.type)) { |
| | | whsType = 2; |
| | | if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) { |
| | | lcoType = 2; |
| | | } |
| | | } |
| | | |
| | | WrkMast barcode = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode())); |
| | |
| | | throw new CoolException("数据错误,组拖档已不存在!!"); |
| | | } |
| | | |
| | | WrkMast wrkMast = generateCrnInTask(waitPakins, whsType, station, param.getLocType1(), userId); |
| | | WrkMast wrkMast = generateCrnInTask(waitPakins, whsType, station, lcoType, userId); |
| | | |
| | | response.put("taskNo", wrkMast.getWrkNo()); |
| | | response.put("locNo", wrkMast.getLocNo()); |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("orderService") |
| | |
| | | @Override |
| | | public boolean saveHandlerOrder(Boolean pakin, WrkMast wrkMast, List<WrkDetl> wrkDetls) { |
| | | try { |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(),wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(), |
| | | wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3(), wrkDetl.getAnfme(), wrkDetl.getThreeCode())); |
| | | }); |
| | | String orderNo = "HAND" + snowflakeIdWorker.nextId(); |
| | | if (pakin) { |
| | | // 生成入库单据 |
| | | OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | openParam.setOrderNo(orderNo); |
| | | openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | openParam.setOrderType("手动入库单"); |
| | | openParam.setOrderDetails(detlDtos); |
| | | openService.pakinOrderCreate(openParam); |
| | | } else { |
| | | // 生成出库单据 |
| | | OpenOrderPakoutParam openParam = new OpenOrderPakoutParam(); |
| | | openParam.setOrderNo(orderNo); |
| | | openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | openParam.setOrderType("手动出库单"); |
| | | openParam.setOrderDetails(detlDtos); |
| | | openService.pakoutOrderCreate(openParam); |
| | | } |
| | | |
| | | Order order = this.selectByNo(orderNo); |
| | | if (null == order) { |
| | | throw new CoolException("生成单据失败"); |
| | | } |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | for (DetlDto detlDto : detlDtos) { |
| | | // 修改订单明细数量 |
| | | if (!orderDetlService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3(),detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | // String orderNo = "HAND" + snowflakeIdWorker.nextId(); |
| | | // if (pakin) { |
| | | // // 生成入库单据 |
| | | // OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | // openParam.setOrderNo(orderNo); |
| | | // openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | // openParam.setOrderType("手动入库单"); |
| | | // openParam.setOrderDetails(detlDtos); |
| | | // openService.pakinOrderCreate(openParam); |
| | | // } else { |
| | | // // 生成出库单据 |
| | | // OpenOrderPakoutParam openParam = new OpenOrderPakoutParam(); |
| | | // openParam.setOrderNo(orderNo); |
| | | // openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | // openParam.setOrderType("手动出库单"); |
| | | // openParam.setOrderDetails(detlDtos); |
| | | // openService.pakoutOrderCreate(openParam); |
| | | // } |
| | | |
| | | |
| | | Map<String, List<WrkDetl>> listMap = wrkDetls.stream().collect(Collectors.groupingBy(WrkDetl::getOrderNo)); |
| | | |
| | | listMap.keySet().forEach(orderNo -> { |
| | | Order order = this.selectByNo(orderNo); |
| | | if (null == order) { |
| | | throw new CoolException("生成单据失败"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3(),detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | } |
| | | |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | listMap.get(orderNo).forEach(wrkDetl -> { |
| | | detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(),wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(), |
| | | wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3(), wrkDetl.getAnfme(), wrkDetl.getThreeCode())); |
| | | }); |
| | | |
| | | for (DetlDto detlDto : detlDtos) { |
| | | // 修改订单明细数量 |
| | | if (!orderDetlService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3(),detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3(),detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | log.error("saveHandlerOrder===>>", e); |
| | | return false; |
| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.TaskDetlLogServiceImpl; |
| | | import com.zy.asrs.service.impl.TaskDetlServiceImpl; |
| | | import com.zy.asrs.service.impl.WrkDetlLogServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | |
| | | CheckOrderDetlService checkOrderDetlService; |
| | | @Autowired |
| | | private TaskDetlLogService taskDetlLogService; |
| | | @Autowired |
| | | private WrkDetlLogServiceImpl wrkDetlLogService; |
| | | |
| | | |
| | | @Transactional |
| | |
| | | orderDetls.forEach(detl -> { |
| | | Mat material = matService.selectByMatnr(detl.getMatnr()); |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | throw new CoolException(material.getMatnr() + "物料不存在"); |
| | | } |
| | | ReportOrderParams itemParam = new ReportOrderParams(); |
| | | |
| | |
| | | orderDetls.forEach(detl -> { |
| | | Mat material = matService.selectByMatnr(detl.getMatnr()); |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | throw new CoolException(material.getMatnr() + "物料不存在"); |
| | | } |
| | | TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>() |
| | | //TODO 正常完结需要打开 |
| | | // TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>() |
| | | // .eq("matnr", detl.getMatnr()) |
| | | // .eq("supp_code", detl.getStandby1()) |
| | | // .eq("order_no", detl.getOrderNo())); |
| | | // if (Objects.isNull(detlLog)) { |
| | | // throw new CoolException("数据错误 ,请检查AGV任务档是否已完成!!"); |
| | | // } |
| | | WrkDetlLog detlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>() |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("supp_code", detl.getStandby1()) |
| | | .eq("order_no", detl.getOrderNo())); |
| | | if (Objects.isNull(detlLog)) { |
| | | throw new CoolException("数据错误 ,请检查AGV任务档是否已完成!!"); |
| | | throw new CoolException("物料编码:" + detl.getMatnr() + "数据错误 ,请检查堆垛机任务档是否已完成!!"); |
| | | } |
| | | //目标库区 |
| | | orderParam.setTarget_location(detlLog.getAreaType()); |
| | | orderParam.setTarget_location("2"); |
| | | // orderParam.setTarget_location(detlLog.getAreaType()); |
| | | OrderItemsParam itemParam = new OrderItemsParam(); |
| | | // BS Code |
| | | itemParam |
| | |
| | | // // 上报时,默认来源位置是null |
| | | .setLocation_no(detlLog.getZpallet()) |
| | | // 上报时,默认上报数量是订单数量 |
| | | .setPick_qty(detl.getQty().intValue()); |
| | | .setPick_qty(Objects.isNull(detl.getQty()) ? 0 : detl.getQty().intValue()); |
| | | reportOrderParams.add(itemParam); |
| | | }); |
| | | |
| | |
| | | orderDetls.forEach(detl -> { |
| | | Mat material = matService.selectByMatnr(detl.getMatnr()); |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | throw new CoolException(material.getMatnr() + "物料不存在"); |
| | | } |
| | | |
| | | TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>() |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("supp_code", detl.getStandby1()) |
| | |
| | | detls.forEach(detl -> { |
| | | Mat material = matService.selectByMatnr(detl.getMatnr()); |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | throw new CoolException(material.getMatnr() + "物料不存在"); |
| | | } |
| | | OrderItemsParam itemParam = new OrderItemsParam(); |
| | | itemParam.setLocation_no(detl.getZpallet()) |
| | |
| | | case 2://经典单伸库位(2排货架) |
| | | return LocNecessaryParametersDoubleExtension2(rowLastno, curRow, crnNumber); //已完善 |
| | | case 3://经典单双伸库位 左单右双(小单大双) |
| | | return LocNecessaryParametersDoubleExtension3(rowLastno, curRow, crnNumber); //未完善 |
| | | return LocNecessaryParametersDoubleExtension(rowLastno, curRow, crnNumber); //已完善 |
| | | // return LocNecessaryParametersDoubleExtension3(rowLastno, curRow, crnNumber); //未完善 |
| | | case 4://经典单双伸库位 左双右单(小双大单) |
| | | return LocNecessaryParametersDoubleExtension4(rowLastno, curRow, crnNumber); //未完善 |
| | | case 5://双工位单伸库位(4排货架) |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if (dto.getAnfme() > locDetl.getAnfme()) { |
| | | throw new CoolException("服务器内部错误"); |
| | | if (dto.getAnfme() > locDetl.getAnfme() && dto.getStandby1().equals(locDetl.getStandby1()) ) { |
| | | throw new CoolException("订单数量不能大于库存数量!!"); |
| | | } |
| | | if (dto.getAnfme().equals(locDetl.getAnfme())) { |
| | | sameNumber++; |
| | |
| | | // /** |
| | | // * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | // */ |
| | | if (rowLastnoType.getType() == 3) { |
| | | return getDoubleLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, |
| | | 4, locTypeDto, 0); |
| | | } else { |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | } |
| | | // if (rowLastnoType.getType() == 3) { |
| | | // return getDoubleLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, |
| | | // 4, locTypeDto, 0); |
| | | // } else { |
| | | // |
| | | // } |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | } catch (Exception e) { |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | } |
| | |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNoRun(Integer staDescId, Integer whsType, Integer sourceStaNo, |
| | | public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, |
| | | FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | staDescId = 1; |
| | | // 初始化参数 |
| | |
| | | throw new CoolException("数据异常,请联系管理员===>库位规则未知"); |
| | | } |
| | | |
| | | // 均衡分布堆垛机 |
| | | int minCount = Integer.MAX_VALUE; |
| | | for (int i = rowLastno.getsCrnNo(); i <= rowLastno.geteCrnNo(); i++) { |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i)); |
| | | if (count < minCount) { |
| | | minCount = count; |
| | | crnNo = i; |
| | | if (whsType == 2) { |
| | | if (locTypeDto.getLocType1() == 2) { |
| | | // 均衡分布堆垛机 |
| | | for (int i = 4; i <= 5; i++) { |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i)); |
| | | if (count < minCount) { |
| | | minCount = count; |
| | | crnNo = i; |
| | | } |
| | | } |
| | | } else { |
| | | for (int i = 4; i <= 6; i++) { |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i)); |
| | | if (count < minCount) { |
| | | minCount = count; |
| | | crnNo = 6; |
| | | } |
| | | } |
| | | |
| | | if (crnNo == 6) { |
| | | return getDoubleLocNoRun(3, 1, sourceStaNo, findLocNoAttributeVo, null, locTypeDto, times); |
| | | } |
| | | } |
| | | } else { |
| | | // 均衡分布堆垛机 |
| | | for (int i = rowLastno.getsCrnNo(); i <= rowLastno.geteCrnNo(); i++) { |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i)); |
| | | if (count < minCount) { |
| | | minCount = count; |
| | | crnNo = i; |
| | | } |
| | | } |
| | | } |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .ge("row1", rowLastno.getsRow()) |
| | | .le("row1", rowLastno.geteRow()) |
| | | .eq("crn_no", crnNo) |
| | | // .eq("move_status", 0) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("loc_sts", "O") |
| | | .orderAsc(Arrays.asList("lev1", "row1", "bay1"))); |
| | | // int crnCountO = wrkMastService.selectCount(new |
| | | // EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | |
| | | // 生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | int workNo; |
| | | if (whsType == 2) { |
| | | // 生成工作号 |
| | | workNo = getWorkNo(3); |
| | | } else { |
| | | // 生成工作号 |
| | | workNo = getWorkNo(0); |
| | | } |
| | | // 返回dto |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | |
| | | */ |
| | | public StartupDto getDoubleLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | | int nearRow = 0; //最浅库位排 |
| | | int curRow = 0; //最深库位排 |
| | | int crnNo = 6; //堆垛机号 |
| | | int nearRow = 11; //最浅库位排 |
| | | int curRow = 14; //最深库位排 |
| | | int rowCount = 0; //轮询轮次 |
| | | LocMast locMast = null; // 目标库位 |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i < crnNumber * 2; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | if (locMasts.size() - crnCountO <= 2) { |
| | | log.error(crnNo + "号堆垛机没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | nearRow = 0; |
| | | times++; |
| | | continue; |
| | | } |
| | | break; |
| | | } else { |
| | | times++; |
| | | } |
| | | } |
| | | // //此程序用于优化堆垛机异常时的运行时间 |
| | | // for (int i = times; i < crnNumber * 2; i++) { |
| | | // int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | // curRow = locNecessaryParameters[1]; |
| | | // crnNo = locNecessaryParameters[2]; |
| | | // if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | // rowCount = locNecessaryParameters[0]; |
| | | // nearRow = locNecessaryParameters[3]; |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | // int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | // if (locMasts.size() - crnCountO <= 2) { |
| | | // log.error(crnNo + "号堆垛机没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | // nearRow = 0; |
| | | // times++; |
| | | // continue; |
| | | // } |
| | | // break; |
| | | // } else { |
| | | // times++; |
| | | // } |
| | | // } |
| | | if (nearRow == 0) { |
| | | throw new CoolException("无可用堆垛机"); |
| | | } |
| | |
| | | if (signRule1) { |
| | | if (nearRow != curRow) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | .eq("row1", nearRow).eq("loc_sts", "O").eq("crn_no", crnNo)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | //获取巷道 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("loc_sts", "O").eq("crn_no", crnNo) |
| | | .orderBy("lev1", true).orderBy("bay1", true)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } |
| | | } else { |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // for (LocMast locMast1 : locMasts) { |
| | | // if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | // continue; |
| | | // } |
| | | // if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | // .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("crn_no", crnNo)); |
| | | // if (!Cools.isEmpty(locMast2)) { |
| | | // locMast = locMast2; |
| | | // break; |
| | | // } |
| | | // } else { |
| | | // if (!Cools.isEmpty(locMast1)) { |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | for (LocMast locMast1 : locMasts) { |
| | |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("crn_no", crnNo)); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("crn_no", crnNo)); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("crn_no", crnNo)); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | |
| | | |
| | | // 渲染搜索模板 |
| | | $.ajax({ |
| | | url: baseUrl+"/docType/list/auth", |
| | | url: baseUrl + "/docType/list/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | limit: 9999 |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | let template = Handlebars.compile($('#docTypeTpl').html()); |
| | | $('#docType-query').html(template(res.data)); |
| | | layui.form.render('select'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | |
| | | // 渲染表格 |
| | | var insTb = table.render({ |
| | | elem: '#order', |
| | | url: baseUrl+'/order/pakout/order/head/page/auth', |
| | | url: baseUrl + '/order/pakout/order/head/page/auth', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | { type: 'numbers' }, |
| | | { field: 'orderNo', title: '单据编号', templet: '#orderNoTpl' , minWidth: 180}, |
| | | { field: 'defNumber', align: 'center', title: '流水号', minWidth: 160, width: 160 }, |
| | | { field: 'number', align: 'center', title: '派工单号', minWidth: 160, width: 160 }, |
| | | { field: 'cstmrName', align: 'center', title: '公司ID', minWidth: 160, width: 160 }, |
| | | { field: 'itemName', align: 'center', title: '箱号', minWidth: 160, width: 160 }, |
| | | { field: 'docType$', align: 'center', title: '类型', minWidth: 130}, |
| | | { field: 'orderTime', align: 'center', title: '派工时间', minWidth: 160, width: 160 }, |
| | | { field: 'createTime$', title: '创建时间', minWidth: 160, width: 160 }, |
| | | { field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 100, width: 100 }, |
| | | { align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160 }, |
| | | { align: 'center', title: '操作', toolbar: '#operate', width: 180 } |
| | | {type: 'numbers'}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl', minWidth: 180}, |
| | | {field: 'defNumber', align: 'center', title: '流水号', minWidth: 160, width: 160}, |
| | | {field: 'number', align: 'center', title: '派工单号', minWidth: 160, width: 160}, |
| | | {field: 'cstmrName', align: 'center', title: '公司ID', minWidth: 160, width: 160}, |
| | | {field: 'itemName', align: 'center', title: '箱号', minWidth: 160, width: 160}, |
| | | {field: 'docType$', align: 'center', title: '类型', minWidth: 130}, |
| | | {field: 'orderTime', align: 'center', title: '派工时间', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间', minWidth: 160, width: 160}, |
| | | {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 100, width: 100}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {align: 'center', title: '操作', toolbar: '#operate', width: 180} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | done: function (res, curr, count) { |
| | | limit(); |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | insTbCount = count; |
| | | } |
| | |
| | | success: function (layero, dIndex) { |
| | | table.render({ |
| | | elem: '#itemTable', |
| | | headers: { token: localStorage.getItem('token') }, |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl + '/order/pakout/orderDetl/list/auth', |
| | | where: { |
| | | order_id: data.id |
| | |
| | | page: true, |
| | | height: '450px;', |
| | | cellMinWidth: 100, |
| | | cols: [ |
| | | // [ |
| | | // { type: 'numbers' }, |
| | | // { field: 'matnr', title: '商品编码', width: 160 }, |
| | | // { field: 'maktx', title: '商品名称', width: 160 }, |
| | | // { field: 'standby1', title: '供应商编码', width: 160 }, |
| | | // { field: 'threeCode', title: 'BS Code', width: 160 }, |
| | | // { field: 'tag$', title: '物料种类' }, |
| | | // { field: 'anfme', title: '数量' }, |
| | | // { field: 'workQty', title: '作业数量' }, |
| | | // { field: 'qty', title: '完成数量', style: 'font-weight: bold' }, |
| | | // { field: 'specs', title: '规格' } |
| | | // ] |
| | | getCol() |
| | | |
| | | ], |
| | | cols: [[ |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | {field: 'tag$', align: 'center', title: '零件类型'}, |
| | | {field: 'standby1', title: '供应商编码', width: 120}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'workQty', title: '作业数量'}, |
| | | {field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | {field: 'weight', align: 'center',title: '重量', hide: false }, |
| | | {field: 'volume', align: 'center',title: '尺寸', hide: false}, |
| | | {field: 'specs', title: '规格'} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | |
| | | }); |
| | | |
| | | function getCol() { |
| | | var cols = []; |
| | | var cols = [{field: 'locNo$', align: 'center', title: '库位号'},]; |
| | | cols.push.apply(cols, cacheCols); |
| | | return cols; |
| | | } |
| | |
| | | $.ajax({ |
| | | url: baseUrl + "/basAreas/list/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { limit: 9999 }, |
| | | data: {limit: 9999}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | |
| | | } |
| | | let nList = admin.util.deepClone(xxDataList); |
| | | for (let xi = 0; xi < nList.length; xi++) { |
| | | if (nList[xi].anfme <= 0){ |
| | | if (nList[xi].anfme <= 0) { |
| | | layer.msg('明细修改数量不合法', {icon: 2}); |
| | | return false; |
| | | } |
| | | if (nList[xi].anfme < nList[xi].workQty){ |
| | | if (nList[xi].anfme < nList[xi].workQty) { |
| | | layer.msg('数量不能小于已作业数量', {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/pakout/order/form/" + (isExpAdd?"add":"modify") + "/auth", |
| | | url: baseUrl + "/order/pakout/order/form/" + (isExpAdd ? "add" : "modify") + "/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | orderId: Number(data.field.id), |
| | |
| | | itemName: data.field.itemName ? Number(data.field.itemName) : null, |
| | | orderDetlPakoutList: nList |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | layer.close(dIndex); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | |
| | | cellMinWidth: 100, |
| | | cols: [ |
| | | getCol() |
| | | // [ |
| | | // {type: 'numbers', title: '#'}, |
| | | // {field: 'matnr', title: '零件代码', width: 160}, |
| | | // {field: 'maktx', title: '零件名称', width: 200}, |
| | | // // {field: 'batch', title: '批号', edit: true}, |
| | | // {field: 'standby1', title: '供应商代码', edit: true}, |
| | | // {field: 'specs', title: '规格'}, |
| | | // {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | // {field: 'workQty', title: '作业数量', minWidth: 100, width: 100}, |
| | | // // {field: 'unit', title: '单位', width: 80}, |
| | | // {field: 'memo', title: '备注' , edit: true}, |
| | | // {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} |
| | | // ] |
| | | // [ |
| | | // {type: 'numbers', title: '#'}, |
| | | // {field: 'matnr', title: '零件代码', width: 160}, |
| | | // {field: 'maktx', title: '零件名称', width: 200}, |
| | | // // {field: 'batch', title: '批号', edit: true}, |
| | | // {field: 'standby1', title: '供应商代码', edit: true}, |
| | | // {field: 'specs', title: '规格'}, |
| | | // {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | // {field: 'workQty', title: '作业数量', minWidth: 100, width: 100}, |
| | | // // {field: 'unit', title: '单位', width: 80}, |
| | | // {field: 'memo', title: '备注' , edit: true}, |
| | | // {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} |
| | | // ] |
| | | ], |
| | | done: function (res) { |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | |
| | | }; |
| | | if (!isExpAdd) { |
| | | $.ajax({ |
| | | url: baseUrl+"/order/pakout/order/detl/all/auth?orderId=" + expTpe.id, |
| | | url: baseUrl + "/order/pakout/order/detl/all/auth?orderId=" + expTpe.id, |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | xxDataList = res.data; |
| | | tbOptions.data = xxDataList; |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | |
| | | if (layEvent === 'edit') { |
| | | showEditModel2(data); |
| | | } else if (layEvent === 'del') { |
| | | if(data.workQty > 0){ |
| | | if (data.workQty > 0) { |
| | | layer.msg("已存在作业数量,不能删除", {icon: 2}); |
| | | return; |
| | | } |
| | |
| | | table.on('edit(formSSXMTable)', function (obj) { |
| | | let index = obj.tr.attr("data-index"); |
| | | let data = xxDataList[index]; |
| | | if (obj.field === 'anfme'){ |
| | | if (obj.field === 'anfme') { |
| | | let vle = Number(obj.value); |
| | | if (isNaN(vle)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | |
| | | // insTbSSXM.reload({data: xxDataList}); |
| | | return false; |
| | | } |
| | | if(obj.value < data.workQty){ |
| | | if (obj.value < data.workQty) { |
| | | layer.msg("输入数量不能小于作业中数量", {icon: 2}); |
| | | // data[obj.field] = 0; |
| | | // insTbSSXM.reload({data: xxDataList}); |
| | |
| | | // 表单提交事件 |
| | | form.on('submit(matEditSubmit)', function (data) { |
| | | let selectList = matXmSelect.getValue(); |
| | | for (let i = 0; i<selectList.length; i++) { |
| | | for (let i = 0; i < selectList.length; i++) { |
| | | let item = selectList[i]; |
| | | // 查询物料详情 |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/covert/"+item.value+"/auth", |
| | | url: baseUrl + "/mat/covert/" + item.value + "/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | xxDataList.push(res.data); |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | |
| | | width: '340px', |
| | | }, |
| | | autoRow: true, |
| | | toolbar: { show: true }, |
| | | toolbar: {show: true}, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | remoteMethod: function(val, cb, show){ |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/all/get/kv", |
| | | url: baseUrl + "/mat/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/pakout/order/delete/auth", |
| | | url: baseUrl + "/order/pakout/order/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | |
| | | console.log(orderId); |
| | | console.log(settle); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/pakout/order/update/auth", |
| | | url: baseUrl + "/order/pakout/order/update/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | id: orderId, |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | |
| | | function showWrkTrace(orderId) { |
| | | let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false}); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/pakout/order/wrk/trace/auth", |
| | | url: baseUrl + "/order/pakout/order/wrk/trace/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | if (res.code === 200) { |
| | | laytpl(wrkTraceDialog.innerHTML).render(res.data, function (html) { |
| | | admin.open({ |
| | | type: 1, |
| | |
| | | }, |
| | | color: ['#10B4E8', '#E0E0E0', '#FF0000'], |
| | | tooltip: {trigger: 'item'}, |
| | | series: [{name: '数量', type: 'pie', radius: ['75%', '80%'], label: {normal: {show: false}}}] |
| | | series: [{ |
| | | name: '数量', |
| | | type: 'pie', |
| | | radius: ['75%', '80%'], |
| | | label: {normal: {show: false}} |
| | | }] |
| | | }; |
| | | traceCharts.setOption(traceOptions); |
| | | // 赋值 |
| | | traceCharts.setOption({ |
| | | title: { |
| | | subtext: res.data.totalQty+"/"+res.data.wrkQty+"/"+res.data.endQty |
| | | subtext: res.data.totalQty + "/" + res.data.wrkQty + "/" + res.data.endQty |
| | | }, |
| | | series: [ |
| | | { |
| | | data: [ |
| | | {name: '已作业', value: res.data.wrkQty}, |
| | | {name: '未作业', value: res.data.totalQty-res.data.wrkQty-res.data.lackQty}, |
| | | { |
| | | name: '未作业', |
| | | value: res.data.totalQty - res.data.wrkQty - res.data.lackQty |
| | | }, |
| | | {name: '库存不足', value: res.data.lackQty}, |
| | | ] |
| | | } |
| | |
| | | } |
| | | }); |
| | | }); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | |
| | | |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | }); |