forked from I3-YF/i3plus-mes-pcn-yfai
Merge branch 'dev' of http://git.estsh.com/I3-YF/i3plus-mes-pcn-yfai into dev
commit
628b8b1fc6
@ -0,0 +1,96 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerOriganze;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerOriganizeRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description : 广州打印主条码使用
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/6 17:03
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AionPrintStrategy implements IPrintTemplateStrategyService {
|
||||
|
||||
@Autowired
|
||||
private MesPartRepository mesPartRao;
|
||||
@Override
|
||||
public Map<String,Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
//零件条码中获取 serialNo
|
||||
String productSn = sn.getProductSn();
|
||||
//构造标签
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
String partNo = sn.getPartNo();
|
||||
String partName = sn.getPartName();
|
||||
String factoryName = AuthUtil.getOrganize().getName();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String productDate = now.format(formatter);
|
||||
int no = 1;
|
||||
String noStr = String.format("%07d", no);
|
||||
|
||||
//构造二维码
|
||||
StringBuilder barcode = new StringBuilder();
|
||||
barcode.append("+");
|
||||
//第二位 是零件简号 零件扩展信息中的 零件条码参数 字段
|
||||
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getStringEqualPack(partNo,"partNo",partPackBean);
|
||||
List<MesPart> parts = mesPartRao.findByHqlWhere(partPackBean);
|
||||
if (!parts.isEmpty()){
|
||||
MesPart mesPart = parts.get(0);
|
||||
String partSnParam = mesPart.getPartSnParam();
|
||||
if (partSnParam!=null && !partSnParam.isEmpty()){
|
||||
barcode.append(partSnParam);
|
||||
}else {
|
||||
log.error("零件号:{},缺少配置零件扩展属性的 零件条码参数",partNo);
|
||||
}
|
||||
}
|
||||
//第三位 供应商代码 // 配置表
|
||||
String supplierCode = "VD501";
|
||||
barcode.append(supplierCode);
|
||||
//第四位 生产线代号 // 配置表
|
||||
String workCenterCode = "1";
|
||||
barcode.append(workCenterCode);
|
||||
//第五位 生产年月日
|
||||
int year = now.getYear();
|
||||
int month = now.getMonth().getValue();
|
||||
int day = now.getDayOfMonth();
|
||||
String yearStr = MesExtEnumUtil.YEAR_SHORT.valueOfDescription(year);
|
||||
String monthStr = MesExtEnumUtil.MONTH_SHORT.valueOfDescription(month);
|
||||
String dayStr = MesExtEnumUtil.NUM_SCALE_34.valueOfDescription(day);
|
||||
barcode.append(yearStr);
|
||||
barcode.append(monthStr);
|
||||
barcode.append(dayStr);
|
||||
//第六位 供应商生产流水号
|
||||
//第七位 软件版本代号
|
||||
map.put("partNo",partNo);
|
||||
map.put("partName",partName);
|
||||
map.put("factoryName",factoryName);
|
||||
map.put("productDate",productDate);
|
||||
map.put("no",noStr);
|
||||
map.put("barcode",barcode.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/17 16:10
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GqaaPrintStrategy implements IPrintTemplateStrategyService {
|
||||
@Override
|
||||
public Map<String, Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
String partNo = sn.getPartNo();
|
||||
String partName = sn.getPartName();
|
||||
String factoryName = AuthUtil.getOrganize().getName();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yy/MM/dd");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String productDate = now.format(formatter);
|
||||
|
||||
//构造二维码
|
||||
StringBuilder barcode = new StringBuilder();
|
||||
|
||||
//第三位 供应商代码 // 配置表
|
||||
String supplierCode = "VD501";
|
||||
barcode.append(supplierCode);
|
||||
//第四位 生产线代号 // 配置表
|
||||
String workCenterCode = "1";
|
||||
barcode.append(workCenterCode);
|
||||
|
||||
int no = 1;
|
||||
String noStr = String.format("%07d", no);
|
||||
map.put("no",noStr);
|
||||
map.put("partNo", partNo);
|
||||
map.put("partName", partName);
|
||||
map.put("factoryName", factoryName);
|
||||
map.put("productDate", productDate);
|
||||
map.put("barcode", barcode.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/17 16:10
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
||||
@Override
|
||||
public Map<String, Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
String partNo = sn.getPartNo();
|
||||
String partName = sn.getPartName();
|
||||
String factoryName = AuthUtil.getOrganize().getName();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yy/MM/dd");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String productDate = now.format(formatter);
|
||||
|
||||
//构造二维码
|
||||
StringBuilder barcode = new StringBuilder();
|
||||
|
||||
//第三位 供应商代码 // 配置表
|
||||
String supplierCode = "VD501";
|
||||
barcode.append(supplierCode);
|
||||
//第四位 生产线代号 // 配置表
|
||||
String workCenterCode = "1";
|
||||
barcode.append(workCenterCode);
|
||||
|
||||
int no = 1;
|
||||
String noStr = String.format("%07d", no);
|
||||
map.put("no",noStr);
|
||||
map.put("partNo", partNo);
|
||||
map.put("partName", partName);
|
||||
map.put("factoryName", factoryName);
|
||||
map.put("productDate", productDate);
|
||||
map.put("barcode", barcode.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 广州打印主条码使用
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/6 17:03
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GzPrintSnStrategy implements IPrintTemplateStrategyService {
|
||||
@Autowired
|
||||
private MesLabelTemplateRepository labelTemplateRao;
|
||||
@Override
|
||||
public List<Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
//1.根据 templateCode
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/17 16:43
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class NoSortBarCodeGzNewStrategy implements IPrintTemplateStrategyService {
|
||||
@Override
|
||||
public Map<String, Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
//从条码中截取流水号,流水号 后四位
|
||||
String productSn = sn.getProductSn();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
String partNo = sn.getPartNo();
|
||||
String partName = sn.getPartName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String productDateTime = now.format(formatter);
|
||||
map.put("partNo",partNo);
|
||||
map.put("partName",partName);
|
||||
map.put("productDateTime",productDateTime);
|
||||
map.put("barcode",productSn);
|
||||
return map;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : Castle
|
||||
* @CreateDate : 2024/6/17 16:31
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService {
|
||||
@Override
|
||||
public Map<String, Object> execute(MesProductionPsOutContext sn, String organizeCode) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
String partNo = sn.getPartNo();
|
||||
String partName = sn.getPartName();
|
||||
String factoryName = AuthUtil.getOrganize().getName();
|
||||
String supplierCode = "VD501";
|
||||
int no = 1;
|
||||
String noStr = String.format("%04d", no);
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String productDateTime = now.format(formatter);
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String productDate = now.format(dateFormatter);
|
||||
StringBuilder barcode = new StringBuilder(partNo);
|
||||
barcode.append(partName);
|
||||
barcode.append(productDate);
|
||||
barcode.append(noStr);
|
||||
|
||||
map.put("partNo", partNo);
|
||||
map.put("partName", partName);
|
||||
map.put("factoryName", factoryName);
|
||||
map.put("supplierCode", supplierCode);
|
||||
map.put("productDate", productDateTime);
|
||||
map.put("no", noStr);
|
||||
map.put("barcode", barcode.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue