自动化立体仓库 - WMS系统
skyouc
2 天以前 e466acffabd3cba968bd5c6cbc89de8c5eedb38a
no message
1个文件已添加
17个文件已修改
563 ■■■■■ 已修改文件
license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/WcsApiServiceImpl.java 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/CombParam.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/TvQueryParam.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/OpenService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 328 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/constant/MesConstant.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderDetlPakinMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkDetlMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
license.lic
Binary files differ
src/main/java/com/zy/api/service/impl/WcsApiServiceImpl.java
@@ -188,52 +188,48 @@
            throw new CoolException("任务档不存在!!");
        }
        log.info("任务执行参数回写:{}", JSON.toJSONString(params));
        if (params.getNotifyType().equals("task")) {
            //任务
            if (params.getMsgType().equals("task_complete") || params.getMsgType().equals("station_out_task_run")) {
                if (mast.getIoType() == 1 || mast.getIoType() == 11 || mast.getIoType() == 10 || mast.getIoType() == 53 || mast.getIoType() == 54 || mast.getIoType() == 57) {
                    mast.setWrkSts(4L);
                } else if (mast.getIoType() == 101 || mast.getIoType() == 110 || mast.getIoType() == 103 || mast.getIoType() == 104 || mast.getIoType() == 107) {
                    //TODO 恢复正常后,这里代码要注释掉
                    if (mast.getIoType() == 103  || mast.getIoType() == 107) {
                        List<WrkDetl> wrkDetls103 = wrkDetlService
                                .selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", mast.getWrkNo()));
                        if (wrkDetls103.isEmpty()) {
                            throw new CoolException("拣料出库 ===>> 更新订单完成数量失败; [workNo=" + mast.getWrkNo());
                        }
                        for (WrkDetl wrkDetl : wrkDetls103) {
                            // 更新订单完成数量
                            OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
        if (params.getMsgType().equals("task_complete") || params.getMsgType().equals("station_out_task_run_complete") || params.getMsgType().equals("station_out_task_run")) {
            if (mast.getIoType() == 1 || mast.getIoType() == 11 || mast.getIoType() == 10 || mast.getIoType() == 53 || mast.getIoType() == 54 || mast.getIoType() == 57) {
                mast.setWrkSts(4L);
            } else if (mast.getIoType() == 101 || mast.getIoType() == 110 || mast.getIoType() == 103 || mast.getIoType() == 104 || mast.getIoType() == 107) {
                //TODO 恢复正常后,这里代码要注释掉
                if (mast.getIoType() == 103  || mast.getIoType() == 107) {
                    List<WrkDetl> wrkDetls103 = wrkDetlService
                            .selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", mast.getWrkNo()));
                    if (wrkDetls103.isEmpty()) {
                        throw new CoolException("拣料出库 ===>> 更新订单完成数量失败; [workNo=" + mast.getWrkNo());
                    }
                    for (WrkDetl wrkDetl : wrkDetls103) {
                        // 更新订单完成数量
                        OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
                                wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
                                wrkDetl.getStandby2(), wrkDetl.getStandby3(),
                                wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3());
                        if (orderDetlPakout == null) {
                            orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
                                    wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
                                    wrkDetl.getStandby2(), wrkDetl.getStandby3(),
                                    wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3());
                            if (orderDetlPakout == null) {
                                orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
                                        wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
                                        wrkDetl.getStandby2(), wrkDetl.getStandby3(),
                                        wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3());
                            }
                            if (!Cools.isEmpty(orderDetlPakout)) {
                                if (!orderDetlPakoutService.increaseQtyByOrderNo(wrkDetl.getOrderNo(),
                                        wrkDetl.getMatnr(),
                                        orderDetlPakout.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
                                        wrkDetl.getStandby2(), wrkDetl.getStandby3(),
                                        wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(),
                                        wrkDetl.getAnfme())) {
                                    throw new CoolException("全板出库 ===>> 更新订单完成数量失败; [workNo=" + mast.getWrkNo());
                                }
                        }
                        if (!Cools.isEmpty(orderDetlPakout)) {
                            if (!orderDetlPakoutService.increaseQtyByOrderNo(wrkDetl.getOrderNo(),
                                    wrkDetl.getMatnr(),
                                    orderDetlPakout.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
                                    wrkDetl.getStandby2(), wrkDetl.getStandby3(),
                                    wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(),
                                    wrkDetl.getAnfme())) {
                                throw new CoolException("全板出库 ===>> 更新订单完成数量失败; [workNo=" + mast.getWrkNo());
                            }
                        }
                    }
                    mast.setWrkSts(14L);
                }
                if (!wrkMastService.updateById(mast)) {
                    throw new CoolException("任务状态修改失败!!");
                }
            } else if (params.getMsgType().equals("task_cancel")) {
                //todo 取消任务
                mast.setWrkSts(14L);
            }
            if (!wrkMastService.updateById(mast)) {
                throw new CoolException("任务状态修改失败!!");
            }
        } else if (params.getMsgType().equals("task_cancel")) {
            //todo 取消任务
        }
        return R.ok();
    }
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -13,6 +13,7 @@
import com.zy.asrs.service.WrkMastService;
import com.zy.common.model.DetlDto;
import com.zy.common.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -106,6 +107,17 @@
        return R.ok();
    }
    @PostMapping("/queryTask")
    @ApiOperation("任务执行信息查询")
    public synchronized R queryTaskInfo(@RequestBody TvQueryParam param) {
        if (Objects.isNull(param)) {
            return R.error("参数不能为空!!");
        }
        return  openService.queryTaskInfo(param);
    }
    @PostMapping("/order/matSync/default/v1")
//    @AppAuth(memo = "商品信息同步接口")
    public synchronized R syncMatInfo(@RequestHeader(required = false) String appkey,
src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -16,6 +16,8 @@
    // 托盘条码
    private String barcode;
    private String boxType1;
    //站点
    private String station;
@@ -46,6 +48,7 @@
        private String standby1 = "";
        private String standby2 = "";
        private String standby3 = "";
        private String suppCode = "";
        private String boxType1 = "1";
        private String boxType2 = "1";
src/main/java/com/zy/asrs/entity/param/TvQueryParam.java
New file
@@ -0,0 +1,22 @@
package com.zy.asrs.entity.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "TvQueryParam", description = "TV查询参数")
public class TvQueryParam implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("任务号")
    private String taskNo;
    @ApiModelProperty("任务类型")
    private String taskType;
}
src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java
@@ -16,7 +16,7 @@
    int deleteItem(@Param("wrkNo")Integer wrkNo, @Param("matnr")String matnr, @Param("batch")String batch);
    int updateAnfme(@Param("anfme")Double anfme, @Param("wrkNo")Integer wrkNo, @Param("matnr")String matnr, @Param("batch")String batch);
    int updateAnfme(@Param("anfme")Double anfme, @Param("wrkNo")Integer wrkNo, @Param("matnr")String matnr, @Param("suppCode")String suppCode);
    List<WrkDetl> selectAndLogByOrderNo(String orderNo);
src/main/java/com/zy/asrs/service/OpenService.java
@@ -1,5 +1,6 @@
package com.zy.asrs.service;
import com.core.common.R;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.OpenOrderCompeteResult;
import com.zy.asrs.entity.result.StockVo;
@@ -45,4 +46,11 @@
    void syncMat(MatSyncParam param);
    void adjustmentOrderCreate(OpenAdjustmentOrderParam param);
    /**
     * 查询执行任务信息
     * @param param
     * @return
     */
    R queryTaskInfo(TvQueryParam param);
}
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -36,6 +36,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -915,9 +916,9 @@
                        // todo 盘点记录、保存调整记录
                        // 修改明细
                        if (!wrkDetlService.updateAnfme(wrkDetl1.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(),
                                wrkDetl.getBatch())) {
                                wrkDetl.getSuppCode())) {
                            throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                                    + wrkDetl.getBatch() + "批号修改数量失败");
                                    + wrkDetl.getSuppCode() + "批号修改数量失败");
                        }
                    }
                    iterator.remove();
@@ -929,7 +930,7 @@
        // 删除明细
        for (WrkDetl wrkDetl : wrkDetls) {
            // todo 盘点记录、保存调整记录
            if (!wrkDetlService.updateAnfme(-1.0D, wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) {
            if (!wrkDetlService.updateAnfme(-1.0D, wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getSuppCode())) {
                throw new CoolException("删除" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                        + wrkDetl.getBatch() + "批号任务明细失败");
            }
@@ -1423,7 +1424,7 @@
            generateCacheOutTask(station, locCache, userId);
            /**生成立库出库任务*/
           // generateCRNOutTask(station, locCache, userId);
            generateCRNOutTask(station, locCache, userId);
            return R.ok();
        }
@@ -1651,147 +1652,194 @@
        if (Objects.isNull(param.getBarcode())) {
            throw new CoolException("托盘码不能为空!!");
        }
        if (Objects.isNull(param.getCombMats()) || param.getCombMats().isEmpty()) {
            throw new CoolException("组托明细不能为空!!");
        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
                .eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
                        .eq("wrk_sts", 14)
                        .eq("io_type", 104)
                .eq("barcode", param.getBarcode()));
        if (Objects.isNull(wrkMast)) {
            throw new CoolException("任务档信息不存在!!");
        }
        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()));
        if (countWrk > 0 || countLoc > 0) {
            WrkMast wrkDetl = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
            if (!wrkDetl.getIoType().equals(TaskIOType.MERGE_OUT.type)) {
                throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode());
            }
        }
        int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
        if (countwait > 0) {
            throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode());
        }
        // 生成入库通知档
        List<DetlDto> detlDtos = new ArrayList<>();
        param.getCombMats().forEach(elem -> {
            DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
                    elem.getStandby2(), elem.getStandby3(),
                    elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), elem.getThreeCode());
            if (DetlDto.has(detlDtos, detlDto)) {
                DetlDto one = DetlDto.findDto(detlDtos, detlDto);
                assert one != null;
                one.setAnfme(one.getAnfme() + detlDto.getAnfme());
            } else {
                detlDtos.add(detlDto);
            }
        });
        BasContainer container = basContainerService
                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
        if (Objects.isNull(container)) {
            throw new CoolException("数据错误:容器码不存在!!");
        }
        if (container.getMixMax() < detlDtos.size()) {
            throw new CoolException("超出容器最大混装数量,当前容器最大数量为:" + container.getMixMax() + "!!");
        }
        List<Mat> tempMats = new ArrayList<>();
        for (DetlDto detlDto : detlDtos) {
            Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", detlDto.getMatnr())
                    .eq("supp_code", detlDto.getStandby1()));
            tempMats.add(mat);
        }
        Set<Long> tagIds = tempMats.stream().map(Mat::getTagId).collect(Collectors.toSet());
        if (tagIds.size() > 1) {
            throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
        }
        // 还可以放入多少种物料
        Double suplus = container.getMixMax();
        Date now = new Date();
        for (DetlDto detlDto : detlDtos) {
            Mat mat = matService.selectByMatnr(detlDto.getMatnr());
            if (Cools.isEmpty(mat)) {
                throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
            }
            // 最多可放数量
            Double singleMax = mat.getUpQty() * suplus;
            if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
                throw new CoolException("物料:" + detlDto.getMatnr() + "单次组托上限为:" + mat.getUpQty() + ",当前总量超出托盘装载上限!!");
            }
            BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
            // 当前物料需要占用料箱格数
            Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
            suplus = suplus - curr;
            if (suplus < 0) {
                throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!");
            }
        for (CombParam.CombMat combMat : param.getCombMats()) {
            BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
                    .eq("zpallet", param.getCarBarcode())
                    .eq("three_code", detlDto.getThreeCode()));
                    .eq("three_code", combMat.getThreeCode()));
            if (Objects.isNull(stationDetl)) {
                throw new CoolException("明细内容不存在!!");
            }
            WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>()
                    .eq("matnr", stationDetl.getMatnr())
                    .eq("wrk_no", wrkMast.getWrkNo())
                    .eq("suppCode", combMat.getSuppCode()));
            Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0;
            if (detlDto.getAnfme().compareTo(v) > 0) {
                throw new CoolException("组托上限为:" + stationDetl.getAnfme() + ", 已组托:" + stationDetl.getWorkQty() + ", 还可组托:" + v);
            }
            if (Objects.isNull(wrkDetl)) {
                //TODO 新插入
                Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", stationDetl.getMatnr())
                    .eq("supp_code", combMat.getSuppCode()));
                if (Objects.isNull(mat)) {
                    throw new CoolException("物料基础信息已不存在!!");
                }
                WrkDetl detl = new WrkDetl();
                BeanUtils.copyProperties(stationDetl, detl);
                detl.setAnfme(combMat.getAnfme());
                detl.setBarcode(wrkMast.getBarcode());
                detl.setBoxType1(combMat.getBoxType1());
                detl.setStandby1(combMat.getSuppCode());
                detl.setWrkNo(wrkMast.getWrkNo());
            WaitPakin waitPakin = new WaitPakin();
            BeanUtils.copyProperties(mat, waitPakin);
            waitPakin.setBatch(detlDto.getBatch());
            waitPakin.setType(param.getType());
            waitPakin.setZpallet(param.getBarcode());
            // 设置组托类型
            waitPakin.setType(param.getType());
            waitPakin.setIoStatus("N");
            waitPakin.setAnfme(detlDto.getAnfme());
            waitPakin.setThreeCode(detlDto.getThreeCode());
            waitPakin.setStatus("Y");
            waitPakin.setSuppCode(detlDto.getStandby1());
            waitPakin.setStandby1(detlDto.getStandby1());
            waitPakin.setStandby2(detlDto.getStandby2());
            waitPakin.setStandby3(detlDto.getStandby3());
            waitPakin.setBoxType1(detlDto.getBoxType1());
            waitPakin.setBoxType2(detlDto.getBoxType2());
            waitPakin.setBoxType3(detlDto.getBoxType3());
            waitPakin.setAppeUser(userId);
            waitPakin.setAppeTime(now);
            waitPakin.setModiUser(userId);
            waitPakin.setModiTime(now);
            if (!waitPakinService.insert(waitPakin)) {
                throw new CoolException("保存入库通知档失败");
            }
            Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0;
            stationDetl.setWorkQty(v1);
            if (!basStationDetlService.updateById(stationDetl)) {
                throw new CoolException("站点明细修改失败");
            }
            if (v1.compareTo(stationDetl.getAnfme()) >= 0) {
                if (!basStationDetlService.deleteById(stationDetl)) {
                    throw new CoolException("原始数据移除失败!");
                if (!wrkDetlService.insert(detl)) {
                    throw new CoolException("任务明细保存失败!!");
                }
            } else {
                double val = Math.round((combMat.getAnfme() + wrkDetl.getAnfme()) * 10000) / 10000.0;
                if (!wrkDetlService.updateAnfme(val, wrkMast.getWrkNo(), wrkDetl.getMatnr(),
                        wrkDetl.getSuppCode())) {
                    throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                            + wrkDetl.getBatch() + "批号修改数量失败");
                }
            }
            List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
                    .eq("dev_no", stationDetl.getDevNo()));
            if (Objects.isNull(stas) || stas.isEmpty()) {
                BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo()));
                if (Objects.isNull(station)) {
                    throw new CoolException("数据错误,站点不存在!!");
                }
                station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
                station.setBarcode("");
                if (!basStationService.updateById(station)) {
                    throw new CoolException("站点状态更新失败!!");
                }
            }
        }
//        // 判断是否有相同条码的数据
//        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
//                .eq("io_status", "N")) > 0) {
//            throw new CoolException(param.getBarcode() + "数据正在进行入库");
//        }
//
//        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
//        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()));
//        if (countWrk > 0 || countLoc > 0) {
//            WrkMast wrkDetl = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
//            if (!wrkDetl.getIoType().equals(TaskIOType.MERGE_OUT.type)) {
//                throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode());
//            }
//        }
//        int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
//        if (countwait > 0) {
//            throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode());
//        }
//
//        // 生成入库通知档
//        List<DetlDto> detlDtos = new ArrayList<>();
//        param.getCombMats().forEach(elem -> {
//            DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
//                    elem.getStandby2(), elem.getStandby3(),
//                    elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), elem.getThreeCode());
//            if (DetlDto.has(detlDtos, detlDto)) {
//                DetlDto one = DetlDto.findDto(detlDtos, detlDto);
//                assert one != null;
//                one.setAnfme(one.getAnfme() + detlDto.getAnfme());
//            } else {
//                detlDtos.add(detlDto);
//            }
//        });
//        BasContainer container = basContainerService
//                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
//        if (Objects.isNull(container)) {
//            throw new CoolException("数据错误:容器码不存在!!");
//        }
//        if (container.getMixMax() < detlDtos.size()) {
//            throw new CoolException("超出容器最大混装数量,当前容器最大数量为:" + container.getMixMax() + "!!");
//        }
//        List<Mat> tempMats = new ArrayList<>();
//        for (DetlDto detlDto : detlDtos) {
//            Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", detlDto.getMatnr())
//                    .eq("supp_code", detlDto.getStandby1()));
//            tempMats.add(mat);
//        }
//        Set<Long> tagIds = tempMats.stream().map(Mat::getTagId).collect(Collectors.toSet());
//        if (tagIds.size() > 1) {
//            throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
//        }
//        // 还可以放入多少种物料
//        Double suplus = container.getMixMax();
//        Date now = new Date();
//        for (DetlDto detlDto : detlDtos) {
//            Mat mat = matService.selectByMatnr(detlDto.getMatnr());
//            if (Cools.isEmpty(mat)) {
//                throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
//            }
//            // 最多可放数量
//            Double singleMax = mat.getUpQty() * suplus;
//            if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
//                throw new CoolException("物料:" + detlDto.getMatnr() + "单次组托上限为:" + mat.getUpQty() + ",当前总量超出托盘装载上限!!");
//            }
//            BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
//            // 当前物料需要占用料箱格数
//            Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
//            suplus = suplus - curr;
//            if (suplus < 0) {
//                throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!");
//            }
//
//            BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
//                    .eq("zpallet", param.getCarBarcode())
//                    .eq("three_code", detlDto.getThreeCode()));
//            if (Objects.isNull(stationDetl)) {
//                throw new CoolException("明细内容不存在!!");
//            }
//
//            Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0;
//            if (detlDto.getAnfme().compareTo(v) > 0) {
//                throw new CoolException("组托上限为:" + stationDetl.getAnfme() + ", 已组托:" + stationDetl.getWorkQty() + ", 还可组托:" + v);
//            }
//
//            WaitPakin waitPakin = new WaitPakin();
//            BeanUtils.copyProperties(mat, waitPakin);
//            waitPakin.setBatch(detlDto.getBatch());
//            waitPakin.setType(param.getType());
//            waitPakin.setZpallet(param.getBarcode());
//            // 设置组托类型
//            waitPakin.setType(param.getType());
//            waitPakin.setIoStatus("N");
//            waitPakin.setAnfme(detlDto.getAnfme());
//            waitPakin.setThreeCode(detlDto.getThreeCode());
//            waitPakin.setStatus("Y");
//            waitPakin.setSuppCode(detlDto.getStandby1());
//            waitPakin.setStandby1(detlDto.getStandby1());
//            waitPakin.setStandby2(detlDto.getStandby2());
//            waitPakin.setStandby3(detlDto.getStandby3());
//            waitPakin.setBoxType1(detlDto.getBoxType1());
//            waitPakin.setBoxType2(detlDto.getBoxType2());
//            waitPakin.setBoxType3(detlDto.getBoxType3());
//            waitPakin.setAppeUser(userId);
//            waitPakin.setAppeTime(now);
//            waitPakin.setModiUser(userId);
//            waitPakin.setModiTime(now);
//            if (!waitPakinService.insert(waitPakin)) {
//                throw new CoolException("保存入库通知档失败");
//            }
//
//            Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0;
//            stationDetl.setWorkQty(v1);
//
//            if (!basStationDetlService.updateById(stationDetl)) {
//                throw new CoolException("站点明细修改失败");
//            }
//
//            if (v1.compareTo(stationDetl.getAnfme()) >= 0) {
//                if (!basStationDetlService.deleteById(stationDetl)) {
//                    throw new CoolException("原始数据移除失败!");
//                }
//            }
//
//            List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
//                    .eq("dev_no", stationDetl.getDevNo()));
//            if (Objects.isNull(stas) || stas.isEmpty()) {
//                BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo()));
//                if (Objects.isNull(station)) {
//                    throw new CoolException("数据错误,站点不存在!!");
//                }
//                station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
//                station.setBarcode("");
//                if (!basStationService.updateById(station)) {
//                    throw new CoolException("站点状态更新失败!!");
//                }
//            }
//        }
    }
    /**
@@ -2036,6 +2084,20 @@
        if (!Objects.isNull(mast)) {
            if (mast.getIoType().equals(TaskIOType.MERGE_OUT.type) || mast.getIoType().equals(TaskIOType.PICK_OUT.type) || mast.getIoType().equals(TaskIOType.CHECK_OUT.type)) {
                int ioType = mast.getIoType() - 50;
                List<WrkDetl> wrkDetls103 = wrkDetlService
                        .selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
                if (wrkDetls103.isEmpty()) {
                    ioType = 10;
                }
                List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo()));
                if (!Objects.isNull(locDetls) && !locDetls.isEmpty()) {
                    Double sum = wrkDetls103.stream().mapToDouble(WrkDetl::getAnfme).sum();
                    Double summed = locDetls.stream().mapToDouble(LocDetl::getAnfme).sum();
                    if (summed.compareTo(sum) <= 0) {
                        ioType = 10;
                    }
                }
                mast.setIoType(ioType);
                mast.setWrkSts(2L);
                mast.setSourceStaNo(mast.getSourceStaNo());
@@ -2333,9 +2395,9 @@
            // 生成工作号
            int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
            if (Cools.isEmpty(wrkMast1)) {
                Integer outSta = devp.getDevNo();
//                Integer outSta = devp.getDevNo();
                // 获取路径
                StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
//                StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
                // 生成工作档
                WrkMast wrkMast = new WrkMast();
@@ -2345,8 +2407,8 @@
                wrkMast.setIoType(ioType); // 入出库类型
                wrkMast.setIoPri(13D); // 优先级:13
                wrkMast.setCrnNo(locMast.getCrnNo());
                wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站
                wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站
//                wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站
//                wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站
                wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位
                //小松项目,缓存出库AGV站点,用于清空缓存区库存
                wrkMast.setPauseMk(station.getDevNo());
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -24,9 +24,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by vincent on 2022/4/9
@@ -57,6 +55,10 @@
    private CheckOrderDetlService checkOrderDetlService;
    @Autowired
    private CheckOrderService checkOrderService;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Override
    @Transactional
@@ -655,7 +657,29 @@
                throw new CoolException("保存调整单明细失败");
            }
        }
    }
    /**
     * 查询任务档信息
     * @param param
     * @return
     */
    @Override
    public R queryTaskInfo(TvQueryParam param) {
        if (param.getTaskNo().equals("agv")) {
            return R.ok();
        } else {
            WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getTaskNo()));
            if (Objects.isNull(wrkMast)) {
                throw new CoolException("任务信息不存在!!");
            }
            List<WrkDetl> detls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
            Map<String, Object> wrkast =  new HashMap<>();
            wrkast.put("wrkDetls", detls);
            return R.ok().add(wrkast);
        }
    }
}
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -418,7 +418,8 @@
        String orderNo = taskDto.getLocDtos().get(0).getOrderNo();
//        OrderPakout orderPakout = orderPakOutService.selectByNo(orderNo);
        int ioType = (taskDto.isAll() ? 101 : 103);
//        int ioType = (taskDto.isAll() ? 101 : 103);
        int ioType = 103;
        if (ioType == 101) {
            boolean DiffQty = taskDto.getLocDtos().stream().allMatch(locDto ->
                    locDetlService.selectOne(new EntityWrapper<LocDetl>()
src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java
@@ -57,11 +57,11 @@
    }
    @Override
    public boolean updateAnfme(Double anfme, Integer wrkNo, String matnr, String batch) {
    public boolean updateAnfme(Double anfme, Integer wrkNo, String matnr, String suppCode) {
        if (anfme <= 0) {
            return this.baseMapper.deleteItem(wrkNo, matnr, batch) > 0;
            return this.baseMapper.deleteItem(wrkNo, matnr, suppCode) > 0;
        } else {
            return baseMapper.updateAnfme(anfme, wrkNo, matnr, batch) > 0;
            return baseMapper.updateAnfme(anfme, wrkNo, matnr, suppCode) > 0;
        }
    }
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -406,7 +406,6 @@
                        } catch (Exception ignore) {
                        }
                    }
                    // 修改库位状态 Q ====>> F
                    if (locMast.getLocSts().equals("Q")) {
@@ -630,7 +629,7 @@
                        }
                    }
                    break;
//                case 103:
                case 103:
//                    List<WrkDetl> wrkDetls103 = wrkDetlService
//                            .selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
//                    if (wrkDetls103.isEmpty()) {
@@ -639,7 +638,7 @@
//                        return FAIL.setMsg("全板出库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo="
//                                + wrkMast.getSourceLocNo() + "]");
//                    }
//
//                    for (WrkDetl wrkDetl : wrkDetls103) {
//                        // 更新订单完成数量
//                        OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
@@ -669,7 +668,7 @@
//                            log.error(ignore.getMessage());
//                        }
//                    }
//                    break;
                    break;
                // 并板途中捡料
                case 108:
                    // 根据工作号,查询工作明细档
@@ -923,7 +922,9 @@
                    station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
                }
                station.setBarcode("");
                basStationService.updateById(station);
               if (!basStationService.updateById(station)) {
                   basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
               }
            }
        }
src/main/java/com/zy/common/constant/MesConstant.java
@@ -13,9 +13,9 @@
    public static final String AGV_URL = "http://192.168.238.202/rcs/rtas/api/robot/controller";
    //WCS系统接口地址
//    public static final String WCS_URL = "http://192.168.238.32:9090/wcs";
    public static final String WCS_URL = "http://192.168.238.32:9090/wcs";
    public static final String WCS_URL = "http://192.168.238.31:9090/wcs";
//    public static final String WCS_URL = "http://192.168.238.31:9090/wcs";
    //上架派工单反馈
    public static final String IN_DISPATCH_RESULT = "getInDispatchResult";
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
@@ -90,23 +90,23 @@
                logger.info("++++++++ 许可证加载标记,搜索修改 ++++++++");
                licenseTimer.setSystemSupport(true);
//                licenseTimer.setLicenseDays(9999);
//                return true;
                licenseTimer.setLicenseDays(9999);
                return true;
                licenseTimer.setSystemSupport(install!=null);
                if (install != null) {
                    Date start = new Date();
                    Date end = install.getNotAfter();
                    Long starTime = start.getTime();
                    Long endTime = end.getTime();
                    Long num = endTime - starTime;//时间戳相差的毫秒数
                    int day = (int) (num / 24 / 60 / 60 / 1000);
                    licenseTimer.setLicenseDays(day);
                }
//                licenseTimer.setSystemSupport(install!=null);
//
//                if (install != null) {
//                    Date start = new Date();
//                    Date end = install.getNotAfter();
//                    Long starTime = start.getTime();
//                    Long endTime = end.getTime();
//                    Long num = endTime - starTime;//时间戳相差的毫秒数
//                    int day = (int) (num / 24 / 60 / 60 / 1000);
//                    licenseTimer.setLicenseDays(day);
//                }
                return install != null;
//                return install != null;
            } catch (Exception e) {
                return false;
            }
src/main/resources/application-dev.yml
@@ -12,7 +12,7 @@
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    username: sa
    password: sa@123
    url: jdbc:sqlserver://192.168.238.31:1433;databasename=jsxsasrs
    url: jdbc:sqlserver://192.168.238.32:1433;databasename=jsxsasrs
#    url: jdbc:sqlserver://192.168.4.34:1433;databasename=jsxsasrs
  mvc:
    static-path-pattern: /**
@@ -48,7 +48,7 @@
#License相关配置
license:
  subject: jsxsasrs
  subject: jsxswms
  publicAlias: publicCert
  storePass: public_zhongyang_123456789
  licensePath: license.lic
@@ -114,8 +114,8 @@
#KOPEN小松平台
kopen:
#  url: webservice.kopen.com.cn
  url: 10.143.23.26
  url: webservice.kopen.com.cn
#  url: 10.143.23.26
  port: 1482
  prefix: /kc-api/api/wms
src/main/resources/license.lic
Binary files differ
src/main/resources/mapper/OrderDetlPakinMapper.xml
@@ -57,14 +57,14 @@
    </resultMap>
    <sql id="standbyAll">
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
<!--        <choose>-->
<!--            <when test="batch != null and batch != ''">-->
<!--                and batch = #{batch}-->
<!--            </when>-->
<!--            <otherwise>-->
<!--                and (batch IS NULL OR batch = '')-->
<!--            </otherwise>-->
<!--        </choose>-->
<!--        <choose>-->
<!--            <when test="brand != null and brand != ''">-->
<!--                and brand = #{brand}-->
@@ -77,9 +77,6 @@
            <when test="standby1 != null and standby1 != ''">
                and standby1 = #{standby1}
            </when>
            <otherwise>
                and (standby1 IS NULL OR standby1 = '')
            </otherwise>
        </choose>
<!--        <choose>-->
<!--            <when test="standby2 != null and standby2 != ''">-->
src/main/resources/mapper/WrkDetlMapper.xml
@@ -55,12 +55,9 @@
    <sql id="batchSeq">
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            <when test="suppCode != null and suppCode != ''">
                and supp_code = #{suppCode}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </sql>