自动化立体仓库 - WMS系统
3个文件已添加
5个文件已删除
42个文件已修改
1467 ■■■■ 已修改文件
src/main/java/appVersion.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/basContainer.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/checkOrder.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/checkOrderDetl.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/controller/AgvScheduleController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/controller/KopenApiController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/entity/CallAgvParams.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/entity/SyncMatParmas.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/enums/MatLocType.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/enums/MatType.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/KopenApiService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/AgvScheduleServiceImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/KopenApiServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasContainer.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasStationDetl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/LocDetl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Mat.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Order.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/OrderDetl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/OrderDetlPakin.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/OrderDetlPakout.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/WaitPakin.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/AgvTaskParam.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/CollectionPakinParams.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/enums/TaskIOType.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/TaskMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/MobileService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/TaskService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 366 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderPakinServiceImpl.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderPakoutServiceImpl.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/TaskServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/WorkLogScheduler.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/stationRela.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TaskMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locCache/locCache.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/order.js 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/orderPakin/order.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/orderPakout/order.js 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/basContainer/basContainer.html 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/locCache/locDetail.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/taskLog/taskLog.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/appVersion.sql
File was deleted
src/main/java/basContainer.sql
File was deleted
src/main/java/checkOrder.sql
File was deleted
src/main/java/checkOrderDetl.sql
File was deleted
src/main/java/com/zy/api/controller/AgvScheduleController.java
@@ -45,6 +45,9 @@
            return R.error("参数不能为空!!");
        }
        return agvScheduleService.callback(params);
    }
}
src/main/java/com/zy/api/controller/KopenApiController.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.core.common.R;
import com.zy.api.entity.OrderParams;
import com.zy.api.entity.SyncMatParmas;
import com.zy.api.service.KopenApiService;
import com.zy.asrs.entity.Mat;
import io.swagger.annotations.ApiOperation;
@@ -53,16 +54,15 @@
     */
    @ApiOperation("零件信息数据更新")
    @PostMapping("/sync/mat")
    public R basMatUpdate(@RequestBody Map<String, String> params) {
        if (Objects.isNull(params.get("matnrs"))) {
    public R basMatUpdate(@RequestBody SyncMatParmas params) {
        if (Objects.isNull(params)) {
            return R.error("参数不能为空!!");
        }
        if (params.get("matnrs").isEmpty()) {
            return R.error("变更零件明细不能为空!!");
        if (Objects.isNull(params.getPro_komcode())) {
            return R.error("零件编码不能为空!!");
        }
        List<Mat> mats = JSON.parseArray(params.get("matnrs"), Mat.class);
        return kopenApiService.basMatupdate(mats);
        return kopenApiService.basMatupdate(params);
    }
src/main/java/com/zy/api/entity/CallAgvParams.java
@@ -26,4 +26,10 @@
    @ApiModelProperty("目标库位")
    private String tarLoc;
    @ApiModelProperty("搬运状态")
    private String status;
    @ApiModelProperty("任务号")
    private String wrkNo;
}
src/main/java/com/zy/api/entity/SyncMatParmas.java
New file
@@ -0,0 +1,45 @@
package com.zy.api.entity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
@ApiModel(value = "SyncMatParmas", description = "物料同步参数")
public class SyncMatParmas implements Serializable {
    @ApiModelProperty("零件类型")
    private String pro_type;
    @ApiModelProperty("零件代码")
    private String pro_komcode;
    @ApiModelProperty("供应商编码")
    private String pro_id;
    @ApiModelProperty("入库通知数量")
    private Double inv_qty;
    @ApiModelProperty("公司ID")
    private String company_id;
    @ApiModelProperty("零件名称")
    private String pro_name;
    @ApiModelProperty("尺寸")
    private String pro_size;
    @ApiModelProperty("重量")
    private String pro_wet;
    @ApiModelProperty("更新时间")
    private String update_time;
}
src/main/java/com/zy/api/enums/MatLocType.java
@@ -23,4 +23,29 @@
        this.type = type;
        this.desc = desc;
    }
    public static String getTagName(String type) {
        if (type.equals(MatLocType.AUTOMATED.type)) {
            return MatLocType.AUTOMATED.desc;
        } else if (type.equals(MatLocType.SO_HOLDING.type)) {
            return MatLocType.SO_HOLDING.desc;
        } else if (type.equals(MatLocType.EO_HOLDING.type)) {
            return MatLocType.EO_HOLDING.desc;
        } else {
            return null;
        }
    }
    public static Long getTag(String type) {
        if (type.equals(MatType.LARGE.type)) {
            return Long.parseLong(MatLocType.AUTOMATED.type);
        } else if (type.equals(MatType.MIDDEL.type)) {
            return Long.parseLong(MatLocType.SO_HOLDING.type);
        } else if (type.equals(MatType.SMALL.type)) {
            return Long.parseLong(MatLocType.EO_HOLDING.type);
        } else {
            return null;
        }
    }
}
src/main/java/com/zy/api/enums/MatType.java
@@ -21,4 +21,16 @@
        this.desc = desc;
    }
    public static Long getTag(String type) {
        if (type.equals(MatType.LARGE.type)) {
            return Long.parseLong(MatLocType.AUTOMATED.type);
        } else if (type.equals(MatType.MIDDEL.type)) {
            return Long.parseLong(MatLocType.SO_HOLDING.type);
        } else if (type.equals(MatType.SMALL.type)) {
            return Long.parseLong(MatLocType.EO_HOLDING.type);
        } else {
            return null;
        }
    }
}
src/main/java/com/zy/api/service/KopenApiService.java
@@ -2,9 +2,7 @@
import com.core.common.R;
import com.zy.api.entity.OrderParams;
import com.zy.asrs.entity.Mat;
import java.util.List;
import com.zy.api.entity.SyncMatParmas;
public interface KopenApiService {
@@ -25,7 +23,7 @@
     * @param matnrs
     * @return com.core.common.R
     */
    R basMatupdate(List<Mat> matnrs);
    R basMatupdate(SyncMatParmas matnrs);
    /**
src/main/java/com/zy/api/service/impl/AgvScheduleServiceImpl.java
@@ -1,13 +1,45 @@
package com.zy.api.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.api.entity.CallAgvParams;
import com.zy.api.enums.OrderType;
import com.zy.api.service.AgvScheduleService;
import com.zy.asrs.entity.LocCache;
import com.zy.asrs.entity.Task;
import com.zy.asrs.entity.result.ForwardAGVTaskDTO;
import com.zy.asrs.entity.result.HIKApiDTO;
import com.zy.asrs.entity.result.HIKResultDTO;
import com.zy.asrs.enums.LocStsType;
import com.zy.asrs.enums.TaskIOType;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.LocCacheService;
import com.zy.asrs.service.TaskService;
import com.zy.asrs.service.impl.LocCacheServiceImpl;
import com.zy.common.constant.HIKApiConstant;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@Slf4j
@Service
public class AgvScheduleServiceImpl implements AgvScheduleService {
    @Autowired
    private ApiLogService apiLogService;
    @Autowired
    private TaskService taskService;
    @Autowired
    private LocCacheService locCacheService;
    /**
     * @author Ryan
@@ -29,7 +61,85 @@
    @Override
    public R callback(CallAgvParams params) {
        //TODO 1. 搬运完成,修改
        //TODO 1. 搬运完成,修改站点库位状态
        if (params.getType().equals(OrderType.ORDER_OUT.type)) {
            //出库单
            if (params.getStatus().equals("RUNING")) {
                LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>().eq("loc_no", params.getOrgLoc()));
                if (Objects.isNull(locCache)) {
                    throw new CoolException("库位信息不存在!!");
                }
                if (!locCache.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
                    locCache.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
                }
            } else if (params.getStatus().equals("FINISHED")) {
                Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", params.getWrkNo()));
                if (Objects.isNull(task)) {
                    throw new CoolException("任务信息不存在!!");
                }
                if (!taskService.updateById(task)) {
                    throw new CoolException("任务状态更新失败!!");
                }
            }
        } else {
            //入库单
        }
        return null;
    }
    public HIKResultDTO sendAgvTask(HIKApiDTO haiKangApiDTO, String path) {
        HIKResultDTO result = new HIKResultDTO();
        ForwardAGVTaskDTO forwardAGVTaskParam = new ForwardAGVTaskDTO();
        forwardAGVTaskParam.setReqCode(UUID.randomUUID().toString().replace("-", ""));
        forwardAGVTaskParam.setClientCode("IWMS");
        forwardAGVTaskParam.setTaskTyp(haiKangApiDTO.getTaskType());
        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()));
        forwardAGVTaskParam.setPositionCodePath(positionCodePathsList);
        String body = JSON.toJSONString(forwardAGVTaskParam);
        String response = "";
        try {
            response = new HttpHandler.Builder()
                    .setUri(HIKApiConstant.AGV_IP)
                    .setPath(path)
                    .setJson(body)
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("code").equals(0)) {
                result.setSuccess(true);
            } else {
                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"}
        } catch (Exception e) {
            result.setMessage(e.getMessage());
            log.error("发送agv任务异常", e);
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "发送agv任务",
                        HIKApiConstant.AGV_IP + path,
                        null,
                        "127.0.0.1",
                        body,
                        response,
                        result.isSuccess()
                );
            } catch (Exception e) {
                log.error("", e);
            }
        }
        return result;
    }
}
src/main/java/com/zy/api/service/impl/KopenApiServiceImpl.java
@@ -6,6 +6,9 @@
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.api.entity.OrderParams;
import com.zy.api.entity.SyncMatParmas;
import com.zy.api.enums.MatLocType;
import com.zy.api.enums.MatType;
import com.zy.api.enums.OrderType;
import com.zy.api.enums.OrderWkType;
import com.zy.api.service.KopenApiService;
@@ -14,16 +17,20 @@
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.enums.CommonEnum;
import com.zy.asrs.enums.OrderSettle;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.asrs.utils.Utils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service("kopenApiServiceImpl")
@@ -33,6 +40,8 @@
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private MatService matService;
    /**
     * 接收下发订单信息
@@ -56,12 +65,52 @@
     *
     * @author Ryan
     * @date 2025/11/24 15:05
     * @param matnrs
     * @param params
     * @return com.core.common.R
     */
    @Override
    public R basMatupdate(List<Mat> matnrs) {
        return null;
    @Transactional(rollbackFor = Exception.class)
    public synchronized R basMatupdate(SyncMatParmas params) {
        if (Objects.isNull(params.getPro_komcode())) {
            return R.error("零件编码不能为空!!");
        }
        Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", params.getPro_komcode()));
        if (!Objects.isNull(matnr)) {
            // 订单时间
            if (Utils.isValidFormat(params.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) {
                Date date1 = Utils.getFormateDate(params.getUpdate_time());
                matnr.setUpdateTime(date1);
            }
            matnr.setMaktx(params.getPro_name());
            matnr.setSpecs(params.getPro_size());
            matnr.setWeight(Double.parseDouble(params.getPro_wet()));
            matnr.setSuppCode(params.getPro_id());
            matnr.setTagId(MatLocType.getTag(params.getPro_type()));
            matnr.setManu(params.getCompany_id());
            if (!matService.updateById(matnr)) {
                throw new CoolException("物料更新失败或无需更新!!");
            }
        } else {
            if (Objects.isNull(matnr)) {
                matnr = new Mat();
            }
            // 订单时间
            if (Utils.isValidFormat(params.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) {
                Date date1 = Utils.getFormateDate(params.getUpdate_time());
                matnr.setUpdateTime(date1);
            }
            matnr.setMaktx(params.getPro_name());
            matnr.setMatnr(params.getPro_komcode());
            matnr.setSpecs(params.getPro_size());
            matnr.setWeight(Double.parseDouble(params.getPro_wet()));
            matnr.setSuppCode(params.getPro_id());
            matnr.setTagId(MatLocType.getTag(params.getPro_type()));
            matnr.setManu(params.getCompany_id());
            if (!matService.insert(matnr)) {
                throw new CoolException("物料更新失败!!");
            }
        }
        return R.ok("保存成功!!");
    }
    /**
@@ -134,7 +183,9 @@
        newOrder.setSettle(OrderSettle.ORDER_SETTLE_HOLDING.type);
        newOrder.setStatus(CommonEnum.COMMON_ENUM_Y.type);
        // 订单时间
        newOrder.setOrderTime(DateUtils.convert(new Date(), "yyyy-MM-dd HH:mm:ss"));
        if (Utils.isValidFormat(params.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) {
            newOrder.setOrderTime(params.getUpdate_time());
        }
        // 公司ID
        newOrder.setCstmrName(params.getCompany_id());
        newOrder.setCreateTime(new Date());
@@ -144,12 +195,18 @@
        }
        if (!Objects.isNull(params.getDetails()) && !params.getDetails().isEmpty()) {
            params.getDetails().forEach(item -> {
                Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", item.getPro_komcode()));
                if (Objects.isNull(matnr)) {
                    throw new CoolException("物料编码不存在!!");
                }
                OrderDetl orderItem = new OrderDetl();
                BeanUtils.copyProperties(item, orderItem);
                BeanUtils.copyProperties(matnr, orderItem);
                orderItem.setOrderId(newOrder.getId());
                orderItem.setOrderNo(newOrder.getOrderNo());
                orderItem.setAnfme(Math.round(item.getInv_qty() * 10000) / 10000.0);
                orderItem.setMatnr(item.getPro_komcode());
                orderItem.setMatnr(matnr.getMatnr());
                orderItem.setMaktx(matnr.getMaktx());
                orderItem.setBrand(matnr.getBrand());
                orderItem.setBatch(1 + "");
                orderItem.setStandby1(item.getPro_id());
                //关联上加派工单号+零件代码+供应商代码
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -60,6 +60,18 @@
    @Resource
    private StaDescService staDescService;
    @PostMapping("/agv/collectionPakin/view")
    @ManagerAuth
    public R pdaAgvCollectionPakinView(@RequestBody CollectionPakinParams params){
        return mobileService.collectionPakinView(params);
    }
    @PostMapping("/agv/collectionPakin/auth")
    @ManagerAuth
    public R pdaAgvCollectionPakin(@RequestBody CollectionPakinParams params){
        return mobileService.collectionPakin(params, getUserId());
    }
    @PostMapping("/agv/callEmptyCar")
    @ManagerAuth
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -1,21 +1,25 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.AppAuth;
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Task;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.service.OpenService;
import com.zy.asrs.service.TaskService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.model.DetlDto;
import com.zy.common.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by vincent on 2022/4/8
@@ -33,6 +37,57 @@
    @Autowired
    private OpenService openService;
    @Autowired
    private TaskService taskService;
    @PostMapping("/agvPickupComplete/agvCallback")
    @AppAuth(memo = "AGV取货完成接口")
    public Map<String, Object> agvPickupComplete(@RequestBody AgvTaskParam agvTaskParam, HttpServletRequest request) {
        //        DecimalFormat df = new DecimalFormat("0000");
        //        String wrkNo = "Ctu"+df.format(param.getWrkNo())+date.getTime()/1000;
//        String wrkNo = agvTaskParam.getTaskCode().substring(3,7);
//        Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", Integer.parseInt(wrkNo)));
        Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", agvTaskParam.getTaskCode()));
        if (Cools.isEmpty(task)) {
            log.error("未查询到任务号对应的数据");
        }
        task.setWrkSts(0L);
        taskService.updateById(task);
        HashMap<String, Object> map = new HashMap<>();
        map.put("code","0");
        map.put("message","成功");
        map.put("reqCode", "");
        log.info("agv请求取货完成,wms任务号:"+ JSON.toJSONString(agvTaskParam));
        return map;
    }
    @PostMapping("/agvTaskComplete/agvCallback")
    @AppAuth(memo = "AGV放货完成接口")
    public Map<String, Object> agvTaskComplete(@RequestBody AgvTaskParam agvTaskParam,HttpServletRequest request) {
        HashMap<String, Object> map = new HashMap<>();
//        String wrkNo = agvTaskParam.getTaskCode().substring(3,7);
//        Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", Integer.parseInt(wrkNo)));
        Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", agvTaskParam.getTaskCode()));
        if (Cools.isEmpty(task)) {
            log.error("未查询到任务号对应的数据");
        }
        if (task.getIoType() < 100 ){
            task.setWrkSts(4L);
        }else {
            task.setWrkSts(14L);
        }
        taskService.updateById(task);
        map.put("code","0");
        map.put("message","成功");
        map.put("reqCode", "");
        return map;
    }
    @PostMapping("/order/matSync/default/v2")
//    @AppAuth(memo = "商品信息同步接口")
    public synchronized R syncMatInfoV2(@RequestHeader(required = false) String appkey,
src/main/java/com/zy/asrs/entity/BasContainer.java
@@ -60,7 +60,6 @@
        this.barcode = barcode;
    }
    public String getType$() {
        if (Cools.isEmpty(type)) {
            return "料箱";
@@ -71,6 +70,8 @@
            return ContainerType.CONTAINER_TYPE_SALVER.desc;
        } else if (type.equals(ContainerType.CONTAINER_TYPE_CAGE.type)) {
            return ContainerType.CONTAINER_TYPE_CAGE.desc;
        } else if (type.equals(ContainerType.CONTAINER_TYPE_CAR.type)) {
            return ContainerType.CONTAINER_TYPE_CAR.desc;
        }
        return null;
    }
@@ -83,7 +84,7 @@
            return CommonEnum.COMMON_ENUM_N.desc;
        } else if (flagMix.equals(CommonEnum.COMMON_ENUM_Y.type)) {
            return CommonEnum.COMMON_ENUM_Y.desc;
        }
        }
        return null;
    }
src/main/java/com/zy/asrs/entity/BasStationDetl.java
@@ -8,6 +8,8 @@
import com.zy.system.entity.User;
import java.text.SimpleDateFormat;
import java.util.Date;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import com.core.common.SpringUtils;
import com.zy.system.service.UserService;
@@ -22,6 +24,7 @@
@Data
@TableName("agv_bas_station_detl")
@Accessors(chain = true)
public class BasStationDetl implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/zy/asrs/entity/LocDetl.java
@@ -9,10 +9,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasProcessProceduresService;
import com.zy.asrs.service.BasQualityTestingService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.LocOwnerService;
import com.zy.asrs.service.*;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
@@ -282,6 +279,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 getSource$(){
        if (null == this.source){ return null; }
        switch (this.source){
src/main/java/com/zy/asrs/entity/Mat.java
@@ -7,6 +7,8 @@
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zy.api.enums.MatLocType;
import com.zy.asrs.enums.ContainerType;
import com.zy.asrs.service.BasContainerService;
import com.zy.asrs.service.TagService;
@@ -305,6 +307,7 @@
    @ApiModelProperty(value= "修改时间")
    @TableField("update_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @ApiModelProperty("库位类型")
@@ -420,12 +423,12 @@
//    );
    public String getTagId$(){
        TagService service = SpringUtils.getBean(TagService.class);
        Tag tag = service.selectById(this.tagId);
        if (!Cools.isEmpty(tag)){
            return String.valueOf(tag.getName());
        }
        return null;
//        TagService service = SpringUtils.getBean(TagService.class);
//        Tag tag = service.selectById(this.tagId);
//        if (!Cools.isEmpty(tag)){
//            return String.valueOf(tag.getName());
//        }
        return MatLocType.getTagName(this.tagId + "");
    }
    public String getLocType$(){
src/main/java/com/zy/asrs/entity/Order.java
@@ -4,9 +4,11 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.DocTypeService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderSettleService;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
@@ -473,6 +475,7 @@
        }
    }
    public String getPayTime$(){
        if (Cools.isEmpty(this.payTime)){
            return "";
src/main/java/com/zy/asrs/entity/OrderDetl.java
@@ -9,6 +9,7 @@
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasProcessProceduresService;
import com.zy.asrs.service.BasQualityTestingService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderService;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
@@ -481,6 +482,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 getInspect$(){
        if (null == this.inspect){ return null; }
        switch (this.inspect){
src/main/java/com/zy/asrs/entity/OrderDetlPakin.java
@@ -7,9 +7,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasProcessProceduresService;
import com.zy.asrs.service.BasQualityTestingService;
import com.zy.asrs.service.OrderService;
import com.zy.asrs.service.*;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
@@ -418,6 +416,20 @@
        }
    }
    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;
        }
        TagService tagService = SpringUtils.getBean(TagService.class);
        Tag tag = tagService.selectOne(new EntityWrapper<Tag>().eq("id", order.getTagId()));
        if (!Objects.isNull(tag)){
            return tag.getName();
        }
        return null;
    }
    public String getPakinPakoutStatus$(){
        if (Objects.isNull(pakinPakoutStatus)) {return  null;}
        switch (this.pakinPakoutStatus){
src/main/java/com/zy/asrs/entity/OrderDetlPakout.java
@@ -9,6 +9,7 @@
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasProcessProceduresService;
import com.zy.asrs.service.BasQualityTestingService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderService;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
@@ -461,6 +462,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 getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
src/main/java/com/zy/asrs/entity/WaitPakin.java
@@ -7,8 +7,11 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.api.enums.MatLocType;
import com.zy.asrs.service.BasProcessProceduresService;
import com.zy.asrs.service.BasQualityTestingService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.TagService;
import com.zy.common.utils.Synchro;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,6 +19,7 @@
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
@Data
@TableName("cust_wait_pakin")
@@ -246,6 +250,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 getType$(){
        if (null == this.type){ return null; }
        switch (this.type){
src/main/java/com/zy/asrs/entity/param/AgvTaskParam.java
New file
@@ -0,0 +1,14 @@
package com.zy.asrs.entity.param;
import lombok.Data;
@Data
public class AgvTaskParam {
    private String taskCode;
    private String ctnrCode;
    private String stgBinCode;
}
src/main/java/com/zy/asrs/entity/param/CollectionPakinParams.java
New file
@@ -0,0 +1,52 @@
package com.zy.asrs.entity.param;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class CollectionPakinParams {
    private String orgBarcode;
    private String tarBarcode;
    private String devNo;
    private List<CombMat> combMats;
    @Data
    public static class CombMat {
        private String orderNo;
        // 物料编号
        private String matnr = "";
        // 序列码
        private String batch = "";
        private String brand = "";
        private String standby1 = "";
        private String standby2 = "";
        private String standby3 = "";
        private String boxType1 = "1";
        private String boxType2 = "1";
        private String boxType3 = "1";
        // 物料数量
        private BigDecimal anfme;
        // 物料数量
        private BigDecimal workQty;
        // 商品名称
        private String maktx;
        // 规格
        private String specs;
        private String threeCode;
    }
}
src/main/java/com/zy/asrs/enums/TaskIOType.java
@@ -24,7 +24,7 @@
    PICK_IN("53", "53.拣料入库"),
    MERGE_IN("54", "53.并板入库"),
    MERGE_IN("54", "54.并板入库"),
    CHECK_IN("57", "57.盘点入库"),
src/main/java/com/zy/asrs/mapper/TaskMapper.java
@@ -2,6 +2,7 @@
import com.zy.asrs.entity.Task;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.WrkMast;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@@ -12,4 +13,6 @@
public interface TaskMapper extends BaseMapper<Task> {
    List<Task> selectToBeCompleteData();
    List<Task> selectToBeHistoryData();
}
src/main/java/com/zy/asrs/service/MobileService.java
@@ -148,4 +148,8 @@
     * @date 2025/12/9 15:04
     */
    void combInPub(CompleteParam combParam, Long userId);
    R collectionPakin(CollectionPakinParams params, Long userId);
    R collectionPakinView(CollectionPakinParams params);
}
src/main/java/com/zy/asrs/service/TaskService.java
@@ -2,6 +2,7 @@
import com.zy.asrs.entity.Task;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.WrkMast;
import java.util.List;
@@ -14,4 +15,6 @@
    void pickWrkMast(String workNo, Long userId);
    List<Task> selectToBeCompleteData();
    List<Task> selectToBeHistoryData();
}
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java
@@ -54,6 +54,9 @@
            } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) {
                prefix = "TP4";
                basContainer.setMixMax(2);
            } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_CAR.type)) {
                prefix = "TC5";
                basContainer.setMixMax(1);
            }
            ruleCode = prefix + StringUtils.leftPad(i + "", length, "0");
            basContainer.setType(container.getType())
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -6,6 +6,8 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.api.enums.MatLocType;
import com.zy.api.enums.MatType;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.FindLocNoAttributeVo;
@@ -589,9 +591,12 @@
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
        if (param.getBarcode().length() != 8) {
            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
        if (Objects.isNull(param.getBarcode())) {
            throw new CoolException("托盘码不能为空!!");
        }
//        if (param.getBarcode().length() != 8) {
//            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
//        }
        if (Objects.isNull(param.getType())) {
            param.setType("0");
@@ -691,43 +696,44 @@
                }
            });
            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() + "!!");
            }
            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
            if (tagIds.size() > 1) {
                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();
//            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.sync(mat);
                waitPakin.setOrderNo(detlDto.getOrderNo());   // 单据编号
                waitPakin.setType(param.getType());
                waitPakin.setOrderId(detlDto.getOrderId());
                waitPakin.setBatch(detlDto.getBatch());     // 序列码
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
@@ -1222,24 +1228,29 @@
     * @version 1.0
     */
    @Override
    public R callAgvMove(AgvCallParams params, Long userId) {
        if (Objects.isNull(params.getTarSite())) {
            throw new CoolException("目标参数不能为空!!");
        }
    @Transactional
    public synchronized R callAgvMove(AgvCallParams params, Long userId) {
        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));
        LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
                .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)) {
            throw new CoolException("请检查目标库位是否闲置中!!");
        }
        generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId);
        try {
            generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId);
        }catch (Exception e) {
            throw new CoolException(e.getMessage());
        }
        return R.ok();
    }
@@ -1290,8 +1301,35 @@
        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>()
                .eq("area_id", basAreas.getId())
                .eq("loc_no", locCaches.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)) {
            throw new CoolException("站点正在执行任务!!");
@@ -1347,28 +1385,121 @@
    }
    @Override
//    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public R collectionInCall(AgvCallParams params, Long userId) {
        if (Objects.isNull(params.getOrgSite())) {
            throw new CoolException("源站点不能为空!!");
        }
        List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", params.getBarcode()));
        if (!tasks.isEmpty()) {
            throw new CoolException("托盘码已生成任务");
        }
        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getTarSite()));
        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
                .in("loc_sts", LocStsType.LOC_STS_TYPE_O.type, LocStsType.LOC_STS_TYPE_D.type)
                .in("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                .eq("area_id", basAreas.getId()));
        if (locCaches.isEmpty()) {
            throw new CoolException("当前暂无空库位!!");
        }
        generateAgvTask("agv", locCaches.get(0), params.getOrgSite(), params.getBarcode(), userId);
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getOrgSite()));
        if (Objects.isNull(station)) {
            throw new CoolException("源站点未检索到数据!!");
        }
        generateSOEOInTask("agv", locCaches.get(0), params.getOrgSite(), station.getBarcode(), userId);
        return R.ok();
    }
    @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));
        if (Objects.isNull(basStationDetls) || basStationDetls.isEmpty()) {
            throw new CoolException("站点信息不存在!!");
        }
        List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
        if (!tasks.isEmpty()) {
            throw new CoolException("托盘已在任务执行中..");
        }
        // 获取工作号
        int workNo = commonService.getWorkNo(WorkNoType.PICK.type);
        // 保存工作档
        Task task = new Task();
        task.setWrkNo(workNo)
                .setIoTime(new Date())
                .setWrkSts(1L) // 工作状态:11.生成出库ID
                .setIoType(1) // 入出库状态: 11.库格移载
                .setTaskType("agv")
                .setIoPri(10D)
                .setLocNo(loc.getLocNo()) // 目标库位
                .setFullPlt("Y") // 满板:Y
                .setPicking("N") // 拣料
                .setExitMk("N")// 退出
                .setSourceStaNo(orgSite)
                .setEmptyMk(loc.getLocSts().equals("D") ? "Y" : "N")// 空板
                .setBarcode(barcode)// 托盘码
                .setLinkMis("N")
                .setAppeUser(userId)
                .setAppeTime(new Date())
                .setModiUser(userId)
                .setModiTime(new Date());
        if (!taskService.insert(task)) {
            throw new CoolException("保存工作档失败");
        }
        for (BasStationDetl basStationDetl : basStationDetls) {
            TaskDetl wrkDetl = new TaskDetl();
            BeanUtils.copyProperties(basStationDetl, wrkDetl);
            wrkDetl.setWrkNo(workNo)
                    .setIoTime(new Date())
                    .setOrderNo(basStationDetl.getOrderNo())
                    .setAnfme(basStationDetl.getAnfme())
                    .setZpallet(basStationDetl.getBarcode())
                    .setBatch(basStationDetl.getBatch())
                    .setMatnr(basStationDetl.getMatnr())
                    .setMaktx(basStationDetl.getMaktx())
                    .setStandby1(basStationDetl.getStandby1())
                    .setAppeUser(userId)
                    .setUnit(basStationDetl.getUnit())
                    .setModel(basStationDetl.getModel())
                    .setAppeTime(new Date())
                    .setModiUser(userId);
            //保存工作档明细
            if (!taskDetlService.insert(wrkDetl)) {
                throw new CoolException("保存工作档明细失败");
            }
        }
        // 修改目标库位状态
        if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
            loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约
            loc.setModiTime(new Date());
            loc.setModiUser(userId);
            if (!locCacheService.updateById(loc)) {
                throw new CoolException("更新目标库位状态失败");
            }
        } else {
            throw new CoolException("移转失败,目标库位状态:" + loc.getLocSts$());
        }
        // 修改目标站点信息
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite));
        if (Objects.isNull(station)) {
            throw new CoolException("站点不存在!!");
        }
        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)) {
            station.setLocSts("R"); // S.入库预约
            station.setBarcode(barcode);
            station.setModiTime(new Date());
            station.setModiUser(userId);
            if (!basStationService.updateById(station)) {
                throw new CoolException("更新目标库位状态失败");
            }
        } else {
            throw new CoolException("移转失败,目标库位状态:" + station.getLocSts());
        }
    }
    /**
@@ -1581,6 +1712,125 @@
        generateCrnInTask(waitPakins, station, param.getLocType1(), userId);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R collectionPakin(CollectionPakinParams params, Long userId) {
        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 = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getDevNo()));
        }
        if (Cools.isEmpty(basStation)){
            throw new CoolException("请输入正确的站点号");
        }
        for (CollectionPakinParams.CombMat combMat : params.getCombMats()) {
            if (combMat.getWorkQty().compareTo(BigDecimal.ZERO) == 0) {
                continue;
            }
            OrderPakin orderPakin = orderPakinService.selectByNo(combMat.getOrderNo());
            if (Cools.isEmpty(orderPakin)) {
                throw new CoolException("未找到备货入库单");
            }
            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())
            );
            if (Cools.isEmpty(basStationDetl)) {
                basStationDetl = new BasStationDetl();
                Mat mat = matService.selectByMatnr(combMat.getMatnr());
                BeanUtils.copyProperties(mat,basStationDetl);
                basStationDetl
                        .setOrderNo(orderPakin.getOrderNo())
                        .setDevNo(basStation.getDevNo())
                        .setBarcode(params.getTarBarcode())
                        .setBatch(combMat.getBatch())
                        .setStandby1(combMat.getStandby1())
                        .setAnfme(combMat.getWorkQty().doubleValue())
                ;
                if (!basStationDetlService.insert(basStationDetl)){
                    throw new CoolException("插入明细失败");
                }
            }else {
                BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty());
                basStationDetl.setAnfme(anfme.doubleValue());
                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)) {
            basStation.setBarcode(params.getTarBarcode());
            basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
            basStationService.updateById(basStation);
        }
        return R.ok();
    }
    @Transactional(rollbackFor = Exception.class)
    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())
        );
        if (Cools.isEmpty(orderDetlPakin)) {
            throw new CoolException("检索单据明细数据失败");
        }
        if (orderDetlPakin.getWorkQty() >= orderDetlPakin.getAnfme()) {
            throw new CoolException("请勿超出订单明细数量");
        }
        BigDecimal workQty = new BigDecimal(orderDetlPakin.getWorkQty().toString()).add(combMat.getWorkQty());
        orderDetlPakin.setWorkQty(workQty.doubleValue());
        if (!orderDetlPakinService.updateById(orderDetlPakin)){
            throw new CoolException("更新单据明细数据失败");
        }
        if (!orderPakin.getSettle().equals(2L)){
            orderPakin.setSettle(2L);
            if (!orderPakinService.updateById(orderPakin)){
                throw new CoolException("更新单据状态失败");
            }
        }
    }
    @Override
    public R collectionPakinView(CollectionPakinParams params) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(params.getOrgBarcode());
        if (Cools.isEmpty(wrkMast)) {
            throw new CoolException("未找到任务");
        }
        if (wrkMast.getIoType().equals(TaskIOType.ALL_OUT.type) && wrkMast.getIoType().equals(TaskIOType.PICK_OUT.type)){
            throw new CoolException("人物类型错误");
        }
        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
        if (Cools.isEmpty(wrkDetls)) {
            throw new CoolException("未找到任务明细");
        }
        return R.ok(wrkDetls);
    }
    /**
     * 生成堆垛机入库任务
     *
@@ -1703,15 +1953,16 @@
            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));
@@ -2002,11 +2253,10 @@
            throw new CoolException("保存工作档失败");
        }
        List<TaskDetl> taskDetls = new ArrayList<>();
        pakins.forEach(pakin -> {
        for (WaitPakin pakin :pakins){
            TaskDetl wrkDetl = new TaskDetl();
            BeanUtils.copyProperties(pakin, wrkDetl);
            wrkDetl.setWrkNo(workNo)
            wrkDetl.setId(null).setWrkNo(workNo)
                    .setIoTime(new Date())
                    .setOrderNo(pakin.getOrderNo())
                    .setAnfme(pakin.getAnfme())
@@ -2019,22 +2269,22 @@
                    .setModel(pakin.getModel())
                    .setAppeTime(new Date())
                    .setModiUser(userId);
            taskDetls.add(wrkDetl);
        });
            if (!taskDetlService.insert(wrkDetl)){
                throw new CoolException("保存工作档明细失败");
            }
        //保存工作档明细
        if (!taskDetlService.insertBatch(taskDetls)) {
            throw new CoolException("保存工作档明细失败");
        }
        pakins.forEach(pakin -> {
        for (WaitPakin pakin : pakins){
            pakin.setIoStatus("Y");
        });
        if (!waitPakinService.updateBatchById(pakins)) {
            throw new CoolException("更新组托信息失败");
            if (!waitPakinService.updateById(pakin)) {
                throw new CoolException("更新组托信息失败");
            }
        }
        // 修改目标库位状态
        if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
            loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约
src/main/java/com/zy/asrs/service/impl/OrderPakinServiceImpl.java
@@ -81,28 +81,28 @@
        }
        if (complete) {
            // 出库订单重新整理明细
            DocType docType = docTypeService.selectById(order.getDocType());
            if (null != docType && docType.getPakout() == 1) {
                if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) {
                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                }
                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo);
                for (WrkDetl wrkDetl : wrkDetls) {
                    OrderDetlPakin orderDetl = new OrderDetlPakin();
                    orderDetl.sync(wrkDetl);
                    orderDetl.setQty(orderDetl.getAnfme());
                    orderDetl.setOrderId(order.getId());
                    orderDetl.setOrderNo(orderNo);
                    orderDetl.setStatus(1);
                    orderDetl.setCreateTime(order.getCreateTime());
                    orderDetl.setCreateBy(order.getCreateBy());
                    orderDetl.setUpdateTime(order.getUpdateTime());
                    orderDetl.setUpdateBy(order.getUpdateBy());
                    if (!orderDetlService.insert(orderDetl)) {
                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                    }
                }
            }
//            DocType docType = docTypeService.selectById(order.getDocType());
//            if (null != docType && docType.getPakout() == 1) {
//                if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) {
//                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
//                }
//                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo);
//                for (WrkDetl wrkDetl : wrkDetls) {
//                    OrderDetlPakin orderDetl = new OrderDetlPakin();
//                    orderDetl.sync(wrkDetl);
//                    orderDetl.setQty(orderDetl.getAnfme());
//                    orderDetl.setOrderId(order.getId());
//                    orderDetl.setOrderNo(orderNo);
//                    orderDetl.setStatus(1);
//                    orderDetl.setCreateTime(order.getCreateTime());
//                    orderDetl.setCreateBy(order.getCreateBy());
//                    orderDetl.setUpdateTime(order.getUpdateTime());
//                    orderDetl.setUpdateBy(order.getUpdateBy());
//                    if (!orderDetlService.insert(orderDetl)) {
//                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
//                    }
//                }
//            }
            if (!this.updateSettle(order.getId(), 4L, null)) {
                throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败");
src/main/java/com/zy/asrs/service/impl/OrderPakoutServiceImpl.java
@@ -81,28 +81,28 @@
        }
        if (complete) {
            // 出库订单重新整理明细
            DocType docType = docTypeService.selectById(order.getDocType());
            if (null != docType && docType.getPakout() == 1) {
                if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) {
                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                }
                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo);
                for (WrkDetl wrkDetl : wrkDetls) {
                    OrderDetlPakout orderDetl = new OrderDetlPakout();
                    orderDetl.sync(wrkDetl);
                    orderDetl.setQty(orderDetl.getAnfme());
                    orderDetl.setOrderId(order.getId());
                    orderDetl.setOrderNo(orderNo);
                    orderDetl.setStatus(1);
                    orderDetl.setCreateTime(order.getCreateTime());
                    orderDetl.setCreateBy(order.getCreateBy());
                    orderDetl.setUpdateTime(order.getUpdateTime());
                    orderDetl.setUpdateBy(order.getUpdateBy());
                    if (!orderDetlService.insert(orderDetl)) {
                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                    }
                }
            }
//            DocType docType = docTypeService.selectById(order.getDocType());
//            if (null != docType && docType.getPakout() == 1) {
//                if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) {
//                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
//                }
//                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo);
//                for (WrkDetl wrkDetl : wrkDetls) {
//                    OrderDetlPakout orderDetl = new OrderDetlPakout();
//                    orderDetl.sync(wrkDetl);
//                    orderDetl.setQty(orderDetl.getAnfme());
//                    orderDetl.setOrderId(order.getId());
//                    orderDetl.setOrderNo(orderNo);
//                    orderDetl.setStatus(1);
//                    orderDetl.setCreateTime(order.getCreateTime());
//                    orderDetl.setCreateBy(order.getCreateBy());
//                    orderDetl.setUpdateTime(order.getUpdateTime());
//                    orderDetl.setUpdateBy(order.getUpdateBy());
//                    if (!orderDetlService.insert(orderDetl)) {
//                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
//                    }
//                }
//            }
            if (!this.updateSettle(order.getId(), 4L, null)) {
                throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败");
src/main/java/com/zy/asrs/service/impl/TaskServiceImpl.java
@@ -142,6 +142,11 @@
        return this.baseMapper.selectToBeCompleteData();
    }
    @Override
    public List<Task> selectToBeHistoryData() {
        return this.baseMapper.selectToBeHistoryData();
    }
    @Override
    @Transactional
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -410,8 +410,8 @@
        // 判断是否是盘点单
        String orderNo = taskDto.getLocDtos().get(0).getOrderNo();
//        OrderPakout orderPakout = orderPakOutService.selectByNo(orderNo);
        CheckOrder checkOrder = checkOrderService.selectOne(new EntityWrapper<CheckOrder>().eq("order_no", orderNo));
        int ioType = checkOrder.getDocType() == 8 ? 107 : (taskDto.isAll() ? 101 : 103);
        int ioType =  (taskDto.isAll() ? 101 : 103);
        if(ioType == 101){
            boolean DiffQty = taskDto.getLocDtos().stream().allMatch(locDto ->
                    locDetlService.selectOne(new EntityWrapper<LocDetl>()
src/main/java/com/zy/asrs/task/WorkLogScheduler.java
@@ -1,6 +1,8 @@
package com.zy.asrs.task;
import com.zy.asrs.entity.Task;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.TaskService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.WorkLogHandler;
@@ -23,6 +25,10 @@
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private TaskService taskService;
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute(){
        List<WrkMast> wrkMasts = wrkMastService.selectToBeHistoryData();
@@ -37,6 +43,20 @@
        }
    }
    @Scheduled(cron = "0/3 * * * * ? ")
    private void executeTask(){
        List<Task> taskList = taskService.selectToBeHistoryData();
        if (taskList.isEmpty()) {
            return;
        }
        for (Task task : taskList) {
            ReturnT<String> result = workLogHandler.AgvStart(task);
            if (!result.isSuccess()) {
                log.error("工作档[workNo={}]历史档处理失败", task.getWrkNo());
            }
        }
    }
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -2,14 +2,13 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.WrkDetl;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.OrderInAndOutUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -39,6 +38,14 @@
    private WaitPakinLogService waitPakinLogService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private TaskService taskService;
    @Autowired
    private TaskLogService taskLogService;
    @Autowired
    private TaskDetlService taskDetlService;
    @Autowired
    private TaskDetlLogService taskDetlLogService;
    @Transactional
    public ReturnT<String> start(WrkMast wrkMast) {
@@ -125,4 +132,98 @@
        return SUCCESS;
    }
    public ReturnT<String> AgvStart(Task task) {
        try {
            List<TaskDetl> taskDetls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
            // 修改订单状态 作业中 ===>> 已完成
            if (!Cools.isEmpty(taskDetls)) {
                Iterator<TaskDetl> iterator = taskDetls.iterator();
                while (iterator.hasNext()) {
                    TaskDetl taskDetl = iterator.next();
                    if (!Cools.isEmpty(taskDetl.getOrderNo())) {
//                        orderService.checkComplete(wrkDetl.getOrderNo());
                        if (task.getIoType() ==  1 || task.getIoType() == 8 ||  task.getIoType() == 54 ||  task.getIoType() == 104){
                            OrderInAndOutUtil.checkComplete(Boolean.TRUE,taskDetl.getOrderNo());
                        } else {
                            OrderInAndOutUtil.checkComplete(Boolean.FALSE,taskDetl.getOrderNo());
                        }
                        iterator.remove();
                    }
                }
            }
            // 入库 --------------------------------------------------------------------------------
            if (task.getWrkSts() == 5) {
                // 全板入库
                if (task.getIoType() == 1) {
                    // 入库通知单
                    if (!Cools.isEmpty(task.getBarcode())) {
                        // 保存入库通知档历史档
                        if (!waitPakinLogService.save(task.getBarcode())) {
//                            exceptionHandle("保存入库通知档历史档[workNo={0}]失败", wrkMast.getWrkNo());
                        }
                        // 删除入库通知档
                        if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", task.getBarcode()))) {
//                            exceptionHandle("删除入库通知档[workNo={0}]失败", wrkMast.getWrkNo());
                        }
                    }
//                    // 手动入库生成单据 【 上报三方平台 】
//                    if (!Cools.isEmpty(wrkDetls)) {
//                        if (!orderService.saveHandlerOrder(Boolean.TRUE, wrkMast, wrkDetls)) {
//                            exceptionHandle("生成手动入库单据[workNo={0}]失败", wrkMast.getWrkNo());
//                        }
//                    }
                    // 拣料再入库
                } else if (task.getIoType() == 53) {
//                    if (!Cools.isEmpty(wrkDetls)) {
//                        if (!orderService.saveHandlerOrder(Boolean.FALSE, wrkMast, wrkDetls)) {
//                            exceptionHandle("生成手动出库单据[workNo={0}]失败", wrkMast.getWrkNo());
//                        }
//                    }
                }
                // 出库 --------------------------------------------------------------------------------
            } else if (task.getWrkSts() == 15) {
//                if (!Cools.isEmpty(wrkDetls)) {
//                    if (!orderService.saveHandlerOrder(Boolean.FALSE, wrkMast, wrkDetls)) {
//                        exceptionHandle("生成手动出库单据[workNo={0}]失败", wrkMast.getWrkNo());
//                    }
//                }
            }
            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);
            // 保存工作主档历史档
            if (!taskLogService.insert(taskLog)) {
                exceptionHandle("保存AGV工作历史档[workNo={0}]失败", task.getWrkNo());
            }
            // 删除工作主档
            if (!taskService.deleteById(task)) {
                exceptionHandle("删除工作主档[workNo={0}]失败", task.getWrkNo());
            }
        } catch (Exception e) {
            log.error("fail", e);
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        }
        return SUCCESS;
    }
}
src/main/java/com/zy/asrs/utils/Utils.java
@@ -16,10 +16,13 @@
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
 * Created by vincent on 2020/8/27
@@ -49,6 +52,26 @@
        }
    }
    public static boolean isValidFormat(String dateStr, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setLenient(false); // 严格模式,必须完全匹配格式
        try {
            sdf.parse(dateStr);
            return true;
        } catch (ParseException e) {
            return false;
        }
    }
    public static Date getFormateDate(String datestr) {
        //字符串转日期
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(datestr, dateTimeFormatter);
        Instant instant = parse.atZone(ZoneId.systemDefault()).toInstant();
        Date date = Date.from(instant);
        return date;
    }
    /**
     * 判断是否为深库位
     */
src/main/java/stationRela.sql
File was deleted
src/main/resources/application-dev.yml
@@ -1,5 +1,5 @@
server:
  port: 8080
  port: 8081
  servlet:
    context-path: /@pom.build.finalName@
@@ -30,7 +30,7 @@
  #  global-config:
  #    field-strategy: 0
  configuration:
    #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true
    cache-enabled: true
    call-setters-on-nulls: true
@@ -47,7 +47,7 @@
#License相关配置
license:
  subject: integrationasrs
  subject: jsxsasrs
  publicAlias: publicCert
  storePass: public_zhongyang_123456789
  licensePath: license.lic
src/main/resources/mapper/TaskMapper.xml
@@ -12,4 +12,11 @@
        select * from agv_task where ((wrk_sts = 4 Or wrk_sts = 14 ) and io_type != 103 and io_type != 104 and io_type != 107 ) or (wrk_sts = 2 and io_type=6) order by upd_mk,error_time,io_time,wrk_no
    </select>
    <select id="selectToBeHistoryData" resultType="com.zy.asrs.entity.Task">
        select * from agv_task
        where wrk_sts=5 or wrk_sts=15
        order by io_time,wrk_no asc
    </select>
</mapper>
src/main/webapp/static/js/common.js
@@ -225,11 +225,10 @@
    ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true}
    ,{field: 'anfme', align: 'center',title: '数量', hide: false}
    ,{field: 'specs', align: 'center',title: '规格', hide: false}
    ,{field: 'model', align: 'center',title: '代码', hide: true}
    ,{field: 'color', align: 'center',title: '颜色', hide: true}
    ,{field: 'brand', align: 'center',title: '品牌', hide: true}
    ,{field: 'unit', align: 'center',title: '单位', hide: false}
    ,{field: 'batch', align: 'center',title: '批号', sort:true}
    ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
    ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
    ,{field: 'length', align: 'center',title: '重量', hide: false}
    ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
    ,{field: 'frozen$', align: 'center',title: '冻结否',hide: true,
        templet: function(d) {
            // 根据条件判断字体颜色
@@ -247,14 +246,19 @@
    ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
    ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
    ,{field: 'batch', align: 'center',title: '批号', sort:true}
    ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
    ,{field: 'batch', align: 'center',title: '批号', hide: true}
    ,{field: 'anfme', align: 'center',title: '数量', hide: false}
    ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false}
    ,{field: 'specs', align: 'center',title: '规格', hide: false}
    ,{field: 'length', align: 'center',title: '重量', hide: false}
    ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
    ,{field: 'modiTime$', align: 'center',title: '更新时间', hide: false}
    ,{field: 'supp', align: 'center',title: '供应商', hide: true}
    ,{field: 'specs', align: 'center',title: '规格', hide: true}
    ,{field: 'model', align: 'center',title: '代码', hide: true}
    ,{field: 'color', align: 'center',title: '颜色', hide: true}
    ,{field: 'brand', align: 'center',title: '品牌', hide: true}
    ,{field: 'unit', align: 'center',title: '单位', hide: false}
    ,{field: 'unit', align: 'center',title: '单位', hide: true}
    ,{field: 'price', align: 'center',title: '单价', hide: true}
    ,{field: 'sku', align: 'center',title: 'sku', hide: true}
    ,{field: 'units', align: 'center',title: '单位量', hide: true}
@@ -265,9 +269,6 @@
    ,{field: 'itemNum', align: 'center',title: '品项数', hide: true}
    ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true}
    ,{field: 'weight', align: 'center',title: '单箱净重', hide: true}
    ,{field: 'length', align: 'center',title: '单箱毛重', hide: true}
    ,{field: 'volume', align: 'center',title: '单箱体积', hide: true}
    ,{field: 'supp', align: 'center',title: '供应商', hide: true}
    ,{field: 'beBatch$', align: 'center',title: '是否批次', hide: true}
    ,{field: 'deadTime', align: 'center',title: '保质期', hide: true}
    ,{field: 'deadWarn', align: 'center',title: '预警天数', hide: true}
src/main/webapp/static/js/locCache/locCache.js
@@ -151,7 +151,6 @@
    // 初始化保存
    form.on('submit(initDo)', function (data) {
        console.log(data.field)
        $.ajax({
            url: baseUrl + "/locCache/init/auth",
            headers: {'token': localStorage.getItem('token')},
src/main/webapp/static/js/order/order.js
@@ -41,14 +41,26 @@
        page: true,
        cellMinWidth: 100,
        cols: [[
            {type: 'numbers'},
            {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'},
            {field: 'docType$', align: 'center', title: '类型',  minWidth: 160, width: 160},
            {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160},
            {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200},
            {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl',  minWidth: 160, width: 160},
            {field: 'memo', align: 'center',title: '备注', hide: true},
            {align: 'center', title: '操作', toolbar: '#operate', width: 180}
            // {type: 'numbers'},
            // {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'},
            // {field: 'docType$', align: 'center', title: '类型',  minWidth: 160, width: 160},
            // {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160},
            // {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200},
            // {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl',  minWidth: 160, width: 160},
            // {field: 'memo', align: 'center',title: '备注', hide: true},
            // {align: 'center', title: '操作', toolbar: '#operate', width: 180}
            { type: 'numbers' },
            { field: 'orderNo', title: '单据编号', templet: '#orderNoTpl' , minWidth: 180},
            { field: 'defNumber', align: 'center', title: '流水号', minWidth: 160, width: 160 },
            { field: 'number', align: 'center', title: '派工单号', minWidth: 160, width: 160 },
            { field: 'cstmrName', align: 'center', title: '公司ID', minWidth: 160, width: 160 },
            { field: 'itemName', align: 'center', title: '箱号', minWidth: 160, width: 160 },
            { field: 'docType$', align: 'center', title: '类型', minWidth: 130},
            { field: 'orderTime', align: 'center', title: '派工时间', minWidth: 160, width: 160 },
            { field: 'createTime$', title: '创建时间', minWidth: 160, width: 160 },
            { field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 100, width: 100 },
            { align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160 },
            { align: 'center', title: '操作', toolbar: '#operate', width: 180 }
        ]],
        request: {
            pageName: 'curr',
@@ -120,15 +132,27 @@
                        height: '450px;',
                        cellMinWidth: 100,
                        cols: [[
                            // { type: 'numbers' },
                            // { field: 'matnr', title: '商品编码', width: 160 },
                            // { field: 'maktx', title: '商品名称', width: 160 },
                            // { field: 'standby1', title: '供应商编码', width: 160 },
                            // { field: 'batch', title: '批号' },
                            // { field: 'anfme', title: '待完结数量' },
                            // { field: 'workQty', title: '待上报数量' },
                            // { field: 'qty', title: '已完结数量', style: 'font-weight: bold' },
                            // { field: 'specs', title: '规格' }
                            { type: 'numbers' },
                            { field: 'matnr', title: '商品编码', width: 160 },
                            { field: 'maktx', title: '商品名称', width: 160 },
                            { field: 'standby1', title: '供应商编码', width: 160 },
                            { field: 'batch', title: '批号' },
                            { field: 'anfme', title: '待完结数量' },
                            { field: 'workQty', title: '待上报数量' },
                            { field: 'qty', title: '已完结数量', style: 'font-weight: bold' },
                            { field: 'specs', title: '规格' }
                            {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
                            ,{field: 'maktx', 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: 'anfme', title: '数量', align: 'center',hide: false}
                            ,{ field: 'workQty', title: '作业数量', align: 'center',hide: false }
                            ,{ field: 'qty', title: '完成数量' , align: 'center',hide: false}
                            ,{field: 'length', align: 'center',title: '重量', hide: false }
                            ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
                        ]],
                        request: {
                            pageName: 'curr',
@@ -228,6 +252,7 @@
                        {type: 'numbers', title: '#'},
                        {field: 'matnr', title: '商品编码', width: 160},
                        {field: 'maktx', title: '商品名称', width: 200},
                        {field: 'standby1', title: '供应商代码', edit: true},
                        {field: 'batch', title: '批号', edit: true},
                        {field: 'specs', title: '规格'},
                        {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
src/main/webapp/static/js/orderPakin/order.js
@@ -42,12 +42,16 @@
        cellMinWidth: 100,
        cols: [[
            { type: 'numbers' },
            { field: 'orderNo', title: '单据编号', templet: '#orderNoTpl' },
            { field: 'docType$', align: 'center', title: '类型', minWidth: 160, width: 160 },
            { field: 'orderNo', title: '单据编号', templet: '#orderNoTpl' , minWidth: 180},
            { field: 'defNumber', align: 'center', title: '流水号', minWidth: 160, width: 160 },
            { field: 'number', align: 'center', title: '派工单号', minWidth: 160, width: 160 },
            { field: 'cstmrName', align: 'center', title: '公司ID', minWidth: 160, width: 160 },
            { field: 'itemName', align: 'center', title: '箱号', minWidth: 160, width: 160 },
            { field: 'docType$', align: 'center', title: '类型', minWidth: 130},
            { field: 'orderTime', align: 'center', title: '派工时间', minWidth: 160, width: 160 },
            { field: 'createTime$', title: '创建时间', minWidth: 160, width: 160 },
            { field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 100, width: 100 },
            { align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160 },
            { field: 'createTime$', title: '创建时间', minWidth: 200, width: 200 },
            { field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160 },
            { field: 'memo', align: 'center', title: '备注', hide: true },
            { align: 'center', title: '操作', toolbar: '#operate', width: 180 }
        ]],
        request: {
@@ -117,14 +121,17 @@
                        cellMinWidth: 100,
                        cols: [[
                            { type: 'numbers' },
                            { field: 'matnr', title: '商品编码', width: 160 },
                            { field: 'maktx', title: '商品名称', width: 160 },
                            { field: 'standby1', title: '供应商编码', width: 160 },
                            { field: 'batch', title: '批号' },
                            { field: 'anfme', title: '数量' },
                            { field: 'workQty', title: '作业数量' },
                            { field: 'qty', title: '完成数量', style: 'font-weight: bold' },
                            { field: 'specs', title: '规格' }
                            {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
                            ,{field: 'maktx', 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: 'anfme', title: '数量', align: 'center',hide: false}
                            ,{ field: 'workQty', title: '作业数量', align: 'center',hide: false }
                            ,{ field: 'qty', title: '完成数量' , align: 'center',hide: false}
                            ,{field: 'length', align: 'center',title: '重量', hide: false }
                            ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
                        ]],
                        request: {
                            pageName: 'curr',
src/main/webapp/static/js/orderPakout/order.js
@@ -41,15 +41,18 @@
        page: true,
        cellMinWidth: 100,
        cols: [[
            {type: 'numbers'},
            {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'},
            {field: 'itemName$', align: 'center', title: '出库区域',  minWidth: 160, width: 160},
            {field: 'docType$', align: 'center', title: '类型',  minWidth: 160, width: 160},
            {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160},
            {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200},
            {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl',  minWidth: 160, width: 160},
            {field: 'memo', align: 'center',title: '备注', hide: true},
            {align: 'center', title: '操作', toolbar: '#operate'}
            { type: 'numbers' },
            { field: 'orderNo', title: '单据编号', templet: '#orderNoTpl' , minWidth: 180},
            { field: 'defNumber', align: 'center', title: '流水号', minWidth: 160, width: 160 },
            { field: 'number', align: 'center', title: '派工单号', minWidth: 160, width: 160 },
            { field: 'cstmrName', align: 'center', title: '公司ID', minWidth: 160, width: 160 },
            { field: 'itemName', align: 'center', title: '箱号', minWidth: 160, width: 160 },
            { field: 'docType$', align: 'center', title: '类型', minWidth: 130},
            { field: 'orderTime', align: 'center', title: '派工时间', minWidth: 160, width: 160 },
            { field: 'createTime$', title: '创建时间', minWidth: 160, width: 160 },
            { field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 100, width: 100 },
            { align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160 },
            { align: 'center', title: '操作', toolbar: '#operate', width: 180 }
        ]],
        request: {
            pageName: 'curr',
@@ -116,17 +119,22 @@
                        page: true,
                        height: '450px;',
                        cellMinWidth: 100,
                        cols: [[
                            { type: 'numbers' },
                            { field: 'matnr', title: '商品编码', width: 160 },
                            { field: 'maktx', title: '商品名称', width: 160 },
                            { field: 'standby1', title: '供应商编码', width: 160 },
                            { field: 'batch', title: '批号' },
                            { field: 'anfme', title: '数量' },
                            { field: 'workQty', title: '作业数量' },
                            { field: 'qty', title: '完成数量', style: 'font-weight: bold' },
                            { field: 'specs', title: '规格' }
                        ]],
                         cols: [
                        //     [
                        //     { type: 'numbers' },
                        //     { field: 'matnr', title: '商品编码', width: 160 },
                        //     { field: 'maktx', title: '商品名称', width: 160 },
                        //     { field: 'standby1', title: '供应商编码', width: 160 },
                        //     { field: 'threeCode', title: 'BS Code', width: 160 },
                        //     { field: 'tag$', title: '物料种类' },
                        //     { field: 'anfme', title: '数量' },
                        //     { field: 'workQty', title: '作业数量' },
                        //     { field: 'qty', title: '完成数量', style: 'font-weight: bold' },
                        //     { field: 'specs', title: '规格' }
                        // ]
                            getCol()
                        ],
                        request: {
                            pageName: 'curr',
                            pageSize: 'limit'
@@ -151,6 +159,12 @@
            });
        }
    });
    function getCol() {
        var cols = [];
        cols.push.apply(cols, cacheCols);
        return cols;
    }
    // 显示表单弹窗
    function showEditModel(expTpe) {
@@ -246,19 +260,22 @@
                    page: true,
                    height: '350px;',
                    cellMinWidth: 100,
                    cols: [[
                        {type: 'numbers', title: '#'},
                        {field: 'matnr', title: '零件代码', width: 160},
                        {field: 'maktx', title: '零件名称', width: 200},
                        // {field: 'batch', title: '批号', edit: true},
                        {field: 'standby1', title: '供应商代码', edit: true},
                        {field: 'specs', title: '规格'},
                        {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                        {field: 'workQty', title: '作业数量',  minWidth: 100, width: 100},
                        // {field: 'unit', title: '单位', width: 80},
                        {field: 'memo', title: '备注' , edit: true},
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                    ]],
                    cols: [
                        getCol()
                    //     [
                    //     {type: 'numbers', title: '#'},
                    //     {field: 'matnr', title: '零件代码', width: 160},
                    //     {field: 'maktx', title: '零件名称', width: 200},
                    //     // {field: 'batch', title: '批号', edit: true},
                    //     {field: 'standby1', title: '供应商代码', edit: true},
                    //     {field: 'specs', title: '规格'},
                    //     {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                    //     {field: 'workQty', title: '作业数量',  minWidth: 100, width: 100},
                    //     // {field: 'unit', title: '单位', width: 80},
                    //     {field: 'memo', title: '备注' , edit: true},
                    //     {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                    // ]
                    ],
                    done: function (res) {
                        $(layero).find('.layui-table-view').css('margin', '0');
                    },
src/main/webapp/views/basContainer/basContainer.html
@@ -88,6 +88,7 @@
                            <option value="12">料箱</option>
                            <option value="13">笼框</option>
                            <option value="14">托盘</option>
                            <option value="3">台车</option>
                        </select>
                    </div>
                </div>
@@ -135,6 +136,7 @@
                    <option value="12">料箱</option>
                    <option value="13">笼框</option>
                    <option value="14">托盘</option>
                    <option value="3">台车</option>
                </select>
            </div>
        </div>
src/main/webapp/views/locCache/locDetail.html
@@ -33,7 +33,7 @@
        var cols = [
            {field: 'locNo', align: 'center', title: '库位号'}
        ];
        cols.push.apply(cols, cacheCols);
        cols.push.apply(cols, detlCols);
        return cols;
    }
src/main/webapp/views/taskLog/taskLog.html
@@ -89,7 +89,7 @@
<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/wrkMastLog/wrkMastLog.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/taskLog/taskLog.js" charset="utf-8"></script>
<iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe>