自动化立体仓库 - WMS系统
4c3979cd0850d3a4577aca358fdc7f8767a50447..c696444b826009c82180f504fb0ed8d49a284565
10 小时以前 skyouc
no message
c69644 对比 | 目录
11 小时以前 zhou zhou
#
a6884b 对比 | 目录
11 小时以前 skyouc
no message
c8559a 对比 | 目录
11 小时以前 skyouc
no message
3bc2db 对比 | 目录
11 小时以前 skyouc
no message
2a2f70 对比 | 目录
12 小时以前 skyouc
no message
dcdffc 对比 | 目录
12 小时以前 skyouc
Merge branch 'jsxswms' of http://47.97.1.152:5880/r/zy-asrs into jsxswms
1367d1 对比 | 目录
12 小时以前 skyouc
no message
6e4800 对比 | 目录
12 小时以前 zhou zhou
Merge remote-tracking branch 'origin/jsxswms' into jsxswms
94e3cc 对比 | 目录
12 小时以前 zhou zhou
#
1b3cb1 对比 | 目录
12 小时以前 skyouc
no message
d512ae 对比 | 目录
12 小时以前 skyouc
1
40a259 对比 | 目录
13 小时以前 zhou zhou
#
e88ffe 对比 | 目录
13 小时以前 zhou zhou
#
56e254 对比 | 目录
13 小时以前 skyouc
no message
9591d4 对比 | 目录
14 小时以前 skyouc
no message
30de82 对比 | 目录
14 小时以前 skyouc
Merge branch 'jsxswms' of http://47.97.1.152:5880/r/zy-asrs into jsxswms
ff62f0 对比 | 目录
14 小时以前 skyouc
1
20de22 对比 | 目录
15 小时以前 zhou zhou
#
679337 对比 | 目录
16 小时以前 skyouc
bug修复 组托上架功能优化
6ea39c 对比 | 目录
18 小时以前 zhou zhou
Merge remote-tracking branch 'origin/jsxswms' into jsxswms
92ff7e 对比 | 目录
18 小时以前 zhou zhou
#
e5a6b5 对比 | 目录
18 小时以前 skyouc
no message
dc8258 对比 | 目录
19 小时以前 zhou zhou
#
06bdab 对比 | 目录
1个文件已添加
20个文件已修改
1028 ■■■■■ 已修改文件
src/main/java/com/zy/api/controller/AgvScheduleController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/LocDetlController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/LocMastController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/TaskDetlLogController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/TaskLogController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasStationDetl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/LocMast.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/TaskDetl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/WrkDetl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/CombParam.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 709 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/orderPakin/order.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/taskLog/taskLog.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/waitPakin/waitPakin.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/basStation/basStationDetl.html 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/taskLog/taskDetlLog.html 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/taskLog/taskLog.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/controller/AgvScheduleController.java
@@ -46,8 +46,4 @@
        }
        return agvScheduleService.callback(params);
    }
}
src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -206,7 +206,7 @@
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                if (entry.getKey().equals("locNo")) {
                if (entry.getKey().equals("locNo") || entry.getKey().equals("loc_no")) {
                    wrapper.eq("loc_no", String.valueOf(entry.getValue()));
                } else {
                    wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
src/main/java/com/zy/asrs/controller/LocMastController.java
@@ -13,6 +13,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.LocMastInitParam;
import com.zy.asrs.enums.LocAreaType;
import com.zy.asrs.mapper.LocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.common.entity.Parameter;
@@ -46,6 +47,9 @@
    private WrkMastLogService wrkMastLogService;
    @Resource
    private WrkDetlLogService wrkDetlLogService;
    @Autowired
    private BasAreasService basAreasService;
    @RequestMapping(value = "/locMast/init/pwd")
    public R locMastInitPwd(@RequestParam(required = false) String pwd) {
@@ -277,6 +281,8 @@
//    @Transactional
    public R init(LocMastInitParam param) {
        try {
            BasAreas basAreas = basAreasService
                    .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
            List<LocMast> list = new ArrayList<>();
            BasWhsType basWhsType = basWhsTypeService.selectByIdentifying(param.getIdentifying());
            if (Cools.isEmpty(basWhsType)) {
@@ -322,6 +328,8 @@
                        locMast.setModiUser(getUserId());
                        locMast.setModiTime(now);
                        locMast.setWhsType(basWhsType.getId());
                        locMast.setAreaId(basAreas.getId());
                        locMast.setAreaName(basAreas.getName());
                        list.add(locMast);
                    }
                }
src/main/java/com/zy/asrs/controller/TaskDetlLogController.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.entity.TaskDetlLog;
import com.zy.asrs.entity.WrkDetlLog;
import com.zy.asrs.service.TaskDetlLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
@@ -24,6 +25,23 @@
    @Autowired
    private TaskDetlLogService taskDetlLogService;
    @RequestMapping(value = "/taskDetlLogByMast/list/auth")
    @ManagerAuth
    public R list1(@RequestParam(defaultValue = "1") Integer curr,
                   @RequestParam(defaultValue = "10") Integer limit,
                   @RequestParam Integer wrk_no,
                   @RequestParam String id) {
        EntityWrapper<TaskDetlLog> wrapper = new EntityWrapper<>();
        if (!Cools.isEmpty(wrk_no) && wrk_no != 0) {
            wrapper.eq("wrk_no", wrk_no);
        }
        if (!Cools.isEmpty(id)) {
            wrapper.eq("log_id",id);
        }
        return R.ok(taskDetlLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/taskDetlLog/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
src/main/java/com/zy/asrs/controller/TaskLogController.java
@@ -43,6 +43,7 @@
        convert(param, wrapper);
        allLike(TaskLog.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        wrapper.orderBy("appe_time desc");
        return R.ok(taskLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/asrs/entity/BasStationDetl.java
@@ -1,9 +1,11 @@
package com.zy.asrs.entity;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.SpringUtils;
import com.zy.asrs.service.MatService;
import com.zy.system.service.UserService;
import com.zy.system.entity.User;
import java.text.SimpleDateFormat;
@@ -30,7 +32,7 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value= "")
    @TableId(value = "id", type = IdType.INPUT)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
@@ -45,6 +47,9 @@
     */
    @ApiModelProperty(value= "数量")
    private Double anfme;
    @ApiModelProperty("执行中数量")
    private Double workQty;
    /**
     * 托盘条码
@@ -441,6 +446,15 @@
        }
    }
    public String getTag$() {
        MatService service = SpringUtils.getBean(MatService.class);
        Mat order = service.selectOne(new EntityWrapper<Mat>().eq("matnr", this.matnr));
        if (Cools.isEmpty(order)){
            return null;
        }
        return order.getTagId$();
    }
    public String getDanger$(){
        if (null == this.danger){ return null; }
        switch (this.danger){
src/main/java/com/zy/asrs/entity/LocMast.java
@@ -195,6 +195,12 @@
    @TableField("frozen_memo")
    private String frozenMemo;
    @TableField("area_id")
    private Long areaId;
    @TableField("area_name")
    private String areaName;
    public String getWhsType$(){
        BasWhsTypeService service = SpringUtils.getBean(BasWhsTypeService.class);
src/main/java/com/zy/asrs/entity/TaskDetl.java
@@ -2,10 +2,12 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableField;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.zy.asrs.service.MatService;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import com.core.common.SpringUtils;
@@ -477,6 +479,15 @@
        return null;
    }
    public String getTag$() {
        MatService service = SpringUtils.getBean(MatService.class);
        Mat order = service.selectOne(new EntityWrapper<Mat>().eq("matnr", this.matnr));
        if (Cools.isEmpty(order)){
            return null;
        }
        return order.getTagId$();
    }
    public String getModiTime$(){
        if (Cools.isEmpty(this.modiTime)){
            return "";
src/main/java/com/zy/asrs/entity/WrkDetl.java
@@ -2,8 +2,10 @@
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.MatService;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
@@ -371,6 +373,16 @@
        }
    }
    public String getTag$() {
        MatService service = SpringUtils.getBean(MatService.class);
        Mat order = service.selectOne(new EntityWrapper<Mat>().eq("matnr", this.matnr));
        if (Cools.isEmpty(order)){
            return null;
        }
        return order.getTagId$();
    }
    public String getModiUser$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.modiUser);
src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -24,6 +24,8 @@
    //唯一编码
    private String bsCode;
    private String carBarcode;
    private String type;
    private List<CombMat> combMats;
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -136,7 +136,7 @@
    @Override
    @Transactional
    public R WarehouseOutPickMergeV1(WarehouseOutPickMergeParam param, Long hostId, Long userId) {
        //判断库位状态
        // 判断库位状态
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo()));
        if (Cools.isEmpty(locMast)) {
            return R.error("该库位不存在");
@@ -205,7 +205,10 @@
                if (Cools.isEmpty(order)) {
                    continue;
                }
                OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3());
                OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(),
                        orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(),
                        orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(),
                        orderDetl.getBoxType3());
                if (Cools.isEmpty(orderDetlPakin)) {
                    continue;
                }
@@ -213,8 +216,11 @@
                    throw new CoolException("并板数量出错,订单剩余出库数量小于已出库数量与将并板数量之和!!!");
                }
                // 修改订单明细作业数量
                if (!orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), orderDetlPakin.getMatnr(), orderDetlPakin.getBatch(), orderDetlPakin.getBrand(),
                        orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(), orderDetl.getAnfme())) {
                if (!orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), orderDetlPakin.getMatnr(),
                        orderDetlPakin.getBatch(), orderDetlPakin.getBrand(),
                        orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(),
                        orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(),
                        orderDetl.getAnfme())) {
                    throw new CoolException("修改单据明细工作数量失败");
                }
@@ -250,17 +256,17 @@
            return R.error("站点不存在");
        }
        OrderDetlPakin orderDetlPakin = null;
        //检验传参是否和订单明细匹配
        // 检验传参是否和订单明细匹配
        for (PickMatParam matParam : param.getList()) {
            orderDetlPakin = orderDetlPakinService.selectItem
                    (matParam.getOrderNo(), matParam.getMatnr(), matParam.getBatch(), matParam.getBrand(),
                            matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(),
                            matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3());
            orderDetlPakin = orderDetlPakinService.selectItem(matParam.getOrderNo(), matParam.getMatnr(),
                    matParam.getBatch(), matParam.getBrand(),
                    matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(),
                    matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3());
            if (orderDetlPakin == null) {
                return R.error("物料数据不存在");
            }
            //剩余可用数量
            // 剩余可用数量
            double count = orderDetlPakin.getAnfme() - orderDetlPakin.getWorkQty();
            if (matParam.getCount() != count) {
                return R.error("物料数据已过期");
@@ -326,14 +332,15 @@
                throw new CoolException("保存工作档明细失败");
            }
            //更新订单工作数量
            // 更新订单工作数量
            orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), matParam.getMatnr(),
                    matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(),
                    matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(),
                    matParam.getStandby3(),
                    matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3(), matParam.getUseCount());
            // 更新工作档状态
            orderPakinService.updateSettle(orderDetlPakin.getOrderId(), 2L, userId);
        }
        // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo()));
        if (locMast.getLocSts().equals("F")) {
            locMast.setLocSts("P");
@@ -352,7 +359,7 @@
    @Override
    @Transactional
    public R WarehouseOutV1(CombParam combParam, Long hostId, Long userId) {
        //判断库位状态
        // 判断库位状态
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", combParam.getLocNo()));
        if (Cools.isEmpty(locMast)) {
            return R.error("该库位不存在");
@@ -360,12 +367,11 @@
        if (!locMast.getLocSts().equals("P")) {
            return R.error("该库位状态为:" + locMast.getLocSts() + ",不满足并板途中拣选条件!!!");
        }
        //查询库存数据
        // 查询库存数据
        for (CombParam.CombMat combMat : combParam.getCombMats()) {
            List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("loc_no", combParam.getLocNo())
                    .eq("matnr", combMat.getMatnr())
            );
                    .eq("matnr", combMat.getMatnr()));
            if (locDetlList.isEmpty()) {
                return R.error("未查询到库存数据");
            }
@@ -384,8 +390,10 @@
                if (orderPakout.getSettle() == 1) {
                    OrderInAndOutUtil.updateOrder(false, orderPakout.getId(), 2L, 9527L);
                }
                OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(orderPakout.getId(), combMat.getMatnr(), combMat.getBatch(),
                        combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3());
                OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(orderPakout.getId(),
                        combMat.getMatnr(), combMat.getBatch(),
                        combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(),
                        combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3());
                if (Cools.isEmpty(orderDetlPakout)) {
                    continue;
                }
@@ -393,17 +401,22 @@
                    throw new CoolException("拣选数量出错,订单剩余出库数量小于已出库数量与将拣选数量之和!!!");
                }
                // 修改订单明细作业数量
                if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(),
                        combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(), combMat.getAnfme())) {
                if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), combMat.getMatnr(),
                        combMat.getBatch(), combMat.getBrand(),
                        combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(),
                        combMat.getBoxType2(), combMat.getBoxType3(), combMat.getAnfme())) {
                    throw new CoolException("修改单据明细工作数量失败");
                }
//                // 修改订单明细完成数量
//                if (!orderDetlPakoutService.increase(orderPakout.getId(),combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(),
//                        combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(),combMat.getAnfme())) {
//                    throw new CoolException("修改单据明细完成数量失败");
//                }
//                // 修改订单状态 作业中 ===>> 已完成
//                orderPakoutService.checkComplete(combMat.getOrderNo());
                // // 修改订单明细完成数量
                // if (!orderDetlPakoutService.increase(orderPakout.getId(),combMat.getMatnr(),
                // combMat.getBatch(), combMat.getBrand(),
                // combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(),
                // combMat.getBoxType1(), combMat.getBoxType2(),
                // combMat.getBoxType3(),combMat.getAnfme())) {
                // throw new CoolException("修改单据明细完成数量失败");
                // }
                // // 修改订单状态 作业中 ===>> 已完成
                // orderPakoutService.checkComplete(combMat.getOrderNo());
            }
            try {
                Date now = new Date();
@@ -512,8 +525,7 @@
            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                    .like("barcode", barcode)
                    .eq("wrk_sts", 199L)
                    .eq("io_type", 103)
            );
                    .eq("io_type", 103));
            wrkMastArrayList.addAll(wrkMasts);
            List<WrkMast> wrkMasts1 = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                    .like("barcode", barcode)
@@ -542,7 +554,7 @@
            orderIds.add(order.getId());
        }
        //搜索明细
        // 搜索明细
        Wrapper<OrderDetl> wrapper1 = new EntityWrapper<>();
        wrapper1.eq("status", 1);
        wrapper1.in("order_id", orderIds);
@@ -557,7 +569,7 @@
        ArrayList<PickMatParam> maps = new ArrayList<>();
        for (OrderDetl orderDetl : list) {
            //剩余可用数量
            // 剩余可用数量
            double count = orderDetl.getAnfme() - orderDetl.getWorkQty();
            if (count <= 0) {
                continue;
@@ -585,8 +597,7 @@
            throw new CoolException("请提取一个商品,或者刷新重新组托!");
        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode())
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
                .eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
@@ -594,9 +605,9 @@
        if (Objects.isNull(param.getBarcode())) {
            throw new CoolException("托盘码不能为空!!");
        }
//        if (param.getBarcode().length() != 8) {
//            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
//        }
        // if (param.getBarcode().length() != 8) {
        // throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
        // }
        if (Objects.isNull(param.getType())) {
            param.setType("0");
@@ -616,8 +627,10 @@
            // 生成入库通知档
            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());
                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;
@@ -643,6 +656,7 @@
                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());
@@ -659,7 +673,7 @@
            }
            // 关联组托
        } else {
//            Order order = orderService.selectByNo(param.getOrderNo());
            // Order order = orderService.selectByNo(param.getOrderNo());
            // 生成入库通知档
            List<DetlDto> detlDtos = new ArrayList<>();
            param.getCombMats().forEach(elem -> {
@@ -668,8 +682,10 @@
                    throw new CoolException("单据编号已过期");
                }
                // 订单明细数量校验
//                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
//                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
                // OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE,
                // order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(),
                // elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                // elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
                OrderDetlPakin detls = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
                        .eq("order_id", order.getId())
                        .eq("matnr", elem.getMatnr()));
@@ -681,10 +697,13 @@
                if (elem.getAnfme() > detls.getEnableQty()) {
                    throw new CoolException(detls.getMatnr() + "入库数量不合规则");
                }
                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),
                        elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
                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());
                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());
                detlDto.setOrderId(order.getId());
                detlDto.setOrderNo(order.getOrderNo());
                if (DetlDto.has(detlDtos, detlDto)) {
@@ -703,45 +722,49 @@
                throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
            }
//            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() + "!!");
//            }
            //还可以放入多少种物料
//            Integer suplus = container.getMixMax();
            // 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() +
            // "!!");
            // }
            // 还可以放入多少种物料
            // Integer suplus = container.getMixMax();
            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() + ", 超出当前托盘装载上限!!");
//                }
                // //最多可放数量
                // 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() + ", 超出当前托盘装载上限!!");
                // }
                WaitPakin waitPakin = new WaitPakin();
                BeanUtils.copyProperties(mat, waitPakin);
                waitPakin.setOrderNo(detlDto.getOrderNo());   // 单据编号
                waitPakin.setOrderNo(detlDto.getOrderNo()); // 单据编号
                waitPakin.setType(param.getType());
                waitPakin.setOrderId(detlDto.getOrderId());
                waitPakin.setBatch(detlDto.getBatch());     // 序列码
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setBatch(detlDto.getBatch()); // 序列码
                waitPakin.setZpallet(param.getBarcode()); // 托盘码
                waitPakin.setThreeCode(detlDto.getThreeCode());
                waitPakin.setSuppCode(detlDto.getStandby1());
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme());  // 数量
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setStandby1(detlDto.getStandby1());
                waitPakin.setIoStatus("N"); // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme()); // 数量
                waitPakin.setStatus("Y"); // 状态
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(now);
                waitPakin.setModiUser(userId);
@@ -751,7 +774,8 @@
                }
            }
            Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo).collect(Collectors.toSet());
            Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo)
                    .collect(Collectors.toSet());
            stringSet.forEach(orderNo -> {
                Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, orderNo);
                OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId);
@@ -781,7 +805,7 @@
                throw new CoolException(combMat.getMatnr() + ":商品数量有误!");
            }
            if (Cools.isEmpty(combMat.getBatch())) {
//                throw new CoolException(combMat.getMatnr() + ":商品批号有误!");
                // throw new CoolException(combMat.getMatnr() + ":商品批号有误!");
            }
            ManLocDetl manLocDetl = new ManLocDetl();
            manLocDetl.setLocNo(locno);
@@ -815,7 +839,6 @@
    // 查找商品
    @Override
    @Transactional
    public void adjust(MobileAdjustParam param, Long userId) {
@@ -845,12 +868,15 @@
                if (wrkDetl1.getAnfme() == 0) {
                    iterator1.remove();
                }
                if (wrkDetl.getMatnr().equals(wrkDetl1.getMatnr()) && Cools.eq(wrkDetl.getBatch(), wrkDetl1.getBatch())) {
                if (wrkDetl.getMatnr().equals(wrkDetl1.getMatnr())
                        && Cools.eq(wrkDetl.getBatch(), wrkDetl1.getBatch())) {
                    if (!wrkDetl.getAnfme().equals(wrkDetl1.getAnfme())) {
                        // todo 盘点记录、保存调整记录
                        // 修改明细
                        if (!wrkDetlService.updateAnfme(wrkDetl1.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) {
                            throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "批号修改数量失败");
                        if (!wrkDetlService.updateAnfme(wrkDetl1.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(),
                                wrkDetl.getBatch())) {
                            throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                                    + wrkDetl.getBatch() + "批号修改数量失败");
                        }
                    }
                    iterator.remove();
@@ -863,7 +889,8 @@
        for (WrkDetl wrkDetl : wrkDetls) {
            // todo 盘点记录、保存调整记录
            if (!wrkDetlService.updateAnfme(-1.0D, wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) {
                throw new CoolException("删除" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "批号任务明细失败");
                throw new CoolException("删除" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                        + wrkDetl.getBatch() + "批号任务明细失败");
            }
        }
@@ -882,7 +909,8 @@
            wrkDetl.setAppeTime(now);
            wrkDetl.setAppeUser(userId);
            if (!wrkDetlService.insert(wrkDetl)) {
                throw new CoolException("添加" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "批号任务明细失败");
                throw new CoolException("添加" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品,"
                        + wrkDetl.getBatch() + "批号任务明细失败");
            }
        }
@@ -903,8 +931,8 @@
            throw new CoolException(BaseRes.PARAM);
        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
        if (waitPakinService.selectCount(
                new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
        Date now = new Date();
@@ -929,11 +957,15 @@
                }
                Mat analyse = MatUtils.analyseMat(elem.getMatnr());
                // 条码、物料代码、序列号、数量
                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), analyse.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), elem.getThreeCode());
                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), analyse.getBrand(), elem.getStandby1(),
                        elem.getStandby2(), elem.getStandby3(),
                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
                        elem.getThreeCode());
//                DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(), analyse.getBarcode(), elem.getAnfme());
//                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme());
                // DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(),
                // analyse.getBarcode(), elem.getAnfme());
                // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),
                // elem.getAnfme());
                if (DetlDto.has(detlDtos, detlDto)) {
                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
                    assert one != null;
@@ -967,10 +999,12 @@
                    if (jsonObject.getInteger("code").equals(200)) {
                        success = true;
                    } else if (jsonObject.getInteger("code").equals(500)) {
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response);
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
                                JSON.toJSONString(mesCombParam), response);
                        throw new CoolException(jsonObject.getString("msg"));
                    } else {
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response);
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
                                JSON.toJSONString(mesCombParam), response);
                        throw new CoolException("上报mes系统失败");
                    }
                } catch (Exception e) {
@@ -986,8 +1020,7 @@
                                "127.0.0.1",
                                JSON.toJSONString(mesCombParam),
                                response,
                                success
                        );
                                success);
                    } catch (Exception e) {
                        log.error("", e);
                    }
@@ -1002,15 +1035,15 @@
            openParam.setOrderType("打包入库单");
            openParam.setOrderDetails(detlDtos);
            openService.pakinOrderCreate(openParam);
//            Order order = orderService.selectByNo(orderNo);
            // Order order = orderService.selectByNo(orderNo);
            Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo());
            if (null == order) {
                throw new CoolException("生成单据失败");
            }
//            if (!orderService.updateSettle(order.getId(), 2L, userId)) {
//                throw new CoolException("修改单据状态失败");
//            }
            // if (!orderService.updateSettle(order.getId(), 2L, userId)) {
            // throw new CoolException("修改单据状态失败");
            // }
            OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId);
            // 生成入库通知档
@@ -1018,18 +1051,22 @@
                // 修改作业数量 ----------------------------------------
                // 订单明细数量校验
//                OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), detlDto.getMatnr(), detlDto.getBatch());
                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3()
                        , detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3());
                // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(),
                // detlDto.getMatnr(), detlDto.getBatch());
                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), detlDto.getMatnr(),
                        detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(),
                        detlDto.getStandby3(), detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3());
                if (detlDto.getAnfme() > orderDetl.getEnableQty()) {
                    throw new CoolException(orderDetl.getMatnr() + "入库数量不合法");
                }
                // 修改订单作业数量
//                if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) {
//                    throw new CoolException("修改单据作业数量失败");
//                }
                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3()
                        , detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3(), detlDto.getAnfme());
                // if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(),
                // detlDto.getBatch(), detlDto.getAnfme())) {
                // throw new CoolException("修改单据作业数量失败");
                // }
                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), detlDto.getMatnr(), detlDto.getBatch(),
                        detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3(),
                        detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3(), detlDto.getAnfme());
                // 保存入库通知档
                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                if (Cools.isEmpty(mat)) {
@@ -1039,10 +1076,10 @@
                BeanUtils.copyProperties(mat, waitPakin);
                waitPakin.setOrderNo(orderNo);
                waitPakin.setBatch(detlDto.getBatch());
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme());  // 数量
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setZpallet(param.getBarcode()); // 托盘码
                waitPakin.setIoStatus("N"); // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme()); // 数量
                waitPakin.setStatus("Y"); // 状态
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(now);
                waitPakin.setModiUser(userId);
@@ -1070,25 +1107,27 @@
        String orderNo = param.containsKey("orderNo") ? param.get("orderNo").toString() : "";
        BasDevp sta = basDevpService.checkSiteStatus(staNo);
        //根据订单号生成出库任务工作档
        // 根据订单号生成出库任务工作档
        Order order = OrderInAndOutUtil.selectByNo(Boolean.FALSE, orderNo);
//        Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo));
        // Order order = orderService.selectOne(new
        // EntityWrapper<Order>().eq("order_no", orderNo));
        if (order.getSettle() != 1 && order.getSettle() != 2) {
            throw new CoolException("该订单已处理");
        }
//        List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo));
        // List<OrderDetl> orderDetls = orderDetlService.selectList(new
        // EntityWrapper<OrderDetl>().eq("order_no", orderNo));
        List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(Boolean.FALSE, order.getId());
        Date now = new Date();
        for (OrderDetl orderDetl : orderDetls) {
            //查询所有库位状态为F的库位信息
            // 查询所有库位状态为F的库位信息
            List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, null);
            if (locDetls.size() == 0) {
                throw new CoolException("库存中没有该物料");
            }
            for (LocDetl locDetl : locDetls) {
                //如果该库位出库路线所用的堆垛机out_enable不为Y,跳过该循环
                // 如果该库位出库路线所用的堆垛机out_enable不为Y,跳过该循环
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                        .eq("loc_no", locDetl.getLocNo()));
                if (Cools.isEmpty(locMast)) {
@@ -1100,23 +1139,24 @@
                    continue;
                }
                //可出库数量 = 订单数量 - 作业中数量
                // 可出库数量 = 订单数量 - 作业中数量
                Double outQty = orderDetl.getAnfme() - orderDetl.getWorkQty();
                if (outQty <= 0) {
                    break;
                }
                // 判断入出库类型:101.全板出库 or 103.拣料出库
                Double sumCount = locDetlService.getLocDetlSumQty(locDetl.getLocNo());
                Double curOutQty = outQty >= locDetl.getAnfme() ? locDetl.getAnfme() : outQty;   //本次出库量
                Double curOutQty = outQty >= locDetl.getAnfme() ? locDetl.getAnfme() : outQty; // 本次出库量
                int ioType = sumCount <= curOutQty ? 101 : 103;
                stockOut(orderDetl, sta, locDetl, curOutQty, ioType, userId, now);
                order.setSettle(2L);
                order.setUpdateBy(userId);
                order.setUpdateTime(now);
//                if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){
//                    throw new CoolException("更新订单状态失败");
//                }
                // if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no",
                // orderNo))){
                // throw new CoolException("更新订单状态失败");
                // }
                OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(), order.getId(), 2L, userId);
                orderDetl.setWorkQty(orderDetl.getWorkQty() + curOutQty);
                orderDetl.setUpdateBy(userId);
@@ -1126,9 +1166,9 @@
                if (!Cools.isEmpty(orderDetl.getBatch())) {
                    wrapper.eq("batch", orderDetl.getBatch());
                }
//                if(!orderDetlService.update(orderDetl, wrapper)){
//                    throw new CoolException("更新订单明细失败");
//                }
                // if(!orderDetlService.update(orderDetl, wrapper)){
                // throw new CoolException("更新订单明细失败");
                // }
                OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl);
            }
@@ -1139,7 +1179,7 @@
    @Override
    @Transactional
    public void stockOut(OrderDetl orderDetl, BasDevp staNo, LocDetl locDetl,
                         Double curOutQty, Integer ioType, Long userId, Date now) {
            Double curOutQty, Integer ioType, Long userId, Date now) {
        // 获取库位
        LocMast locMast = locMastService.selectById(locDetl.getLocNo());
        // 获取路径
@@ -1193,7 +1233,7 @@
            throw new CoolException("保存工作档明细失败");
        }
        // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        locMast = locMastService.selectById(locDetl.getLocNo());
        if (locMast.getLocSts().equals("F")) {
            locMast.setLocSts(ioType == 101 ? "R" : "P");
@@ -1233,12 +1273,13 @@
        if (Objects.isNull(params.getOrgSite())) {
            throw new CoolException("源站点不能为空!!");
        }
        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
        BasAreas basAreas = basAreasService
                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
        LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
                .eq("area_id",basAreas.getId())
                .eq("area_id", basAreas.getId())
                .eq("frozen", 0)
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
//                .eq("loc_no", params.getTarSite())
                // .eq("loc_no", params.getTarSite())
                .orderAsc(Arrays.asList("loc_no"))
                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
        if (Objects.isNull(locCache)) {
@@ -1247,10 +1288,9 @@
        try {
            generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId);
        }catch (Exception e) {
        } catch (Exception e) {
            throw new CoolException(e.getMessage());
        }
        return R.ok();
    }
@@ -1269,7 +1309,8 @@
        if (Objects.isNull(params.getOrderNo())) {
            throw new CoolException("单号不能为空!!");
        }
        OrderPakin orderPakin = orderPakinService.selectOne(new EntityWrapper<OrderPakin>().eq("order_no", params.getOrderNo()));
        OrderPakin orderPakin = orderPakinService
                .selectOne(new EntityWrapper<OrderPakin>().eq("order_no", params.getOrderNo()));
        if (Objects.isNull(orderPakin)) {
            throw new CoolException("数据错误:单据不存在!!");
        }
@@ -1292,56 +1333,60 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R OutCallAgv(AgvCallParams params, Long userId) {
        /**获取入库最早的一条数据**/
        LocCache locCaches = locCacheService.selectOne(new EntityWrapper<LocCache>()
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_F.type)
                .eq("frozen", 0)
                .orderDesc(Arrays.asList("sort", "first_time"))
                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
        if (Objects.isNull(locCaches)) {
            throw new CoolException("暂无满足需求库位!");
        }
        //获取缓存区信息
        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
        if (Objects.isNull(basAreas)) {
            throw new CoolException("库区不存在!!");
        }
        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
        /**获取入库最早的一条数据**/
        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_F.type)
                .eq("area_id", basAreas.getId())
                .eq("loc_no", locCaches.getLocNo()));
        if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
            throw new CoolException("库存明细不存在!!");
                .eq("frozen", 0)
                .orderDesc(Arrays.asList("sort", "first_time")));
        if (locCaches.isEmpty()) {
            throw new CoolException("暂无满足需求库位!");
        }
        Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
        if (Objects.isNull(matList) || matList.isEmpty()) {
            throw new CoolException("物料库不存在该物料!!");
        for (LocCache locCache : locCaches) {
            //获取缓存区信息
//            BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("area_id", basAreas.getId())
                    .eq("loc_no", locCache.getLocNo()));
            if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
                throw new CoolException("库存明细不存在!!");
            }
            Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
            List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
            if (Objects.isNull(matList) || matList.isEmpty()) {
                throw new CoolException("物料库不存在该物料!!");
            }
            Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
            if (!longs.isEmpty() && longs.size() > 1) {
                throw new CoolException("物料类型不一致,请检查数据是否正确!!");
            }
            Mat mat = matList.stream().findFirst().get();
            BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                    .eq("ctn_type", mat.getTagId())
                    .eq("dev_no", params.getTarSite()));
            if (Objects.isNull(station)) {
                continue;
            }
            /**生成缓存区出库任务*/
            generateCacheOutTask(station, locCache, userId);
            /**生成立库出库任务*/
            generateCRNOutTask(station, locCache, userId);
            return R.ok();
        }
        Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
        if (!longs.isEmpty() && longs.size() > 1) {
            throw new CoolException("物料类型不一致,请检查数据是否正确!!");
        }
        Mat mat = matList.stream().findFirst().get();
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                .eq("ctn_type", mat.getTagId())
                .eq("dev_no", params.getTarSite()));
        if (Objects.isNull(station)) {
            throw new CoolException("站点正在执行任务!!");
        }
        /**生成缓存区出库任务*/
        generateCacheOutTask(station, locCaches, userId);
        /**生成立库出库任务*/
        generateCRNOutTask(station, locCaches, userId);
        return R.ok();
        return R.error("未找到与站点类型匹配的库存");
    }
    @Override
@@ -1349,11 +1394,9 @@
        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getOrgSite()));
        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
                .eq("area_id", basAreas.getId())
        );
                .eq("area_id", basAreas.getId()));
        if (locCaches.isEmpty()) {
            throw new CoolException("暂无空板库位");
        }
@@ -1366,20 +1409,20 @@
        }
        generateCacheOutTask(station, locCaches.get(0), userId);
//        HIKApiDTO hikApiDTO =new HIKApiDTO()
//                .setOrg(locCaches.get(0).getLocNo())
//                .setOrgType("05")
//                .setTar(params.getTarSite())
//                .setTarType("05")
//                .setTaskType("GT5")
//                .setPriority("1")
//                .setCtnrType("2")
//                ;
//        HIKResultDTO hikResultDTO = sendAgvTask(hikApiDTO, HIKApiConstant.AGV_CALL_IN_PATH);
//        if (!hikResultDTO.isSuccess()){
//            return R.error(hikResultDTO.getMessage());
//        }
        // HIKApiDTO hikApiDTO =new HIKApiDTO()
        // .setOrg(locCaches.get(0).getLocNo())
        // .setOrgType("05")
        // .setTar(params.getTarSite())
        // .setTarType("05")
        // .setTaskType("GT5")
        // .setPriority("1")
        // .setCtnrType("2")
        // ;
        // HIKResultDTO hikResultDTO = sendAgvTask(hikApiDTO,
        // HIKApiConstant.AGV_CALL_IN_PATH);
        // if (!hikResultDTO.isSuccess()){
        // return R.error(hikResultDTO.getMessage());
        // }
        return R.ok();
    }
@@ -1400,7 +1443,8 @@
            throw new CoolException("当前暂无空库位!!");
        }
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getOrgSite()));
        BasStation station = basStationService
                .selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getOrgSite()));
        if (Objects.isNull(station)) {
            throw new CoolException("源站点未检索到数据!!");
        }
@@ -1412,7 +1456,8 @@
    @Transactional(rollbackFor = Exception.class)
    public void generateSOEOInTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
        List<BasStationDetl> basStationDetls = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite));
        List<BasStationDetl> basStationDetls = basStationDetlService
                .selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite));
        if (Objects.isNull(basStationDetls) || basStationDetls.isEmpty()) {
            throw new CoolException("站点信息不存在!!");
        }
@@ -1465,7 +1510,7 @@
                    .setAppeTime(new Date())
                    .setModiUser(userId);
            //保存工作档明细
            // 保存工作档明细
            if (!taskDetlService.insert(wrkDetl)) {
                throw new CoolException("保存工作档明细失败");
            }
@@ -1532,17 +1577,16 @@
        if (Objects.isNull(params.getBsCode())) {
            throw new CoolException("BS码不能为空!!");
        }
        Task task = taskService.selectOne(new EntityWrapper<Task>()
                .eq("io_type", TaskIOType.PICK_OUT.type)
                .eq("wrk_sts", 14)
                .eq("barcode", params.getCarBarcode()));
        if (Objects.isNull(task)) {
            throw new CoolException("数据错误:任务信息存在!!");
        }
//        Task task = taskService.selectOne(new EntityWrapper<Task>()
//                .eq("io_type", TaskIOType.PICK_OUT.type)
//                .eq("wrk_sts", 14)
//                .eq("barcode", params.getCarBarcode()));
//        if (Objects.isNull(task)) {
//            throw new CoolException("数据错误:任务信息存在!!");
//        }
        List<TaskDetl> taskDetl = taskDetlService.selectList(new EntityWrapper<TaskDetl>()
        List<BasStationDetl> taskDetl = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
                .eq("three_code", params.getBsCode())
                .eq("wrk_no", task.getWrkNo())
                .eq("zpallet", params.getCarBarcode()));
        if (Objects.isNull(taskDetl) || taskDetl.isEmpty()) {
@@ -1570,8 +1614,7 @@
            throw new CoolException("组托明细不能为空!!");
        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode())
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
                .eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
@@ -1586,7 +1629,8 @@
        // 生成入库通知档
        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(),
            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);
@@ -1596,7 +1640,8 @@
                detlDtos.add(detlDto);
            }
        });
        BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
        BasContainer container = basContainerService
                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
        if (Objects.isNull(container)) {
            throw new CoolException("数据错误:容器码不存在!!");
        }
@@ -1609,7 +1654,7 @@
        if (tagIds.size() > 1) {
            throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
        }
        //还可以放入多少种物料
        // 还可以放入多少种物料
        Integer suplus = container.getMixMax();
        Date now = new Date();
        for (DetlDto detlDto : detlDtos) {
@@ -1617,29 +1662,43 @@
            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());
@@ -1652,6 +1711,19 @@
            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("原始数据移除失败!");
                }
            }
        }
    }
@@ -1673,20 +1745,21 @@
        if (Objects.isNull(param.getStation())) {
            throw new CoolException("站点不能为空!!");
        }
        //TODO 修改缓存站点状态及数据
        Task task = taskService.selectOne(new EntityWrapper<Task>()
                .eq("wrk_sts", 14L)
                .eq("barcode", param.getCarBarcode()));
        if (Objects.isNull(task)) {
            throw new CoolException("数据错误,任务不存在!!");
        }
        List<TaskDetl> taskDetls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
        if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
            throw new CoolException("数据错误,任务明细不存在!!");
        }
//        // TODO 修改缓存站点状态及数据
//        Task task = taskService.selectOne(new EntityWrapper<Task>()
//                .eq("wrk_sts", 14L)
//                .eq("barcode", param.getCarBarcode()));
//        if (Objects.isNull(task)) {
//            throw new CoolException("数据错误,任务不存在!!");
//        }
//        List<TaskDetl> taskDetls = taskDetlService
//                .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
//        if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
//            throw new CoolException("数据错误,任务明细不存在!!");
//        }
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                .eq("dev_no", task.getStaNo()));
                .eq("dev_no", param.getStation()));
        if (Objects.isNull(station)) {
            throw new CoolException("站点不存在!!");
        }
@@ -1697,14 +1770,15 @@
        }
        basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
        //任务完成
        task.setWrkSts(15L);
//        // 任务完成
//        task.setWrkSts(15L);
//
//        if (!taskService.updateById(task)) {
//            throw new CoolException("AGV任务完成失败!!");
//        }
        if (!taskService.updateById(task)) {
            throw new CoolException("AGV任务完成失败!!");
        }
        List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
        List<WaitPakin> waitPakins = waitPakinService
                .selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
        if (Objects.isNull(waitPakins) || waitPakins.isEmpty()) {
            throw new CoolException("数据错误,组拖档已不存在!!");
        }
@@ -1715,17 +1789,18 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R collectionPakin(CollectionPakinParams params, Long userId) {
        List<BasStation> basStations = basStationService.selectList(new EntityWrapper<BasStation>().eq("barcode", params.getTarBarcode()));
        List<BasStation> basStations = basStationService
                .selectList(new EntityWrapper<BasStation>().eq("barcode", params.getTarBarcode()));
        if (basStations.isEmpty() && Cools.isEmpty(params.getDevNo())) {
            throw new CoolException("请输入站点号");
        }
        BasStation basStation = null;
        if (!basStations.isEmpty()) {
            basStation =  basStations.get(0);
        }else {
            basStation = basStations.get(0);
        } else {
            basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getDevNo()));
        }
        if (Cools.isEmpty(basStation)){
        if (Cools.isEmpty(basStation)) {
            throw new CoolException("请输入正确的站点号");
        }
        for (CollectionPakinParams.CombMat combMat : params.getCombMats()) {
@@ -1738,41 +1813,41 @@
                throw new CoolException("未找到备货入库单");
            }
            UpdateDetailsOfPakin(orderPakin,combMat);
            UpdateDetailsOfPakin(orderPakin, combMat);
            BasStationDetl basStationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
                    .eq("dev_no", basStation.getDevNo())
                    .eq("matnr", combMat.getMatnr())
                    .eq("batch", combMat.getBatch())
                    .eq("standby1", combMat.getStandby1())
            );
                    .eq("standby1", combMat.getStandby1()));
            if (Cools.isEmpty(basStationDetl)) {
                basStationDetl = new BasStationDetl();
                Mat mat = matService.selectByMatnr(combMat.getMatnr());
                BeanUtils.copyProperties(mat,basStationDetl);
                BeanUtils.copyProperties(mat, basStationDetl);
                basStationDetl
                        .setId(null)
                        .setOrderNo(orderPakin.getOrderNo())
                        .setDevNo(basStation.getDevNo())
                        .setBarcode(params.getTarBarcode())
                        .setZpallet(params.getTarBarcode())
                        .setBatch(combMat.getBatch())
                        .setSuppCode(combMat.getStandby1())
                        .setStandby1(combMat.getStandby1())
                        .setAnfme(combMat.getWorkQty().doubleValue())
                ;
                if (!basStationDetlService.insert(basStationDetl)){
                        .setAnfme(combMat.getWorkQty().doubleValue());
                if (!basStationDetlService.insert(basStationDetl)) {
                    throw new CoolException("插入明细失败");
                }
            }else {
            } else {
                BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty());
                basStationDetl.setAnfme(anfme.doubleValue());
                if (!basStationDetlService.updateById(basStationDetl)){
                if (!basStationDetlService.updateById(basStationDetl)) {
                    throw new CoolException("更新明细数据失败");
                }
            }
        }
        if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type) || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
        if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)
                || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
            basStation.setBarcode(params.getTarBarcode());
            basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
            basStationService.updateById(basStation);
@@ -1782,13 +1857,12 @@
    }
    @Transactional(rollbackFor = Exception.class)
    public void UpdateDetailsOfPakin(OrderPakin orderPakin,CollectionPakinParams.CombMat combMat){
    public void UpdateDetailsOfPakin(OrderPakin orderPakin, CollectionPakinParams.CombMat combMat) {
        OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
                .eq("order_id", orderPakin.getId())
                .eq("matnr", combMat.getMatnr())
                .eq("batch", combMat.getBatch())
                .eq("standby1", combMat.getStandby1())
        );
                .eq("standby1", combMat.getStandby1()));
        if (Cools.isEmpty(orderDetlPakin)) {
            throw new CoolException("检索单据明细数据失败");
        }
@@ -1797,16 +1871,15 @@
        }
        BigDecimal workQty = new BigDecimal(orderDetlPakin.getWorkQty().toString()).add(combMat.getWorkQty());
        orderDetlPakin.setWorkQty(workQty.doubleValue());
        if (!orderDetlPakinService.updateById(orderDetlPakin)){
        if (!orderDetlPakinService.updateById(orderDetlPakin)) {
            throw new CoolException("更新单据明细数据失败");
        }
        if (!orderPakin.getSettle().equals(2L)){
        if (!orderPakin.getSettle().equals(2L)) {
            orderPakin.setSettle(2L);
            if (!orderPakinService.updateById(orderPakin)){
            if (!orderPakinService.updateById(orderPakin)) {
                throw new CoolException("更新单据状态失败");
            }
        }
    }
@@ -1818,7 +1891,8 @@
            throw new CoolException("未找到任务");
        }
        if (wrkMast.getIoType().equals(TaskIOType.ALL_OUT.type) && wrkMast.getIoType().equals(TaskIOType.PICK_OUT.type)){
        if (wrkMast.getIoType().equals(TaskIOType.ALL_OUT.type)
                && wrkMast.getIoType().equals(TaskIOType.PICK_OUT.type)) {
            throw new CoolException("人物类型错误");
        }
@@ -1826,7 +1900,6 @@
        if (Cools.isEmpty(wrkDetls)) {
            throw new CoolException("未找到任务明细");
        }
        return R.ok(wrkDetls);
    }
@@ -1869,7 +1942,7 @@
        wrkMast.setSourceStaNo(dto.getSourceStaNo() + "");
        wrkMast.setStaNo(dto.getStaNo() + "");
        wrkMast.setLocNo(dto.getLocNo());
        wrkMast.setBarcode(pakin.getBarcode()); // 托盘码
        wrkMast.setBarcode(pakin.getZpallet()); // 托盘码
        wrkMast.setFullPlt("Y"); // 满板:Y
        wrkMast.setPicking("N"); // 拣料
        wrkMast.setExitMk("N"); // 退出
@@ -1897,16 +1970,16 @@
                throw new CoolException("保存工作明细失败");
            }
        });
        // 更新入库通知档 ioStatus ===>> Y
        Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
                .eq("zpallet", pakin.getZpallet());
        WaitPakin setParam = new WaitPakin();
        setParam.setLocNo(dto.getLocNo());
        setParam.setIoStatus("Y");
        setParam.setModiTime(now);
        if (!waitPakinService.update(setParam, wrapper)) {
            throw new CoolException("更新通知档失败");
        }
//        // 更新入库通知档 ioStatus ===>> Y
//        Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
//                .eq("zpallet", pakin.getZpallet());
//        WaitPakin setParam = new WaitPakin();
//        setParam.setLocNo(dto.getLocNo());
//        setParam.setIoStatus("Y");
//        setParam.setModiTime(now);
//        if (!waitPakinService.update(setParam, wrapper)) {
//            throw new CoolException("更新通知档失败");
//        }
        // 更新源站点信息
        sourceStaNo.setWrkNo(workNo);
        sourceStaNo.setModiTime(now);
@@ -1941,8 +2014,9 @@
        if (Objects.isNull(locCaches)) {
            throw new CoolException("库位不能为空!!");
        }
        //获取缓存区信息
        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
        // 获取缓存区信息
        BasAreas basAreas = basAreasService
                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
        if (Objects.isNull(basAreas)) {
            throw new CoolException("库区不存在!!");
        }
@@ -1953,31 +2027,37 @@
            throw new CoolException("库存明细不存在!!");
        }
//        Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
//        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
//
//        if (Objects.isNull(matList) || matList.isEmpty()) {
//            throw new CoolException("物料库不存在该物料!!");
//        }
//        Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
//        if (!longs.isEmpty() && longs.size() > 1) {
//            throw new CoolException("物料类型不一致,请检查数据是否正确!!");
//        }
        // Set<String> set =
        // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
        // List<Mat> matList = matService.selectList(new
        // EntityWrapper<Mat>().in("matnr", set));
        //
        // if (Objects.isNull(matList) || matList.isEmpty()) {
        // throw new CoolException("物料库不存在该物料!!");
        // }
        // Set<Long> longs =
        // matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
        // if (!longs.isEmpty() && longs.size() > 1) {
        // throw new CoolException("物料类型不一致,请检查数据是否正确!!");
        // }
        //获取立库区信息
        BasAreas one = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
        // 获取立库区信息
        BasAreas one = basAreasService
                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
        if (Objects.isNull(one)) {
            throw new CoolException("数据错误:库区不存在!!");
        }
        List<StationRela> relas = stationRelaService.selectList(new EntityWrapper<StationRela>().eq("agv_sta", station.getDevNo()));
        List<StationRela> relas = stationRelaService
                .selectList(new EntityWrapper<StationRela>().eq("agv_sta", station.getDevNo()));
        if (Objects.isNull(relas) || relas.isEmpty()) {
            throw new CoolException("站点未关联堆垛机作业站点!!");
        }
        Set<String> crnStas = relas.stream().map(StationRela::getCrnSta).collect(Collectors.toSet());
        List<BasDevp> devps = basDevpService.selectList(new EntityWrapper<BasDevp>().in("dev_no", crnStas).eq("loading", CommonStation.COMMON_STATION_Y.type));
        List<BasDevp> devps = basDevpService.selectList(
                new EntityWrapper<BasDevp>().in("dev_no", crnStas).eq("loading", CommonStation.COMMON_STATION_Y.type));
        if (Objects.isNull(devps) || devps.isEmpty()) {
            throw new CoolException("无站点可用!");
        }
@@ -1985,31 +2065,34 @@
        BasDevp basDevp = devps.stream().findFirst().get();
        List<LocMast> locMasts = new ArrayList<>();
        Map<String, List<LocDetl>> listMap = locDetls.stream().collect(Collectors.groupingBy(LocDetl::getMatnr));
        AtomicReference<Double> totalOut = new AtomicReference<>(locDetls.stream().mapToDouble(LocDetl::getAnfme).sum());
        AtomicReference<Double> totalOut = new AtomicReference<>(
                locDetls.stream().mapToDouble(LocDetl::getAnfme).sum());
        listMap.forEach((matnr, detls) -> {
            //根据supId(供应商)分类,得到出库总数
            // 根据supId(供应商)分类,得到出库总数
            Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
            supIds.forEach((supId, sups) -> {
                Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
                //获取当前供应商+ 物料在库
                // 获取当前供应商+ 物料在库
                List<LocDetl> detlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
                        .eq("matnr", matnr)
                        .eq("area_id", one.getId())
                        .eq("standby1", supId).orderAsc(Arrays.asList("appe_time")));
                //TODO  判断是否有新库位,没有新库位,再找有空格的位置放   1. 判断当前物料是否有库存 2. 没有余料查询新库位
                // TODO 判断是否有新库位,没有新库位,再找有空格的位置放 1. 判断当前物料是否有库存 2. 没有余料查询新库位
                if (!Objects.isNull(detlList) && !detlList.isEmpty()) {
                    Map<String, List<LocDetl>> locMaps = detlList.stream().collect(Collectors.groupingBy(LocDetl::getLocNo));
                    Map<String, List<LocDetl>> locMaps = detlList.stream()
                            .collect(Collectors.groupingBy(LocDetl::getLocNo));
                    locMaps.forEach((locNo, adetls) -> {
                        LocMast locMast = locMastService.selectById(locNo);
                        if (Objects.isNull(locMast)) {
                            throw new CoolException("数据错误,库位信息不存在!!");
                        }
                        BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", locMast.getBarcode()));
                        BasContainer container = basContainerService
                                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", locMast.getBarcode()));
                        if (Objects.isNull(container)) {
                            throw new CoolException("数据错误,容器不存在!!");
                        }
                        Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
                        //判断容器是否还可混放,及当前物料可放多少
                        // 判断容器是否还可混放,及当前物料可放多少
                        if (container.getMixMax() > sets.size()) {
                            int suplus = container.getMixMax() - sets.size();
                            Mat mats = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
@@ -2017,9 +2100,9 @@
                                throw new CoolException("物料不存在!!");
                            }
                            Double v = mats.getUpQty() * suplus;
                            //小于零
                            // 小于零
                            if (sum.compareTo(v) <= 0) {
                                //可放下
                                // 可放下
                                locMasts.add(locMast);
                                totalOut.set(Math.round((totalOut.get() - sum) * 10000) / 10000.0);
                            }
@@ -2029,27 +2112,28 @@
            });
        });
        //判断根据分拣出库后,还需要出多少托盘或料箱;如果余料大于0, 出新托盘或料箱
        // 判断根据分拣出库后,还需要出多少托盘或料箱;如果余料大于0, 出新托盘或料箱
        if (totalOut.get().compareTo(0.0) > 0) {
//            Set<String> matnrs = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
//            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
            // Set<String> matnrs =
            // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
            // List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr",
            // matnrs));
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                    //todo 根据物料种类,区分库区类型
                    // todo 根据物料种类,区分库区类型
                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
                    .orderAsc(Arrays.asList("row1", "bay1", "lev1"))
                    .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
            locMasts.add(locMast);
            //空板出库
            // 空板出库
            generateTask(locMasts, TaskIOType.EMPTY_OUT.type, basDevp, userId);
        } else {
            //生成堆垛机出库任务
            // 生成堆垛机出库任务
            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
//            if (!locMasts.isEmpty()) {
//
//            }
            // if (!locMasts.isEmpty()) {
            //
            // }
        }
    }
    /**
     * 生成堆垛机出库任务
@@ -2095,7 +2179,8 @@
                throw new CoolException("保存工作档失败,出库库位号:" + locMast.getLocNo());
            }
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
            List<LocDetl> locDetls = locDetlService
                    .selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
            // 生成工作档明细
            for (LocDetl detlDto : locDetls) {
@@ -2112,9 +2197,10 @@
                    throw new CoolException("保存工作档明细失败");
                }
            }
            // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
            // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
            locMast = locMastService.selectById(locMast.getLocNo());
            if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type) || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
            if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)
                    || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
                locMast.setLocSts(ioType == 101 ? "R" : "P");
                locMast.setModiUser(userId);
                locMast.setModiTime(now);
@@ -2142,7 +2228,7 @@
        task.setWrkNo(workNo)
                .setIoTime(new Date())
                .setWrkSts(11L) // 工作状态:11.生成出库ID
                .setIoType(loc.getLocSts().equals("D") ? 110 : 103) // 入出库状态: 11.库格移载
                .setIoType(loc.getLocSts().equals("D") ? 110 : 101) // 入出库状态: 11.库格移载
                .setTaskType("agv")
                .setIoPri(10D)
                .setFullPlt(loc.getLocSts().equals("D") ? "N" : "Y") // 满板:Y
@@ -2182,7 +2268,7 @@
                        .setModel(pakin.getModel())
                        .setAppeTime(new Date())
                        .setModiUser(userId);
                //保存工作档明细
                // 保存工作档明细
                if (!taskDetlService.insert(wrkDetl)) {
                    throw new CoolException("保存工作档明细失败");
                }
@@ -2253,7 +2339,7 @@
            throw new CoolException("保存工作档失败");
        }
        for (WaitPakin pakin :pakins){
        for (WaitPakin pakin : pakins) {
            TaskDetl wrkDetl = new TaskDetl();
            BeanUtils.copyProperties(pakin, wrkDetl);
            wrkDetl.setId(null).setWrkNo(workNo)
@@ -2269,21 +2355,18 @@
                    .setModel(pakin.getModel())
                    .setAppeTime(new Date())
                    .setModiUser(userId);
            if (!taskDetlService.insert(wrkDetl)){
            if (!taskDetlService.insert(wrkDetl)) {
                throw new CoolException("保存工作档明细失败");
            }
        }
        for (WaitPakin pakin : pakins){
        for (WaitPakin pakin : pakins) {
            pakin.setIoStatus("Y");
            if (!waitPakinService.updateById(pakin)) {
                throw new CoolException("更新组托信息失败");
            }
        }
        // 修改目标库位状态
        if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
@@ -2316,7 +2399,6 @@
        }
    }
    public HIKResultDTO sendAgvTask(HIKApiDTO haiKangApiDTO, String path) {
        HIKResultDTO result = new HIKResultDTO();
@@ -2327,8 +2409,10 @@
        forwardAGVTaskParam.setCtnrTyp(haiKangApiDTO.getCtnrType());
        forwardAGVTaskParam.setPriority(haiKangApiDTO.getPriority());
        List<ForwardAGVTaskDTO.PositionCodePaths> positionCodePathsList = new ArrayList<>();
        positionCodePathsList.add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getOrg(), haiKangApiDTO.getOrgType()));
        positionCodePathsList.add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getTar(), haiKangApiDTO.getTarType()));
        positionCodePathsList
                .add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getOrg(), haiKangApiDTO.getOrgType()));
        positionCodePathsList
                .add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getTar(), haiKangApiDTO.getTarType()));
        forwardAGVTaskParam.setPositionCodePath(positionCodePathsList);
        String body = JSON.toJSONString(forwardAGVTaskParam);
@@ -2347,7 +2431,7 @@
                result.setMessage(jsonObject.getString("message"));
                log.error("发送agv任务失败!!!url:{};request:{};response:{}", HIKApiConstant.AGV_IP + path, body, response);
            }
//            {"code":"1","data":"","interrupt":false,"message":"重复提交","msgErrCode":"0x3a80D012","reqCode":"fa92b49481a44627ae4d80c1400f28f6"}
            // {"code":"1","data":"","interrupt":false,"message":"重复提交","msgErrCode":"0x3a80D012","reqCode":"fa92b49481a44627ae4d80c1400f28f6"}
        } catch (Exception e) {
            result.setMessage(e.getMessage());
            log.error("发送agv任务异常", e);
@@ -2361,8 +2445,7 @@
                        "127.0.0.1",
                        body,
                        response,
                        result.isSuccess()
                );
                        result.isSuccess());
            } catch (Exception e) {
                log.error("", e);
            }
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -418,7 +418,7 @@
                            .eq("loc_no", locDto.getLocNo())
                            .eq("matnr", locDto.getMatnr())
                            .eq("batch", locDto.getBatch())
                            .eq("standby1",locDto.getStandby2())
                            .eq("standby1",locDto.getStandby1())
                    ).getDiffQty().compareTo(BigDecimal.ZERO) == 0
            );
            if (!DiffQty){
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -191,21 +191,6 @@
//                }
            }
            for (TaskDetl taskDetl :taskDetls){
                TaskDetlLog taskDetlLog = new TaskDetlLog();
                BeanUtils.copyProperties(taskDetl, taskDetlLog);
                // 保存工作明细档历史档
                if (!taskDetlLogService.insert(taskDetlLog)) {
                exceptionHandle("保存工作明细历史档[workNo={0}]失败", task.getWrkNo());
                }
                // 删除工作明细档
                if (!taskDetlService.deleteById(taskDetl)) {
                exceptionHandle("删除工作明细档[workNo={0}]失败", task.getWrkNo());
                }
            }
            TaskLog taskLog = new TaskLog();
            BeanUtils.copyProperties(task, taskLog);
            // 保存工作主档历史档
@@ -217,6 +202,22 @@
            if (!taskService.deleteById(task)) {
                exceptionHandle("删除工作主档[workNo={0}]失败", task.getWrkNo());
            }
            List<TaskDetl> taskDetls2 = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
            for (TaskDetl taskDetl :taskDetls2){
                TaskDetlLog taskDetlLog = new TaskDetlLog();
                BeanUtils.copyProperties(taskDetl, taskDetlLog);
                taskDetlLog.setLogId(taskLog.getId());
                taskDetlLog.setId(null);
                // 保存工作明细档历史档
                if (!taskDetlLogService.insert(taskDetlLog)) {
                exceptionHandle("保存工作明细历史档[workNo={0}]失败", task.getWrkNo());
                }
                // 删除工作明细档
                if (!taskDetlService.deleteById(taskDetl)) {
                exceptionHandle("删除工作明细档[workNo={0}]失败", task.getWrkNo());
                }
            }
        } catch (Exception e) {
            log.error("fail", e);
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -6,10 +6,7 @@
import com.zy.asrs.entity.*;
import com.zy.asrs.enums.LocStsType;
import com.zy.asrs.service.*;
import com.zy.asrs.service.impl.BasStationServiceImpl;
import com.zy.asrs.service.impl.LocCacheServiceImpl;
import com.zy.asrs.service.impl.OrderPakinServiceImpl;
import com.zy.asrs.service.impl.TaskDetlServiceImpl;
import com.zy.asrs.service.impl.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import lombok.extern.slf4j.Slf4j;
@@ -61,6 +58,8 @@
    private CheckOrderDetlService checkOrderDetlService;
    @Autowired
    private WaitPakinLogService waitPakinLogService;
    @Autowired
    private BasStationDetlService basStationDetlService;
    public ReturnT<String> start(WrkMast wrkMast) {
        // 4.入库完成
@@ -142,6 +141,8 @@
                        } else {
                            locDetl = new LocDetl();
                            locDetl.sync(wrkDetl);
                            locDetl.setAreaId(locMast.getAreaId());
                            locMast.setAreaName(locMast.getAreaName());
                            locDetl.setLocNo(wrkMast.getLocNo()); // 库位号
                            locDetl.setAnfme(wrkDetl.getAnfme()); // 数量
                            locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码
@@ -711,6 +712,7 @@
     * @description: AGV出库任务
     * @version 1.0
     */
    @Transactional(rollbackFor = Exception.class)
    public ReturnT<String> agvDoOut(Task task) {
        if (task.getIoType().equals(101)) {
            Date now = new Date();
@@ -726,6 +728,18 @@
                return FAIL.setMsg(
                        "全板出库 ===>> 工作明细档为空; [workNo=" + task.getWrkNo() + "],[locNo=" + task.getSourceLocNo() + "]");
            }
            BasStation devNo = basStationService
                    .selectOne(new EntityWrapper<BasStation>().eq("dev_no", task.getStaNo()));
            if (Objects.isNull(devNo)) {
                throw new CoolException("站点:" + task.getSourceStaNo() + ", 不存在!!");
            }
            devNo.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
            devNo.setModiTime(new Date());
            if (!basStationService.updateById(devNo)) {
                throw new CoolException("站点信息修改失败!!");
            }
            for (TaskDetl wrkDetl : wrkDetls101) {
                // 更新订单完成数量
                OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(),
@@ -751,6 +765,15 @@
                        }
                    }
                } catch (Exception ignore) {
                }
                BasStationDetl stationDetl = new BasStationDetl();
                BeanUtils.copyProperties(wrkDetl, stationDetl);
                stationDetl.setDevNo(devNo.getDevNo())
                        .setOrderNo(wrkDetl.getOrderNo());
                if (!basStationDetlService.insert(stationDetl)) {
                    throw new CoolException("站点明细保存失败!!");
                }
            }
            // 删除工作档源库位的库存明细
@@ -774,16 +797,8 @@
                throw new CoolException("当前库位状态" + locMast.getLocSts() + ", 无法执行出库操作!!");
            }
            BasStation devNo = basStationService
                    .selectOne(new EntityWrapper<BasStation>().eq("dev_no", task.getStaNo()));
            if (Objects.isNull(devNo)) {
                throw new CoolException("站点:" + task.getSourceStaNo() + ", 不存在!!");
            }
            devNo.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
            devNo.setModiTime(new Date());
            if (!basStationService.updateById(devNo)) {
                throw new CoolException("站点信息修改失败!!");
            }
            task.setWrkSts(15L);
            if (!taskService.updateById(task)) {
                throw new CoolException("任务状态修改失败!!");
@@ -841,18 +856,21 @@
                throw new CoolException(
                        "当前库位状态为:" + LocStsType.LOC_STS_TYPE_S.type + "." + LocStsType.LOC_STS_TYPE_S.desc + ",不是出库预约状态");
            }
            List<WaitPakin> apallet = waitPakinService
                    .selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
            if (Objects.isNull(apallet)) {
            List<TaskDetl> taskDetls = taskDetlService
                    .selectList(new EntityWrapper<TaskDetl>().eq("zpallet", wrkMast.getBarcode()));
            if (Objects.isNull(taskDetls)) {
                throw new CoolException("数据错误:组托数据不存在!!");
            }
            apallet.forEach(pakin -> {
            log.info(taskDetls.size() + "-------------------------------------------------------------------");
            taskDetls.forEach(pakin -> {
                LocDetl detl = new LocDetl();
                BeanUtils.copyProperties(pakin, detl);
                detl.setBarcode(pakin.getBarcode());
                detl.setAnfme(pakin.getAnfme());
                detl.setBrand(pakin.getBrand());
                detl.setSuppCode(pakin.getSuppCode());
                detl.setAppeTime(new Date());
                detl.setSpecs(pakin.getSpecs());
                detl.setColor(pakin.getColor());
@@ -881,14 +899,16 @@
                throw new CoolException("任务状态修改失败!!");
            }
            for (WaitPakin pakin : apallet){
            List<WaitPakin> apallets = waitPakinService
                    .selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
            for (WaitPakin pakin : apallets){
                WaitPakinLog waitPakinLog = new WaitPakinLog();
                BeanUtils.copyProperties(pakin, waitPakinLog);
                waitPakinLogService.insert(waitPakinLog);
                waitPakinService.deleteById(pakin.getId());
            }
            Set<Long> list = apallet.stream().map(WaitPakin::getOrderId).collect(Collectors.toSet());
            Set<Long> list = apallets.stream().map(WaitPakin::getOrderId).collect(Collectors.toSet());
            List<OrderPakin> pakins = orderPakinService.selectList(new EntityWrapper<OrderPakin>().in("id", list));
            if (Objects.isNull(pakins) || pakins.isEmpty()) {
//            throw new CoolException("单据不存在!!");
@@ -904,7 +924,6 @@
                        + wrkMast.getLocNo() + "]");
            }
            for (TaskDetl wrkDetl : wrkDetls53) {
                LocDetl locDetl = locDetlService.selectItem(locCache.getLocNo(), wrkDetl.getMatnr(),
                        wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(),
                        wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(),
src/main/webapp/static/js/common.js
@@ -223,10 +223,12 @@
var cacheCols = [
    {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true}
    ,{field: 'standby1', align: 'center',title: '供应商代码', sort:true}
    ,{field: 'anfme', align: 'center',title: '数量', hide: false}
    ,{field: 'specs', align: 'center',title: '规格', hide: false}
    ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
    ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
    ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'length', align: 'center',title: '重量', hide: false}
    ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
    ,{field: 'frozen$', align: 'center',title: '冻结否',hide: true,
@@ -244,7 +246,7 @@
    {field: 'matnr', align: 'center',title: '商品编号', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称', sort:true}
    ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
    ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'standby1', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
    ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
    ,{field: 'batch', align: 'center',title: '批号', hide: true}
src/main/webapp/static/js/orderPakin/order.js
@@ -126,6 +126,7 @@
                            ,{field: 'anfme', align: 'center',title: '数量', hide: false}
                            ,{field: 'specs', align: 'center',title: '规格', hide: false}
                            ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
                            ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: false}
                            ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
                            ,{ field: 'anfme', title: '数量', align: 'center',hide: false}
                            ,{ field: 'workQty', title: '作业数量', align: 'center',hide: false }
src/main/webapp/static/js/taskLog/taskLog.js
@@ -20,20 +20,23 @@
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[
            {field: 'wrkNo', align: 'center', title: '工作号', event: 'wrkNo', sort: true}
            , {field: 'ioTime$', align: 'center', title: '工作时间', width: 160, sort: true}
            , {field: 'wrkSts$', align: 'center', title: '工作状态', width: 160}
            , {field: 'ioType$', align: 'center', title: '入出库类型', width: 160}
            , {field: 'ioPri', align: 'center', title: '优先级'}
            , {field: 'crnNo$', align: 'center', title: '堆垛机号'}
            , {field: 'sourceStaNo$', align: 'center', title: '源站'}
            , {field: 'staNo$', align: 'center', title: '目标站'}
            , {field: 'sourceLocNo$', align: 'center', title: '源库位'}
            , {field: 'locNo$', align: 'center', title: '目标库位'}
            {field: 'wrkNo', align: 'center', title: '工作号', sort: true, width: 105}
            , {field: 'ioTime$', align: 'center', title: '工作时间', width: 160}
            , {field: 'wrkSts$', align: 'center', title: '工作状态', width: 150}
            , {field: 'ioType$', align: 'center', title: '入出库类型', width: 150}
            , {field: 'ioPri', align: 'center', title: '优先级', width: 80}
            , {field: 'taskType$', align: 'center', title: '任务类型', width: 120}
            , {field: 'crnNo$', align: 'center', title: '堆垛机', hide: true}
            , {field: 'sourceStaNo$', align: 'center', title: '源站', }
            , {field: 'sourceLocNo', align: 'center', title: '源库位', }
            , {field: 'staNo$', align: 'center', title: '目标站', }
            , {field: 'locNo', align: 'center', title: '目标库位', }
            , {field: 'barcode', align: 'center', title: '条码', width: 110}
            , {field: 'preHave', align: 'center', title: '先入品', hide: true}
            , {field: 'takeNone', align: 'center', title: '空操作', hide: true}
            , {field: 'modiUser$', align: 'center', title: '修改人员', hide: true}
            , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true}
            , {field: 'barcode', align: 'center', title: '条码'}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 80}
            , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true, width: 160}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate'}
        ]],
        request: {
            pageName: 'curr',
@@ -98,6 +101,7 @@
            case 'detlShow':
                wrkNo = data.wrkNo;
                ioTime = data.ioTime;
                id = data.id;
                // 表格下方显示
                // locDetl(data.wrkNo);
                // 弹层显示
@@ -107,7 +111,7 @@
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: true,
                    content: 'taskLog_detail.html',
                    content: 'taskDetlLog.html',
                    success: function (layero, index) {
                    }
                });
src/main/webapp/static/js/waitPakin/waitPakin.js
@@ -5,7 +5,7 @@
        {field: 'type$', align: 'center', title: '组托类型'}
    ];
    cols.push.apply(cols, detlCols);
    cols.push({field: 'locNo', align: 'center', title: '库位号'}
    cols.push({field: 'locNo', align: 'center', title: '库位号', hide: true}
        , {
            field: 'status', align: 'center', title: '数据状态', templet: function (row) {
                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='正常|锁定'' lay-filter='tableCheckbox' disabled='disabled' table-index='" + row.LAY_TABLE_INDEX + "'";
src/main/webapp/views/basStation/basStationDetl.html
@@ -32,7 +32,8 @@
        var cols = [
            {field: 'devNo', align: 'center', title: '站点台号'}
        ];
        cols.push.apply(cols, cacheCols);
        cols.push.apply(cols, detlCols);
        cols.push({field: 'workQty', align: 'center',title: '执行中', hide: false})
        return cols;
    }
src/main/webapp/views/taskLog/taskDetlLog.html
New file
@@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
    <style>
    </style>
</head>
<body>
<div class="layui-inline"  style="width:20%;margin-top: 20px">
    <label class="layui-form-label">工 作 号:</label>
    <div class="layui-input-inline">
        <input id="wrkNo" class="layui-input" type="text" disabled="disabled">
    </div>
</div>
<div class="layui-inline"  style="width:20%;margin-top: 20px">
    <label class="layui-form-label">工作时间:</label>
    <div class="layui-input-inline">
        <input id="ioTime" class="layui-input" type="text" disabled="disabled">
    </div>
</div>
<table class="layui-hide" id="wrkDetlLogByMast" lay-filter="wrkDetlLogByMast"></table>
</body>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/locMast/locMast.js" charset="utf-8"></script>
<script type="text/javascript">
    var pageCur;
    function getCol() {
        let cols = [
            {field: 'wrkNo', align: 'center',title: '工作号'}
            ,{field: 'ioTime$', align: 'center',title: '工作时间',width:160}
        ];
        cols.push.apply(cols, detlCols);
        return cols;
    }
    layui.use(['table','laydate', 'form'], function() {
        table = layui.table;
        var $ = layui.jquery;
        var form = layui.form;
        $('#wrkNo').val(parent.wrkNo);
        $('#ioTime').val(top.dateToStr(parent.ioTime, true));
        // 数据渲染
        tableIns1 = table.render({
            elem: '#wrkDetlLogByMast',
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/taskDetlLogByMast/list/auth',
            where: {wrk_no: parent.wrkNo,id: parent.id},
            page: true,
            limit: 16,
            limits: [16, 30, 50, 100, 200, 500],
            even: true,
            toolbar: '#toolbar',
            cellMinWidth: 50,
            cols: [getCol()],
            request: {
                pageName: 'curr',
                pageSize: 'limit'
            },
            parseData: function (res) {
                return {
                    'code': res.code,
                    'msg': res.msg,
                    'count': res.data.total,
                    'data': res.data.records
                }
            },
            response: {
                statusCode: 200
            },
            done: function(res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCur=curr;
                form.on('checkbox(tableCheckbox)', function (data) {
                    var _index = $(data.elem).attr('table-index')||0;
                    if(data.elem.checked){
                        res.data[_index][data.value] = 'Y';
                    }else{
                        res.data[_index][data.value] = 'N';
                    }
                });
            }
        });
    });
</script>
</html>
src/main/webapp/views/taskLog/taskLog.html
@@ -72,7 +72,7 @@
<!-- 表格 -->
<div class="layui-form">
    <table class="layui-hide" id="wrkMastLog" lay-filter="wrkMastLog"></table>
    <table class="layui-hide" id="taskLog" lay-filter="taskLog"></table>
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">