自动化立体仓库 - WMS系统
skyouc
3 天以前 56b1b873191d6e7022ed225cf81c3eda774f210e
src/main/java/com/zy/asrs/utils/Utils.java
@@ -8,17 +8,17 @@
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.RowLastno;
import com.zy.asrs.service.RowLastnoService;
import com.zy.common.CodeBuilder;
import com.zy.common.model.LocDetlDto;
import com.zy.common.properties.SlaveProperties;
import com.zy.common.service.CommonService;
import com.zy.system.service.UserService;
import java.text.DecimalFormat;
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.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
@@ -48,6 +48,27 @@
            return msgBuilder.toString();
        }
    }
    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;
    }
    /**
     * 判断是否为深库位
@@ -489,6 +510,7 @@
        return necessaryParameters;
    }
    //四向库(牛眼\光泰)
    public static int[] LocNecessaryParametersDoubleExtension6(RowLastno rowLastno, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
@@ -498,7 +520,7 @@
        necessaryParameters[0] = crnNumber; // 轮询次数
        curRow = curRow - offset;
        //满板正常入库
        switch (curRow){
        switch (curRow) {
            case 1:
                necessaryParameters[1] = 4;    //curRow   最深库位排
                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
@@ -544,7 +566,7 @@
        Integer sCrnNo = rowLastno.getsCrnNo();//起始堆垛机号
        necessaryParameters[0] = crnNumber; // 轮询次数
        //满板正常入库
        if (curRow.equals(rowLastno.geteRow())){
        if (curRow.equals(rowLastno.geteRow())) {
            necessaryParameters[1] = sRow;    //curRow   最深库位排
            necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
            necessaryParameters[3] = sRow;    //nearRow  最浅库位排
@@ -619,12 +641,12 @@
    // 外侧方向的货位  优先入库方向 ===>> 反之
    public static List<String> getGroupOutLocCrn(Integer curRow, Integer nearRow, String locNo, boolean pakin) {
        List<String> result = new ArrayList<>();
        if (pakin){
            for (int row = curRow;row>=nearRow;row--){
        if (pakin) {
            for (int row = curRow; row >= nearRow; row--) {
                result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
            }
        }else {
            for (int row = curRow;row<=nearRow;row++){
        } else {
            for (int row = curRow; row <= nearRow; row++) {
                result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
            }
        }