自动化立体仓库 - WMS系统
skyouc
16 小时以前 de8a641769b80abca23a344b521bcdfe0dbca31f
入库流程功能优化
5个文件已删除
11个文件已修改
325 ■■■■■ 已修改文件
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/entity/CallAgvParams.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 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasContainer.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/OrderDetlPakin.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/enums/TaskIOType.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/stationRela.sql 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/orderPakin/order.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/basContainer/basContainer.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/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/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
@@ -14,14 +14,19 @@
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.service.impl.MatServiceImpl;
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 javax.swing.text.DateFormatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -33,6 +38,8 @@
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private MatService matService;
    /**
     * 接收下发订单信息
@@ -134,7 +141,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 +153,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/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/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/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/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
@@ -589,9 +589,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,18 +694,19 @@
                }
            });
            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() + "!!");
            }
            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("组托物料类型不一致,只有相同的物料分类才可以组托!!");
            }
            //还可以放入多少种物料
            Integer suplus = container.getMixMax();
@@ -711,22 +715,21 @@
                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.setOrderId(detlDto.getOrderId());
                waitPakin.setBatch(detlDto.getBatch());     // 序列码
@@ -1223,16 +1226,13 @@
     */
    @Override
    public R callAgvMove(AgvCallParams params, Long userId) {
        if (Objects.isNull(params.getTarSite())) {
            throw new CoolException("目标参数不能为空!!");
        }
        if (Objects.isNull(params.getOrgSite())) {
            throw new CoolException("源站点不能为空!!");
        }
        LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
                .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)) {
src/main/java/com/zy/asrs/utils/Utils.java
@@ -16,6 +16,8 @@
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -49,6 +51,17 @@
        }
    }
    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;
        }
    }
    /**
     * 判断是否为深库位
     */
src/main/java/stationRela.sql
File was deleted
src/main/webapp/static/js/orderPakin/order.js
@@ -120,8 +120,9 @@
                            { field: 'matnr', title: '商品编码', width: 160 },
                            { field: 'maktx', title: '商品名称', width: 160 },
                            { field: 'standby1', title: '供应商编码', width: 160 },
                            { field: 'batch', title: '批号' },
                            // { field: 'batch', title: '批号' },
                            { field: 'anfme', title: '数量' },
                            { field: 'tag$', title: '物料种类' },
                            { field: 'workQty', title: '作业数量' },
                            { field: 'qty', title: '完成数量', style: 'font-weight: bold' },
                            { field: 'specs', title: '规格' }
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>