forked from I3-YF/i3plus-mes-pcn-yfai
生产条码时增加小鹏一维码规则
parent
2a2f606ed7
commit
6400ab2846
@ -0,0 +1,22 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.strategy.numberrule;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNumberRuleStrategyModel;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/26 9:34
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface INumberRulePackAttributeStrategy {
|
||||||
|
/**
|
||||||
|
* 封装封装生成条码模型
|
||||||
|
* @return 生成条码模型
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "封装封装生成条码模型", notes = "封装封装生成条码模型")
|
||||||
|
GenSerialNoModel execute(MesNumberRuleStrategyModel model);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.strategy.numberrule.strategy;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.strategy.numberrule.INumberRulePackAttributeStrategy;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNumberRuleStrategyModel;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/26 9:38
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
public class XiaoPengNumberRuleStrategy implements INumberRulePackAttributeStrategy {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GenSerialNoModel execute(MesNumberRuleStrategyModel model) {
|
||||||
|
Date date = new Date();
|
||||||
|
// XIAO_PENG 原客户条码.小鹏汽车 NoSortBarCodeGZ-new
|
||||||
|
//{custPartNo}{SPILTRULE}{year}{month}{day}{hour}{minute}{second}{serialNo}
|
||||||
|
GenSerialNoModel genSerialNoModel = new GenSerialNoModel();
|
||||||
|
genSerialNoModel.setRuleCode(model.getSnRule());
|
||||||
|
//客户零件号
|
||||||
|
String custPartNo = model.getCustPartNo();
|
||||||
|
genSerialNoModel.setCustPartNo(custPartNo);
|
||||||
|
//日期${dateShort}
|
||||||
|
genSerialNoModel.setYear(getYearShort(date));
|
||||||
|
genSerialNoModel.setMonth(getMonthShort(date));
|
||||||
|
genSerialNoModel.setDay(getDayShort(date));
|
||||||
|
//中杠 -
|
||||||
|
//生产日期 + 时间 yyyyMMddHHmmss
|
||||||
|
//流水号 5位 每天从1开始
|
||||||
|
return genSerialNoModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getYearShort(Date date) {
|
||||||
|
return MesExtEnumUtil.YEAR_SHORT.valueOfDescription(Integer.parseInt(TimeTool.getYear(date)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getMonthShort(Date date) {
|
||||||
|
|
||||||
|
return MesExtEnumUtil.MONTH_SHORT.valueOfDescription(Integer.parseInt(TimeTool.getMonth(date)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDayShort(Date date) {
|
||||||
|
return TimeTool.getDay(date);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 打印数据
|
||||||
|
* @Reference :
|
||||||
|
* @Author : junsheng.li
|
||||||
|
* @CreateDate 2024/6/20 11:40
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesNumberRuleStrategyModel {
|
||||||
|
|
||||||
|
@ApiParam("物料号")
|
||||||
|
private String partNo;
|
||||||
|
|
||||||
|
@ApiParam("物料名称")
|
||||||
|
private String partName;
|
||||||
|
|
||||||
|
@ApiParam("生产厂家名称")
|
||||||
|
private String factoryName;
|
||||||
|
|
||||||
|
@ApiParam("生产日期")
|
||||||
|
private String productDate;
|
||||||
|
|
||||||
|
@ApiParam("供应商代码")
|
||||||
|
private String supplierCode;
|
||||||
|
|
||||||
|
@ApiParam("客户物料号")
|
||||||
|
private String custPartNo;
|
||||||
|
|
||||||
|
@ApiParam("打印规则")
|
||||||
|
private String snRule;
|
||||||
|
|
||||||
|
@ApiParam("产地")
|
||||||
|
private String prodLocation;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue