|
@@ -57,7 +57,7 @@ public class MachineController {
|
|
|
Integer employeeId = query.getInt("employeeId");//员工id
|
|
|
String produceNo = query.getString("produceId");//产品编号
|
|
|
//生成条形码,二维码
|
|
|
- String berQrcode = String.valueOf(employeeId+new Date().getTime());
|
|
|
+ String berQrcode = generationBarCode();
|
|
|
String json = String.format(NameUtils.QR_LIMIT_STR_SCENE, ResultInfo.barCodePrefix+berQrcode);
|
|
|
QRCJson qrc = WeixinUtil.createQrcode(json);
|
|
|
PtsMachine ptsMachine = new PtsMachine();
|
|
@@ -211,4 +211,43 @@ public class MachineController {
|
|
|
|
|
|
return dates;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private String productModel = "1x";//产品型号
|
|
|
+ private String productFeatures = "A";//产品特性
|
|
|
+ private String softwareVersion = "30";//软件版本
|
|
|
+ //生成条形码
|
|
|
+ public String generationBarCode(){
|
|
|
+
|
|
|
+ java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM");
|
|
|
+ java.util.Date currTime = new java.util.Date();
|
|
|
+ String curTime = formatter.format(currTime);
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ int year = cal.get(Calendar.YEAR);
|
|
|
+ int month = cal.get(Calendar.MONTH) + 1;
|
|
|
+ //获取当前月机器总数
|
|
|
+ Integer number = machineService.selectMonthCount(curTime);
|
|
|
+ String num = null;
|
|
|
+ switch(String.valueOf(number).length()){
|
|
|
+ case 0:
|
|
|
+ num = "0001";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ num = "000"+String.valueOf(number);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ num = "00"+String.valueOf(number);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ num = "0"+String.valueOf(number);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ num = String.valueOf(number);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //拼接
|
|
|
+ String barcode = productModel+productFeatures+softwareVersion+String.valueOf(year).substring(2,4)+month+num;
|
|
|
+ return barcode;
|
|
|
+ }
|
|
|
}
|