package cn.stylefeng.guns.plcserver.opc.unit;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import java.util.Calendar;
|
|
public class qrCode {
|
public static Calendar calendar = Calendar.getInstance();
|
public static String CustomerCode = "EXXXXXXX"; //客户编码
|
public static String MarketAreaCode = "XXX"; //市场区域码
|
public static String SoftwareVersionCode = "XXXX"; //软件版本码
|
public static String Years = String.valueOf(calendar.get(Calendar.YEAR)); //年份
|
public static String Months = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH) + 1),2, "0"); //月份
|
public static String Dates = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.DATE)),2, "0"); //日期
|
public static String RunningWaterNumber = "0000"; //流水号
|
public static String ProductionBaseCode = "XX"; //生产基地代码
|
public static String Line = "XX"; //产线
|
public static String ProductCode = "XXXXXXXXX"; //产品编码
|
public static String PrintCode = "XXX"; //印操作请求码
|
public static String ProductCompanyCode = "XXXXXXXXX"; //产品公司编码
|
public static String SerialNumbers = "000000000"; //序列号
|
|
/**
|
* 单体编号追溯
|
* @return
|
*/
|
public static String unitNoRetrospect(){
|
//序列号
|
int i = Integer.valueOf(qrCode.SerialNumbers)+1;
|
qrCode.SerialNumbers = StringUtils.leftPad(String.valueOf(i),9, "0");
|
|
//流水号
|
int i1 = Integer.valueOf(qrCode.RunningWaterNumber)+1;
|
String runningWaterNumber = StringUtils.leftPad(String.valueOf(i1),4, "0");
|
|
return "E"+qrCode.CustomerCode+"|"+qrCode.MarketAreaCode+"|"+qrCode.SoftwareVersionCode+"|"+qrCode.Years+"|"+
|
qrCode.Months+"|"+qrCode.Dates+"|"+runningWaterNumber+"|"+qrCode.ProductionBaseCode+"|"+qrCode.Line+"|"+
|
qrCode.ProductCode+"|"+qrCode.PrintCode+"|"+qrCode.ProductCompanyCode+"|"+qrCode.SerialNumbers;
|
}
|
|
|
/**
|
* 物料批次追溯
|
* @return
|
*/
|
public static String materialBatchRetrospect(){
|
return qrCode.Years+qrCode.Months+qrCode.Dates+qrCode.ProductCode;
|
}
|
|
public static void main(String[] args) {
|
System.out.println("物料批次追溯--"+qrCode.materialBatchRetrospect());
|
System.out.println("单体编号追溯--"+qrCode.unitNoRetrospect());
|
}
|
}
|