自动化立体仓库 - WMS系统
skyouc
20 小时以前 1dca57c0f15c3cdfbebf14ad1e9e04d8c84e775c
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
@@ -47,6 +50,26 @@
            }
            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;
    }
    /**
@@ -280,7 +303,8 @@
            case 2://经典单伸库位(2排货架)
                return LocNecessaryParametersDoubleExtension2(rowLastno, curRow, crnNumber); //已完善
            case 3://经典单双伸库位  左单右双(小单大双)
                return LocNecessaryParametersDoubleExtension3(rowLastno, curRow, crnNumber); //未完善
                return LocNecessaryParametersDoubleExtension(rowLastno, curRow, crnNumber); //已完善
//            return LocNecessaryParametersDoubleExtension3(rowLastno, curRow, crnNumber); //未完善
            case 4://经典单双伸库位  左双右单(小双大单)
                return LocNecessaryParametersDoubleExtension4(rowLastno, curRow, crnNumber); //未完善
            case 5://双工位单伸库位(4排货架)
@@ -631,4 +655,15 @@
        return result;
    }
    /**
     * 日期转换为字符串
     * @param date 日期
     * @param format 格式
     * @return 字符串
     */
    public static String dateToStr(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}