|
|
@ -1,8 +1,8 @@
|
|
|
|
package com.op.common.core.utils;
|
|
|
|
package com.op.common.core.utils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import org.springframework.util.AntPathMatcher;
|
|
|
|
import org.springframework.util.AntPathMatcher;
|
|
|
|
import com.op.common.core.constant.Constants;
|
|
|
|
import com.op.common.core.constant.Constants;
|
|
|
|
import com.op.common.core.text.StrFormatter;
|
|
|
|
import com.op.common.core.text.StrFormatter;
|
|
|
@ -470,4 +470,35 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param factoryCode 工厂代码
|
|
|
|
|
|
|
|
* @param lineCode 产线编码
|
|
|
|
|
|
|
|
* @param productDate 生产日期
|
|
|
|
|
|
|
|
* @param version 版本号最后一位
|
|
|
|
|
|
|
|
* @param productStatus 产出状态:正常是A
|
|
|
|
|
|
|
|
* @param content 内容物 (根据产品,一般为0)
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final List<String> batchAutoCreate(String factoryCode, String lineCode, Date productDate,String version, String content,int batchNum){
|
|
|
|
|
|
|
|
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
|
|
// Create a Calendar instance and set it to the current date
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
|
|
|
calendar.setTime(productDate);
|
|
|
|
|
|
|
|
// Add three years to the current date
|
|
|
|
|
|
|
|
calendar.add(Calendar.YEAR, 3);
|
|
|
|
|
|
|
|
// Subtract one day from the new date
|
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
|
|
|
// Get the new date
|
|
|
|
|
|
|
|
Date futureDate = calendar.getTime();
|
|
|
|
|
|
|
|
// Format the new date
|
|
|
|
|
|
|
|
String toValidity = targetFormat.format(futureDate);
|
|
|
|
|
|
|
|
List<String> batchList=new ArrayList<>();
|
|
|
|
|
|
|
|
for (char letter = 'A'; letter < 'A' + batchNum; letter++) {
|
|
|
|
|
|
|
|
String BatchCode=toValidity+Constants.LJ+targetFormat.format(productDate)+lineCode+factoryCode+letter+Constants.OUTPUT_STATUS_A+content+version;
|
|
|
|
|
|
|
|
batchList.add(BatchCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return batchList;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|