|
|
|
@ -17,6 +17,7 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -84,12 +85,16 @@ public class WriteVariableService implements IWriteVariableService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesProductionPartContext mesProductionPartContext;
|
|
|
|
|
MesProductionPsOutContext productionPsOutSn;
|
|
|
|
|
MesProductionPartContext mesProductionPartContext = null;
|
|
|
|
|
MesProductionPsOutContext productionPsOutSn = null;
|
|
|
|
|
|
|
|
|
|
if (!Objects.isNull(foreignKey)) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPartContextList)) {
|
|
|
|
|
mesProductionPartContext = productionPartContextList.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null);
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsOutContexts)) {
|
|
|
|
|
productionPsOutSn = productionPsOutContexts.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null);
|
|
|
|
|
}
|
|
|
|
|
String newValue = "";
|
|
|
|
|
if (StringUtils.isEmpty(value)) {
|
|
|
|
|
return null;
|
|
|
|
@ -97,13 +102,16 @@ public class WriteVariableService implements IWriteVariableService {
|
|
|
|
|
if (mesProductionPartContext == null) {
|
|
|
|
|
mesProductionPartContext = new MesProductionPartContext();
|
|
|
|
|
}
|
|
|
|
|
if (productionPsOutSn == null) {
|
|
|
|
|
productionPsOutSn = new MesProductionPsOutContext();
|
|
|
|
|
}
|
|
|
|
|
switch (value.toUpperCase()) {
|
|
|
|
|
case "%RESULT%" : newValue = mesProductionPartContext.getPartNo(); break;
|
|
|
|
|
case "%PARAM%": newValue = mesProductionPartContext.getWorkOrderNo(); break;
|
|
|
|
|
case "%ORDERCODE%": newValue = mesProductionPartContext.getWorkOrderNo(); break;
|
|
|
|
|
case "%CUSTPARTNO%": newValue = mesProductionPartContext.getCustPartNo(); break;
|
|
|
|
|
case "%EMPLOYEENO%": newValue = reqBean.getUserInfo(); break;///当前操作员工号 用户名
|
|
|
|
|
case "%BARCODE%": newValue = productionPsOutContexts.get(0).getProductSn(); break;// 条码
|
|
|
|
|
case "%BARCODE%": newValue = productionPsOutSn.getProductSn(); break;// 条码
|
|
|
|
|
case "%BARCODE2%": newValue = productionPsOutContexts.get(1).getProductSn(); break;///条码
|
|
|
|
|
case "%BARCODE3%": newValue = productionPsOutContexts.get(2).getProductSn(); break;///条码
|
|
|
|
|
case "%BARCODE4%": newValue = productionPsOutContexts.get(3).getProductSn(); break;///条码
|
|
|
|
@ -131,7 +139,7 @@ public class WriteVariableService implements IWriteVariableService {
|
|
|
|
|
case "%PARTNO%": newValue = mesProductionPartContext.getPartNo(); break;///工单对应的零件号
|
|
|
|
|
//case "%VINCODE%": newValue = mesProductionPartContext.getv(); break;///工单对应的vincode
|
|
|
|
|
case "%SEQUENCE%": newValue = reqBean.getUserInfo(); break;///工单顺序号 不是生产顺序号
|
|
|
|
|
case "%CUSTBARCODE%": newValue = productionPsOutContexts.get(0).getCustSn(); break;///客户条码
|
|
|
|
|
case "%CUSTBARCODE%": newValue = productionPsOutSn.getCustSn(); break;///客户条码
|
|
|
|
|
case "%GETDATE%": newValue = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); break;///客户条码
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|