Merge remote-tracking branch 'origin/master'

master
zhaoxiaolin 7 months ago
commit 3ef576ff0f

@ -164,4 +164,12 @@ public class Constants {
//ZL0030-品质异常流程
public static final Integer WORKFLOWID_ZL0030=26256;
//榄菊集团缩写
public static final String LJ="LJ";
//产出状态
public static final String OUTPUT_STATUS_A="A";
}

@ -1,8 +1,8 @@
package com.op.common.core.utils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
import org.springframework.util.AntPathMatcher;
import com.op.common.core.constant.Constants;
import com.op.common.core.text.StrFormatter;
@ -470,4 +470,35 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
}
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;
}
}

Loading…
Cancel
Save