提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.plcserver.opc.unit; |
懒 |
2 |
|
|
3 |
import org.apache.commons.lang3.StringUtils; |
|
4 |
|
|
5 |
import java.util.Calendar; |
|
6 |
|
|
7 |
public class qrCode { |
|
8 |
public static Calendar calendar = Calendar.getInstance(); |
|
9 |
public static String CustomerCode = "EXXXXXXX"; //客户编码 |
|
10 |
public static String MarketAreaCode = "XXX"; //市场区域码 |
|
11 |
public static String SoftwareVersionCode = "XXXX"; //软件版本码 |
|
12 |
public static String Years = String.valueOf(calendar.get(Calendar.YEAR)); //年份 |
|
13 |
public static String Months = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH) + 1),2, "0"); //月份 |
|
14 |
public static String Dates = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.DATE)),2, "0"); //日期 |
|
15 |
public static String RunningWaterNumber = "0000"; //流水号 |
|
16 |
public static String ProductionBaseCode = "XX"; //生产基地代码 |
|
17 |
public static String Line = "XX"; //产线 |
|
18 |
public static String ProductCode = "XXXXXXXXX"; //产品编码 |
|
19 |
public static String PrintCode = "XXX"; //印操作请求码 |
|
20 |
public static String ProductCompanyCode = "XXXXXXXXX"; //产品公司编码 |
|
21 |
public static String SerialNumbers = "000000000"; //序列号 |
|
22 |
|
|
23 |
/** |
|
24 |
* 单体编号追溯 |
|
25 |
* @return |
|
26 |
*/ |
|
27 |
public static String unitNoRetrospect(){ |
|
28 |
//序列号 |
|
29 |
int i = Integer.valueOf(qrCode.SerialNumbers)+1; |
|
30 |
qrCode.SerialNumbers = StringUtils.leftPad(String.valueOf(i),9, "0"); |
|
31 |
|
|
32 |
//流水号 |
|
33 |
int i1 = Integer.valueOf(qrCode.RunningWaterNumber)+1; |
|
34 |
String runningWaterNumber = StringUtils.leftPad(String.valueOf(i1),4, "0"); |
|
35 |
|
|
36 |
return "E"+qrCode.CustomerCode+"|"+qrCode.MarketAreaCode+"|"+qrCode.SoftwareVersionCode+"|"+qrCode.Years+"|"+ |
|
37 |
qrCode.Months+"|"+qrCode.Dates+"|"+runningWaterNumber+"|"+qrCode.ProductionBaseCode+"|"+qrCode.Line+"|"+ |
|
38 |
qrCode.ProductCode+"|"+qrCode.PrintCode+"|"+qrCode.ProductCompanyCode+"|"+qrCode.SerialNumbers; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
/** |
|
43 |
* 物料批次追溯 |
|
44 |
* @return |
|
45 |
*/ |
|
46 |
public static String materialBatchRetrospect(){ |
|
47 |
return qrCode.Years+qrCode.Months+qrCode.Dates+qrCode.ProductCode; |
|
48 |
} |
|
49 |
|
|
50 |
public static void main(String[] args) { |
|
51 |
System.out.println("物料批次追溯--"+qrCode.materialBatchRetrospect()); |
|
52 |
System.out.println("单体编号追溯--"+qrCode.unitNoRetrospect()); |
|
53 |
} |
|
54 |
} |