自动化立体仓库 - WMS系统
lty
2025-03-14 83d6be1ca1ee0197993e76e46d4e99e805c057b0
#初始化
14个文件已修改
2个文件已添加
701 ■■■■■ 已修改文件
pom.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/LocMastController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/StaDescController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/WorkController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/RowLastnoType.java 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/RowLastnoTypeService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/DetlDto.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/TaskDto.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -119,7 +119,7 @@
    <build>
        <finalName>xgmFlwms</finalName>
        <finalName>tzglasrs</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
src/main/java/com/zy/asrs/controller/LocMastController.java
@@ -176,7 +176,7 @@
    @ManagerAuth(memo = "初始化库位")
//    @Transactional
    public R init(LocMastInitParam param) {
        List<LocMast> list = new ArrayList<>();
       List<LocMast> list = new ArrayList<>();
        for (int r=param.getStartRow(); r<=param.getEndRow(); r++){
            for (int b=param.getStartBay(); b<=param.getEndBay(); b++) {
                for (int l=param.getStartLev(); l<=param.getEndLev(); l++) {
src/main/java/com/zy/asrs/controller/StaDescController.java
@@ -18,6 +18,8 @@
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -25,6 +27,7 @@
@RestController
public class StaDescController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(StaDescController.class);
    @Autowired
    private StaDescService staDescService;
@@ -34,7 +37,6 @@
    @RequestMapping(value = "/staDesc/init/auth")
    @ManagerAuth(memo = "初始化站点路径")
    public R init(StaDescInitParam param) {
        SqlSession sqlSession = null;
        try{
            if (param.getTypeDesc()==1){
                staDescService.delete(new EntityWrapper<>());
@@ -42,7 +44,7 @@
            String[] startStaList = param.getStartStaList().split(";");
            String[] endStaList = param.getEndStaList().split(";");
            List<StaDesc> staDescList = new ArrayList<>();
            sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
            SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
            StaDescMapper sqlSessionMapper = sqlSession.getMapper(StaDescMapper.class);
            for (String startSta : startStaList){
                for (String endSta : endStaList){
@@ -64,24 +66,28 @@
                        staDesc.setModiTime(new Date());
                        staDesc.setAppeUser(getUserId());
                        staDesc.setAppeTime(new Date());
                        sqlSessionMapper.insert(staDesc);
//                        staDescList.add(staDesc);
                        sqlSessionMapper.insert(staDesc);
                    }
                }
            }
                sqlSession.flushStatements();
                sqlSession.clearCache();
            try{
                sqlSession.commit();
                sqlSession.close();
            }catch (Exception e){
                log.error("初始化站点路径异常===>sql异常:{}",e.getMessage());
            }
//            staDescService.insertBatch(staDescList);
        }catch (Exception e){
            return R.error(e.getMessage());
        }finally {
            sqlSession.close();
            log.error("初始化站点路径异常:{}",e.getMessage());
            return R.error("初始化站点路径异常:"+e.getMessage());
        }
        return R.ok("ok1").add("ok2");
    }
    @RequestMapping(value = "/staDesc/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
src/main/java/com/zy/asrs/controller/WorkController.java
@@ -58,13 +58,13 @@
            map.put("desc", siteId + "(全板出库口)");
            result.add(map);
        }
//        List<Integer> pickOutSite = basDevpService.getAvailableOutSite(103);
//        for (Integer siteId : pickOutSite) {
//            Map<String, Object> map = new HashMap<>();
//            map.put("siteId", siteId);
//            map.put("desc", siteId + "(拣料出库口)");
//            result.add(map);
//        }
        List<Integer> pickOutSite = basDevpService.getAvailableOutSite(103);
        for (Integer siteId : pickOutSite) {
            Map<String, Object> map = new HashMap<>();
            map.put("siteId", siteId);
            map.put("desc", siteId + "(拣料出库口)");
            result.add(map);
        }
        return R.ok().add(result);
    }
src/main/java/com/zy/asrs/entity/RowLastnoType.java
New file
@@ -0,0 +1,157 @@
package com.zy.asrs.entity;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.SpringUtils;
import com.zy.system.service.UserService;
import com.zy.system.entity.User;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@Data
@TableName("asr_row_lastno_type")
public class RowLastnoType implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 类别
     */
    @ApiModelProperty(value= "类别")
    @TableId(value = "id", type = IdType.INPUT)
    private Integer id;
    /**
     * 规则简述
     */
    @ApiModelProperty(value= "规则简述")
    @TableField("type_name")
    private String typeName;
    /**
     * 补充
     */
    @ApiModelProperty(value= "补充")
    private String memo;
    /**
     * 创建人员
     */
    @ApiModelProperty(value= "创建人员")
    @TableField("modi_user")
    private Long modiUser;
    /**
     * 创建时间
     */
    @ApiModelProperty(value= "创建时间")
    @TableField("modi_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date modiTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    @TableField("appe_user")
    private Long appeUser;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @TableField("appe_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date appeTime;
    /**
     * 库型 1: 标准堆垛机库  2: 平库  3: 穿梭板  4: 四向车  5: AGV  0: 未知
     */
    @ApiModelProperty(value= "库型 1: 标准堆垛机库  2: 平库  3: 穿梭板  4: 四向车  5: AGV  0: 未知  ")
    private Integer type;
    public RowLastnoType() {}
    public RowLastnoType(Integer id,String typeName,String memo,Long modiUser,Date modiTime,Long appeUser,Date appeTime,Integer type) {
        this.id = id;
        this.typeName = typeName;
        this.memo = memo;
        this.modiUser = modiUser;
        this.modiTime = modiTime;
        this.appeUser = appeUser;
        this.appeTime = appeTime;
        this.type = type;
    }
//    RowLastnoType rowLastnoType = new RowLastnoType(
//            null,    // 类别[非空]
//            null,    // 规则简述
//            null,    // 补充
//            null,    // 创建人员
//            null,    // 创建时间
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 库型
//    );
    public String getModiUser$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.modiUser);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public String getModiTime$(){
        if (Cools.isEmpty(this.modiTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime);
    }
    public String getAppeUser$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.appeUser);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public String getAppeTime$(){
        if (Cools.isEmpty(this.appeTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime);
    }
    public String getType$(){
        if (null == this.type){ return null; }
        switch (this.type){
            case 0:
                return "标准堆垛机库";
            case 1:
                return "平库";
            case 2:
                return "穿梭板";
            case 3:
                return "四向车";
            case 4:
                return "AGV";
            case 5:
                return "未知";
            default:
                return String.valueOf(this.type);
        }
    }
}
src/main/java/com/zy/asrs/service/RowLastnoTypeService.java
New file
@@ -0,0 +1,8 @@
package com.zy.asrs.service;
import com.zy.asrs.entity.RowLastnoType;
import com.baomidou.mybatisplus.service.IService;
public interface RowLastnoTypeService extends IService<RowLastnoType> {
}
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -105,94 +105,94 @@
        Date now = new Date();
        // 无单组托
//        if (Cools.isEmpty(param.getOrderNo())) {
//
//            // 生成入库通知档
//            List<DetlDto> detlDtos = new ArrayList<>();
//            param.getCombMats().forEach(elem -> {
//                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme());
//                if (DetlDto.has(detlDtos, detlDto)) {
//                    DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch());
//                    assert one != null;
//                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
//                } else {
//                    detlDtos.add(detlDto);
//                }
//            });
//
//
//            for (DetlDto detlDto : detlDtos) {
//                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
//                if (Cools.isEmpty(mat)) {
//                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
//                }
//                WaitPakin waitPakin = new WaitPakin();
//                waitPakin.sync(mat);
//                waitPakin.setBatch(detlDto.getBatch());
//                waitPakin.setZpallet(param.getBarcode());   // 托盘码
//                waitPakin.setIoStatus("N");     // 入出状态
//                waitPakin.setAnfme(detlDto.getAnfme());  // 数量
//                waitPakin.setStatus("Y");    // 状态
//                waitPakin.setAppeUser(userId);
//                waitPakin.setAppeTime(now);
//                waitPakin.setModiUser(userId);
//                waitPakin.setModiTime(now);
//                if (!waitPakinService.insert(waitPakin)) {
//                    throw new CoolException("保存入库通知档失败");
//                }
//            }
//            // 关联组托
//        } else {
        if (Cools.isEmpty(param.getOrderNo())) {
        Order order = orderService.selectOne(new EntityWrapper<Order>().eq("temp1", param.getOrderNo()));
        if (Cools.isEmpty(order) || order.getSettle() > 2) {
            throw new CoolException("单据编号已过期");
        }
        // 生成入库通知档
        List<DetlDto> detlDtos = new ArrayList<>();
        param.getCombMats().forEach(elem -> {
            // 生成入库通知档
            List<DetlDto> detlDtos = new ArrayList<>();
            param.getCombMats().forEach(elem -> {
                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme());
                if (DetlDto.has(detlDtos, detlDto)) {
                    DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch());
                    assert one != null;
                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
                } else {
                    detlDtos.add(detlDto);
                }
            });
            // 订单明细数量校验
            //OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getAnfme() );
            OrderDetl orderDetl = orderDetlService.selectById(elem.getDetlId());
            if (elem.getAnfme() > orderDetl.getEnableQty()) {
                throw new CoolException(orderDetl.getMatnr() + "入库数量不合法");
            for (DetlDto detlDto : detlDtos) {
                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                if (Cools.isEmpty(mat)) {
                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
                }
                WaitPakin waitPakin = new WaitPakin();
                waitPakin.sync(mat);
                waitPakin.setBatch(detlDto.getBatch());
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme());  // 数量
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(now);
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(now);
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存入库通知档失败");
                }
            }
            // 修改订单作业数量
            if (!orderDetlService.increaseWorkQty(orderDetl, elem.getAnfme())) {
                throw new CoolException("修改单据作业数量失败");
            }
            // 关联组托
        } else {
            Mat mat = matService.selectByMatnr(orderDetl.getMatnr());
            if (Cools.isEmpty(mat)) {
                throw new CoolException(orderDetl.getMatnr() + "商品档案不存在");
            }
            WaitPakin waitPakin = new WaitPakin();
            waitPakin.sync(mat);
            waitPakin.setOrderNo(order.getOrderNo());   // 单据编号
            waitPakin.setBatch(orderDetl.getBatch());     // 序列码
            waitPakin.setZpallet(param.getBarcode());   // 托盘码
            waitPakin.setIoStatus("N");     // 入出状态
            waitPakin.setAnfme(elem.getAnfme());  // 数量
            waitPakin.setStatus("Y");    // 状态
            waitPakin.setAppeUser(userId);
            waitPakin.setAppeTime(now);
            waitPakin.setModiUser(userId);
            waitPakin.setModiTime(now);
                Order order = orderService.selectOne(new EntityWrapper<Order>().eq("temp1", param.getOrderNo()));
                if (Cools.isEmpty(order) || order.getSettle() > 2) {
                    throw new CoolException("单据编号已过期");
                }
                // 生成入库通知档
                List<DetlDto> detlDtos = new ArrayList<>();
                param.getCombMats().forEach(elem -> {
            waitPakin.setBatch(orderDetl.getBatch());
            waitPakin.setSPgNO(orderDetl.getSPgNO());
            waitPakin.setOutOrderNo(orderDetl.getOutOrderNo());
            waitPakin.setProType(orderDetl.getProType());
            waitPakin.setLuHao(orderDetl.getLuHao());
            waitPakin.setPacking(orderDetl.getPacking());
            if (!waitPakinService.insert(waitPakin)) {
                throw new CoolException("保存入库通知档失败");
            }
        });
                    // 订单明细数量校验
                    //OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getAnfme() );
                    OrderDetl orderDetl = orderDetlService.selectById(elem.getDetlId());
                    if (elem.getAnfme() > orderDetl.getEnableQty()) {
                        throw new CoolException(orderDetl.getMatnr() + "入库数量不合法");
                    }
                    // 修改订单作业数量
                    if (!orderDetlService.increaseWorkQty(orderDetl, elem.getAnfme())) {
                        throw new CoolException("修改单据作业数量失败");
                    }
        orderService.updateSettle(order.getId(), 2L, userId);
        //  }
                    Mat mat = matService.selectByMatnr(orderDetl.getMatnr());
                    if (Cools.isEmpty(mat)) {
                        throw new CoolException(orderDetl.getMatnr() + "商品档案不存在");
                    }
                    WaitPakin waitPakin = new WaitPakin();
                    waitPakin.sync(mat);
                    waitPakin.setOrderNo(order.getOrderNo());   // 单据编号
                    waitPakin.setBatch(orderDetl.getBatch());     // 序列码
                    waitPakin.setZpallet(param.getBarcode());   // 托盘码
                    waitPakin.setIoStatus("N");     // 入出状态
                    waitPakin.setAnfme(elem.getAnfme());  // 数量
                    waitPakin.setStatus("Y");    // 状态
                    waitPakin.setAppeUser(userId);
                    waitPakin.setAppeTime(now);
                    waitPakin.setModiUser(userId);
                    waitPakin.setModiTime(now);
                    waitPakin.setBatch(orderDetl.getBatch());
                    waitPakin.setSPgNO(orderDetl.getSPgNO());
                    waitPakin.setOutOrderNo(orderDetl.getOutOrderNo());
                    waitPakin.setProType(orderDetl.getProType());
                    waitPakin.setLuHao(orderDetl.getLuHao());
                    waitPakin.setPacking(orderDetl.getPacking());
                    if (!waitPakinService.insert(waitPakin)) {
                        throw new CoolException("保存入库通知档失败");
                    }
                });
                orderService.updateSettle(order.getId(), 2L, userId);
          }
    }
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -532,10 +532,10 @@
                    .eq("stn_no", param.getOutSite())
                    .eq("crn_no", locMast.getCrnNo());
            StaDesc staDesc = staDescService.selectOne(wrapper);
            Integer sourceStaNo = staDesc.getCrnStn();
            if (Cools.isEmpty(sourceStaNo)) {
                throw new CoolException("检索源站失败");
            if (Cools.isEmpty(staDesc)) {
                throw new CoolException("不存在该空板出库路径,请更换站点");
            }
            Integer sourceStaNo = staDesc.getCrnStn();
            Date now = new Date();
            // 保存工作档
            WrkMast wrkMast = new WrkMast();
src/main/java/com/zy/asrs/utils/Utils.java
@@ -350,45 +350,77 @@
        return necessaryParameters;
    }
    //经典单伸库位
//    //经典单伸库位
//    public static int[] LocNecessaryParametersDoubleExtension2(Integer whsType, Integer curRow, Integer crnNumber) {
//        int[] necessaryParameters = new int[]{0, 0, 0, 0};
//        RowLastnoService rowLastnoService = SpringUtils.getBean(RowLastnoService.class);
//        RowLastno rowLastno = rowLastnoService.selectById(whsType);
//        Integer sRow = rowLastno.getsRow();
//        Integer sCrnNo = rowLastno.getsCrnNo();
//        if (BooleanWhsTypeSta(whsType)) {
//            necessaryParameters[0] = crnNumber; // 轮询次数
//            //满板正常入库
//            if (curRow.equals(crnNumber * 2 + sRow - 1)) {
//                necessaryParameters[1] = sRow;    //curRow   最深库位排
//                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
//                necessaryParameters[3] = sRow;    //nearRow  最浅库位排
//            } else if (curRow.equals((crnNumber - 1) * 2 + sRow)) {
//                necessaryParameters[1] = sRow+1;    //curRow   最深库位排
//                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
//                necessaryParameters[3] = sRow+1;    //nearRow  最浅库位排
//            } else {
//                curRow = curRow + 2;
//                if (curRow <  sRow || curRow > (crnNumber * 2 + sRow - 1)) {
//                    throw new CoolException("库位排号异常:排号:" + curRow);
//                }
//                if ((curRow - sRow) % 2 == 0) {
//                    necessaryParameters[1] = curRow;    //curRow   最深库位排
//                    necessaryParameters[2] = (curRow - sRow) / 2 + sCrnNo ;     //crnNo     堆垛机号
//                    necessaryParameters[3] = curRow ;    //nearRow  最浅库位排
//                } else if ((curRow - sRow + 1) % 2 == 0) {
//                    necessaryParameters[1] = curRow;    //curRow   最深库位排
//                    necessaryParameters[2] = (curRow - sRow - 1) / 2 + sCrnNo;     //crnNo     堆垛机号
//                    necessaryParameters[3] = curRow ;    //nearRow  最浅库位排
//                } else {
//                    throw new CoolException("库位排号异常:排号:" + curRow);
//                }
//            }
//        }
//        return necessaryParameters;
//    }
    // 经典单伸库位
    public static int[] LocNecessaryParametersDoubleExtension2(Integer whsType, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
        RowLastnoService rowLastnoService = SpringUtils.getBean(RowLastnoService.class);
        RowLastno rowLastno = rowLastnoService.selectById(whsType);
        Integer sRow = rowLastno.getsRow();
        Integer sCrnNo = rowLastno.getsCrnNo();
        // 判断仓库类型是否满足要求
        if (BooleanWhsTypeSta(whsType)) {
            necessaryParameters[0] = crnNumber; // 轮询次数
            //满板正常入库
            if (curRow.equals(crnNumber * 2 + sRow - 1)) {
                necessaryParameters[1] = sRow;    //curRow   最深库位排
                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
                necessaryParameters[3] = sRow;    //nearRow  最浅库位排
            } else if (curRow.equals((crnNumber - 1) * 2 + sRow)) {
                necessaryParameters[1] = sRow+1;    //curRow   最深库位排
                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
                necessaryParameters[3] = sRow+1;    //nearRow  最浅库位排
            } else {
                curRow = curRow + 2;
                if (curRow <  sRow || curRow > (crnNumber * 2 + sRow - 1)) {
                    throw new CoolException("库位排号异常:排号:" + curRow);
                }
                if ((curRow - sRow) % 2 == 0) {
                    necessaryParameters[1] = curRow;    //curRow   最深库位排
                    necessaryParameters[2] = (curRow - sRow) / 2 + sCrnNo ;     //crnNo     堆垛机号
                    necessaryParameters[3] = curRow ;    //nearRow  最浅库位排
                } else if ((curRow - sRow + 1) % 2 == 0) {
                    necessaryParameters[1] = curRow;    //curRow   最深库位排
                    necessaryParameters[2] = (curRow - sRow - 1) / 2 + sCrnNo;     //crnNo     堆垛机号
                    necessaryParameters[3] = curRow ;    //nearRow  最浅库位排
                } else {
                    throw new CoolException("库位排号异常:排号:" + curRow);
                }
            // 计算最深库位排和最浅库位排
            int minRow = sRow;  // 起始排号
            int maxRow = sRow + 7;  // 终止排号 (8排)
            // 检查排号范围是否合法
            if (curRow < minRow || curRow > maxRow) {
                throw new CoolException("库位排号异常:排号:" + curRow);
            }
            // 计算堆垛机号和对应排号
            int crnOffset = (curRow - minRow) / 2;  // 计算当前堆垛机偏移量
            necessaryParameters[1] = curRow;        // curRow: 当前货架排号
            necessaryParameters[2] = sCrnNo + crnOffset;  // crnNo: 堆垛机号
            necessaryParameters[3] = curRow;        // nearRow: 当前货架排号
        }
        return necessaryParameters;
    }
    //经典单双伸库位  左单右双(小单大双)
    public static int[] LocNecessaryParametersDoubleExtension3(Integer whsType, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
src/main/java/com/zy/common/model/DetlDto.java
@@ -2,8 +2,6 @@
import com.core.common.Cools;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.param.FullStoreParam;
import com.zy.asrs.utils.MatCompareUtils;
import lombok.Data;
import java.util.List;
@@ -23,74 +21,64 @@
    private Double anfme;
    private String sPgNO;
    private String outOrderNo;
    private String luHao;
    private String packing;
    private String proType;
    public DetlDto(LocDto locDto) {
        this.matnr = locDto.getMatnr();
        this.batch = locDto.getBatch();
        this.sPgNO = locDto.getSPgNO();
        this.outOrderNo = locDto.getOutOrderNo();
        this.luHao = locDto.getLuHao();
        this.packing = locDto.getPacking();
        this.proType = locDto.getProType();
        this.orderNo = locDto.getOrderNo();
        this.anfme = locDto.getAnfme();
    public DetlDto() {
    }
    public DetlDto(String matnr, Double anfme) {
        this.matnr = matnr;
        this.anfme = anfme;
    }
    public DetlDto(String matnr, String batch) {
        this.matnr = matnr;
        this.batch = batch;
    }
    public DetlDto(String matnr, String batch, Double anfme) {
        this.matnr = matnr;
        this.batch = batch;
        this.anfme = anfme;
    }
    public DetlDto(String orderNo, String matnr, String batch, Double anfme) {
        this.orderNo = orderNo;
        this.matnr = matnr;
        this.batch = batch;
        this.anfme = anfme;
    }
    public static boolean hasList(Set<DetlDto> detlDtos, OrderDetl orderDetl) {
        for (DetlDto dto : detlDtos) {
            boolean compare = MatCompareUtils.compare(dto, orderDetl);
            if (compare) {
                return true;
            if (Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(orderDetl.getBatch())) {
                if (dto.getMatnr().equals(orderDetl.getMatnr())) {
                    return true;
                }
            } else {
                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(orderDetl.getBatch())) {
                    if (dto.getMatnr().equals(orderDetl.getMatnr()) && dto.getBatch().equals(orderDetl.getBatch())) {
                        return true;
                    }
                }
            }
//            if (Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(orderDetl.getBatch())) {
//                if (dto.getMatnr().equals(orderDetl.getMatnr())) {
//                    return true;
//                }
//            } else {
//                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(orderDetl.getBatch())) {
//                    if (dto.getMatnr().equals(orderDetl.getMatnr()) && dto.getBatch().equals(orderDetl.getBatch())) {
//                        return true;
//                    }
//                }
//            }
        }
        return false;
    }
    public static boolean has(List<DetlDto> detlDtos, DetlDto detlDto) {
        for (DetlDto dto : detlDtos) {
            boolean compare = MatCompareUtils.compare(dto, detlDto);
            if (compare) {
            if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch())) {
                return true;
            }
//            if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch())) {
//                return true;
//            }
        }
        return false;
    }
    public static DetlDto find(List<DetlDto> detlDtos, LocDto locDto) {
        if (Cools.isEmpty(locDto)) {
    public static DetlDto find(List<DetlDto> detlDtos, String matnr, String batch) {
        if (Cools.isEmpty(matnr)) {
            return null;
        }
        for (DetlDto detlDto : detlDtos) {
            boolean compare = MatCompareUtils.compare(detlDto, locDto);
            if (compare) {
            if (matnr.equals(detlDto.getMatnr()) && Cools.eq(batch, detlDto.getBatch())) {
                return detlDto;
            }
        }
src/main/java/com/zy/common/model/TaskDto.java
@@ -19,6 +19,7 @@
    private String locNo;
    private Integer staNo;
    private List<LocDetlDto> locDetlDtos = new ArrayList<>();
    private List<LocDto> locDtos;
@@ -67,56 +68,87 @@
        return null;
    }
    public boolean isAll(){
        // 汇总不考虑序列码
        List<DetlDto> detlDtos = new ArrayList<>();
        for (LocDto locDto : this.getLocDtos()) {
            DetlDto dto = new DetlDto(locDto);
            if (DetlDto.has(detlDtos, dto)) {
                DetlDto detlDto = DetlDto.find(detlDtos, locDto);
                assert detlDto != null;
                detlDto.setAnfme(detlDto.getAnfme() + locDto.getAnfme());
            } else {
                detlDtos.add(new DetlDto(locDto));
            }
        }
        // 查询当前库位号所有的库存明细
        LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo));
        if (locDetls == null || locDetls.isEmpty()){
            throw new CoolException("检索库存明细失败,库位号=" + this.locNo);
        }
        int sameNumber = 0;
        for (LocDetl locDetl : locDetls) {
            Iterator<DetlDto> iterator = detlDtos.iterator();
            while (iterator.hasNext()) {
                DetlDto dto = iterator.next();
                if (!dto.getMatnr().equals(locDetl.getMatnr())) {
                    continue;
                }
                if (Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) {
                    continue;
                }
                if (!Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(locDetl.getBatch())) {
                    continue;
                }
                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) {
                    if (!dto.getBatch().equals(locDetl.getBatch())) {
                        continue;
                    }
                }
                if (dto.getAnfme() > locDetl.getAnfme()) {
                    throw new CoolException("服务器内部错误");
                }
                if (dto.getAnfme().equals(locDetl.getAnfme())) {
                    sameNumber++;
                    iterator.remove();
                    break;
                }
            }
        }
        return sameNumber == locDetls.size();
//    public boolean isAll(){
//        // 汇总不考虑序列码
//        List<DetlDto> detlDtos = new ArrayList<>();
//        for (LocDto locDto : this.getLocDtos()) {
//            DetlDto dto = new DetlDto(locDto);
//            if (DetlDto.has(detlDtos, dto)) {
//                DetlDto detlDto = DetlDto.find(detlDtos, locDto);
//                assert detlDto != null;
//                detlDto.setAnfme(detlDto.getAnfme() + locDto.getAnfme());
//            } else {
//                detlDtos.add(new DetlDto(locDto));
//            }
//        }
//
//        // 查询当前库位号所有的库存明细
//        LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
//        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo));
//        if (locDetls == null || locDetls.isEmpty()){
//            throw new CoolException("检索库存明细失败,库位号=" + this.locNo);
//        }
//        int sameNumber = 0;
//        for (LocDetl locDetl : locDetls) {
//            Iterator<DetlDto> iterator = detlDtos.iterator();
//            while (iterator.hasNext()) {
//                DetlDto dto = iterator.next();
//                if (!dto.getMatnr().equals(locDetl.getMatnr())) {
//                    continue;
//                }
//                if (Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) {
//                    continue;
//                }
//                if (!Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(locDetl.getBatch())) {
//                    continue;
//                }
//                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) {
//                    if (!dto.getBatch().equals(locDetl.getBatch())) {
//                        continue;
//                    }
//                }
//                if (dto.getAnfme() > locDetl.getAnfme()) {
//                    throw new CoolException("服务器内部错误");
//                }
//                if (dto.getAnfme().equals(locDetl.getAnfme())) {
//                    sameNumber++;
//                    iterator.remove();
//                    break;
//                }
//            }
//        }
//        return sameNumber == locDetls.size();
//    }
public boolean isAll(){
    List<LocDetlDto> locDetlDtosCp = new ArrayList<>(this.locDetlDtos);
    // 查询当前库位号所有的库存明细
    LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
    List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo));
    if (locDetls == null || locDetls.isEmpty()){
        throw new CoolException("检索库存明细失败,库位号=" + this.locNo);
    }
    int sameNumber = 0;
    for (LocDetl locDetl : locDetls) {
        Iterator<LocDetlDto> iterator = locDetlDtosCp.iterator();
        while (iterator.hasNext()) {
            LocDetlDto next = iterator.next();
            if (!next.getLocDetl().getMatnr().equals(locDetl.getMatnr())) {
                continue;
            }
            if (!Cools.eq(next.getLocDetl().getBatch(), locDetl.getBatch())) {
                continue;
            }
            if (next.getCount() > locDetl.getAnfme()) {
                throw new CoolException("服务器内部错误");
            }
            if (next.getCount().equals(locDetl.getAnfme())) {
                sameNumber++;
                iterator.remove();
                break;
            }
        }
    }
    return sameNumber == locDetls.size();
}
}
src/main/java/com/zy/common/service/CommonService.java
@@ -166,9 +166,9 @@
        if (!Cools.isEmpty(moveCrnNo) && moveCrnNo!=0){
            crnNumber = moveCrnNo;
            if (times==0){
                curRow = moveCrnNo*4-1;
                curRow = moveCrnNo*2-1;
            }else {
                curRow = moveCrnNo*4-2;
                curRow = moveCrnNo*2-1;
            }
        }
@@ -191,9 +191,9 @@
                times++;
            }
        }
        if (nearRow == 0) {
            throw new CoolException("无可用堆垛机");
        }
//        if (nearRow == 0) {
//            throw new CoolException("无可用堆垛机");
//        }
        boolean signRule1 = false;
        boolean signRule2 = false;
@@ -202,7 +202,7 @@
        if (Utils.BooleanWhsTypeStaIoType(whsType)){
            // 靠近摆放规则 --- 同天同规格物料 //分离版
            if (!Cools.isEmpty(matnr) &&  staDescId == 1){
                signRule1 = true;
                signRule1 = false;
            }
            // 靠近摆放规则 --- 同天同规格物料 //互通版
            if (!Cools.isEmpty(matnr) && staDescId == 1) {
@@ -399,7 +399,7 @@
            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
            if (times < rowCount*2) {
                times = times + 1;
                return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
                return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo+1, locTypeDto, times);
            }
//            // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
//            if (locTypeDto.getLocType1() < 2) {
src/main/java/com/zy/common/web/WcsController.java
@@ -327,7 +327,7 @@
        // 检索库位
        List<String> matnrs = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList());
        List<String> batchs = waitPakins.stream().map(WaitPakin::getBatch).distinct().collect(Collectors.toList());
        StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto);
        StartupDto dto = commonService.getLocNo(2, 1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto);
        int workNo = dto.getWorkNo();
        Date now = new Date();
        // 生成工作档
src/main/resources/application.yml
@@ -10,7 +10,7 @@
    enabled: false
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://127.0.0.1:1433;databasename=xgmFlasrs
    url: jdbc:sqlserver://127.0.0.1:1433;databasename=tzglasrs
    username: sa
    password: sa@123
  mvc:
@@ -40,7 +40,7 @@
#License相关配置
license:
  subject: gdkyasrs
  subject: tzglasrs
  publicAlias: publicCert
  storePass: public_zhongyang_123456789
  licensePath: license.lic
@@ -49,7 +49,7 @@
# 下位机配置
wcs-slave:
  # 双深
  doubleDeep: true
  doubleDeep: false
  # 双深库位排号
  doubleLocs: 1,4,5,8,9,12,13,16
  # 一个堆垛机负责的货架排数
@@ -103,7 +103,7 @@
    lcid: 2052
  #ERP接口
  enabled: true
  enabled: false
  #enabled: false
  #查看ERP中间表间隔
  refreshtime: 0/5 * * * * ?
src/main/resources/license.lic
Binary files differ
src/main/webapp/static/js/common.js
@@ -1,4 +1,4 @@
var baseUrl = "/xgmFlwms";
var baseUrl = "/tzglasrs";
// 详情窗口-高度
var detailHeight = '80%';