Merge remote-tracking branch 'origin/dev-wuhan' into dev-wuhan

tags/yfai-mes-ext-v2.3
臧学普 6 months ago
commit adb638b581

@ -24,9 +24,12 @@ public interface IMesCustSoftInfoService extends IBaseMesService<MesCustSortInfo
*/ */
List<MesCustSortInfo> queryCustSortInfoList(String custCode,String custOrganizeCode,String infoPointCode,String organizeCode,List<String> custPartNoList); List<MesCustSortInfo> queryCustSortInfoList(String custCode,String custOrganizeCode,String infoPointCode,String organizeCode,List<String> custPartNoList);
List<MesCustSortInfo> queryAllCustSortInfoList(String organizeCode);
/** /**
* custSortInfo * custSortInfo
* @param custSortInfo * @param custSortInfo
*/ */
void updateCustSortInfo(MesCustSortInfo custSortInfo); void updateCustSortInfo(MesCustSortInfo custSortInfo);
void updateMsgCustSortInfo(MesCustSortInfo custSortInfo);
} }

@ -0,0 +1,13 @@
package cn.estsh.i3plus.ext.mes.api.base;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPartType;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/11/5 17:27
* @Modify:
**/
public interface IMesCustomerPartTypeService extends IBaseMesService<MesCustomerPartType> {
}

@ -0,0 +1,20 @@
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPartType;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/11/5 17:35
* @Modify:
**/
@Api(description = "客户零件类型")
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesCustomerPartType")
public class MesCustomerPartTypeController extends BaseMesController<MesCustomerPartType> {
}

@ -7,17 +7,14 @@ import cn.estsh.i3plus.ext.mes.apiservice.config.AuthUtilExt;
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.excel.MesExcelTool; import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.excel.MesExcelTool;
import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException; import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.mes.apiservice.util.DateUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesConfig; import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesProductVersion; import cn.estsh.i3plus.pojo.mes.bean.MesProductVersion;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.i3plus.pojo.mes.model.MesWorkOrderModel; import cn.estsh.i3plus.pojo.mes.model.MesWorkOrderModel;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.i3plus.pojo.model.wms.WmsProductModel; import cn.estsh.i3plus.pojo.model.wms.WmsProductModel;
import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -30,15 +27,12 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Api(description = "工单主页面") @Api(description = "工单主页面")
@RestController @RestController
@ -221,12 +215,13 @@ public class MesWorkOrderController extends BaseMesController<MesWorkOrder> {
public ResultBean doShowWorkOrderPrint(String partNo, String workCenterCode, String partProdGroupCode, String carModelCode, String organizeCode, String userName ) { public ResultBean doShowWorkOrderPrint(String partNo, String workCenterCode, String partProdGroupCode, String carModelCode, String organizeCode, String userName ) {
try { try {
ValidatorBean.checkNotNull(partNo, "零件号不能为空");
ValidatorBean.checkNotNull(workCenterCode, "产线不能为空"); ValidatorBean.checkNotNull(workCenterCode, "产线不能为空");
ValidatorBean.checkNotNull(partProdGroupCode, "生产组代码不能为空"); ValidatorBean.checkNotNull(partProdGroupCode, "生产组代码不能为空");
ValidatorBean.checkNotNull(carModelCode, "车型代码不能为空");
ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空"); ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空");
ValidatorBean.checkNotNull(userName, "操作人不能为空"); ValidatorBean.checkNotNull(userName, "操作人不能为空");
if (StringUtil.isEmpty(partNo) && StringUtil.isEmpty(carModelCode)) {
MesException.throwMesBusiException("物料号和车型代码不能同时为空");
}
return ResultBean.success("装配目视单预览查询成功") return ResultBean.success("装配目视单预览查询成功")
.setResultList(mesWorkOrderService.doShowWorkOrderPrint(partNo, workCenterCode, partProdGroupCode, carModelCode, organizeCode, userName)) .setResultList(mesWorkOrderService.doShowWorkOrderPrint(partNo, workCenterCode, partProdGroupCode, carModelCode, organizeCode, userName))

@ -1,9 +1,6 @@
package cn.estsh.i3plus.ext.mes.apiservice.controller.busi; package cn.estsh.i3plus.ext.mes.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.MesAccountJob; import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.*;
import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.MesDowntimeRecordJob;
import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.MesGenerateAccountJob;
import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.MesWorkOrderUpdateQtyJob;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -27,6 +24,9 @@ public class TestController {
@Autowired @Autowired
private MesDowntimeRecordJob mesDowntimeRecordJob; private MesDowntimeRecordJob mesDowntimeRecordJob;
@Autowired
private MesQmsScrapJob mesQmsScrapJob;
@GetMapping("/reportOrder") @GetMapping("/reportOrder")
@ApiOperation(value = "报工") @ApiOperation(value = "报工")
public void reportOrder() { public void reportOrder() {
@ -51,4 +51,11 @@ public class TestController {
public void mesDowntimeRecordJob() { public void mesDowntimeRecordJob() {
mesDowntimeRecordJob.executeMesJob(null, null); mesDowntimeRecordJob.executeMesJob(null, null);
} }
@GetMapping("/mesQmsScrap")
@ApiOperation(value = "mesQmsScrap")
public void mesQmsScrap() {
mesQmsScrapJob.executeMesJob(null, null);
}
} }

@ -60,9 +60,8 @@ public class Pisces1Properties {
* *
*/ */
LOGGER.info("【客户定制化pisces1数据源加载...】"); LOGGER.info("【客户定制化pisces1数据源加载...】");
DynamicDataSourceProxy piscesDataSource = DynamicDataSourceProxy.initDataSourceFactory(this.getPiscesDriverClassName(),
this.getPiscesDsJdbcUrl(),this.getPiscesDsUsername(),this.getPiscesDsPassword(),TimeUnit.MINUTES.toMillis(30));
return piscesDataSource; return DynamicDataSourceProxy.initDataSourceFactory(this.getPiscesDriverClassName(),
this.getPiscesDsJdbcUrl(), this.getPiscesDsUsername(), this.getPiscesDsPassword(),TimeUnit.MINUTES.toMillis(30));
} }
} }

@ -0,0 +1,67 @@
package cn.estsh.i3plus.ext.mes.apiservice.cus_suit;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.plugin.datasource.DynamicDataSourceProxy;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
/**
* @Description : pisces2
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/11/5 11:29
* @Modify:
**/
@Configuration
public class Pisces2Properties {
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
/***********************
* pisces2
*/
@Value("${impp.pisces2.datasource.isopen}")
@Getter
private boolean piscesIsOpen;
@Value("${impp.pisces2.datasource.driver-class-name}")
@Getter
private String piscesDriverClassName;
@Value("${impp.pisces2.datasource.alias}")
@Getter
private String piscesDsAlias;
@Value("${impp.pisces2.datasource.jdbc-url}")
@Getter
private String piscesDsJdbcUrl;
@Value("${impp.pisces2.datasource.username}")
@Getter
private String piscesDsUsername;
@Value("${impp.pisces2.datasource.password}")
@Getter
private String piscesDsPassword;
@Bean(name = "pisces2DataSource")
@ConditionalOnExpression("'${impp.pisces2.datasource.isopen:false}' == 'true'")
public DynamicDataSourceProxy initPiscesCustomerSet(){
LOGGER.info("【初始化客户定制化...】");
/**
*
*/
LOGGER.info("【客户定制化pisces2数据源加载...】");
return DynamicDataSourceProxy.initDataSourceFactory(this.getPiscesDriverClassName(),
this.getPiscesDsJdbcUrl(), this.getPiscesDsUsername(), this.getPiscesDsPassword(),TimeUnit.MINUTES.toMillis(30));
}
}

@ -60,9 +60,8 @@ public class PiscesProperties {
* *
*/ */
LOGGER.info("【客户定制化pisces数据源加载...】"); LOGGER.info("【客户定制化pisces数据源加载...】");
DynamicDataSourceProxy piscesDataSource = DynamicDataSourceProxy.initDataSourceFactory(this.getPiscesDriverClassName(),
this.getPiscesDsJdbcUrl(),this.getPiscesDsUsername(),this.getPiscesDsPassword(),TimeUnit.MINUTES.toMillis(30));
return piscesDataSource; return DynamicDataSourceProxy.initDataSourceFactory(this.getPiscesDriverClassName(),
this.getPiscesDsJdbcUrl(), this.getPiscesDsUsername(), this.getPiscesDsPassword(),TimeUnit.MINUTES.toMillis(30));
} }
} }

@ -84,6 +84,7 @@ public class ShipmentDetailReportDaoImpl implements IShipmentDetailReportDao {
dataQueryHql.append("ms.status AS status,"); dataQueryHql.append("ms.status AS status,");
dataQueryHql.append("ms.shippingGroupCode AS shippingGroupCode,"); dataQueryHql.append("ms.shippingGroupCode AS shippingGroupCode,");
dataQueryHql.append("ms.orderCode AS orderCode,"); dataQueryHql.append("ms.orderCode AS orderCode,");
dataQueryHql.append("ms.planArriveEndTime AS planArriveEndTime,");
dataQueryHql.append("ms.scanSeqWay AS scanSeqWay"); dataQueryHql.append("ms.scanSeqWay AS scanSeqWay");
dataQueryHql.append(")"); dataQueryHql.append(")");

@ -53,6 +53,8 @@ public class MesSAPDbAdapter {
@Resource(name = "pisces1DataSource") @Resource(name = "pisces1DataSource")
private DynamicDataSourceProxy pisces1DataSourceProxy; private DynamicDataSourceProxy pisces1DataSourceProxy;
@Resource(name = "pisces2DataSource")
private DynamicDataSourceProxy pisces2DataSourceProxy;
@Value("${sync.redis.time:1800}") @Value("${sync.redis.time:1800}")
private Integer redisTime; private Integer redisTime;
@ -82,7 +84,8 @@ public class MesSAPDbAdapter {
DynamicDataSourceProxy sapDataSourceProxy, DynamicDataSourceProxy sapDataSourceProxy,
DynamicDataSourceProxy mesDataSourceProxy, DynamicDataSourceProxy mesDataSourceProxy,
DynamicDataSourceProxy piscesDataSourceProxy, DynamicDataSourceProxy piscesDataSourceProxy,
DynamicDataSourceProxy pisces1DataSourceProxy) throws Exception { DynamicDataSourceProxy pisces1DataSourceProxy,
DynamicDataSourceProxy pisces2DataSourceProxy) throws Exception {
WmsSAPDbWriter wmsSAPDbWriter = null; WmsSAPDbWriter wmsSAPDbWriter = null;
@ -110,6 +113,14 @@ public class MesSAPDbAdapter {
wmsSAPDbWriter = new WmsSAPDbWriter(mesDataSourceProxy, pisces1DataSourceProxy); wmsSAPDbWriter = new WmsSAPDbWriter(mesDataSourceProxy, pisces1DataSourceProxy);
} }
if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.PISCES22MES.getCode())) {
wmsSAPDbWriter = new WmsSAPDbWriter(pisces2DataSourceProxy, mesDataSourceProxy);
}
if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.MES2PISCES2.getCode())) {
wmsSAPDbWriter = new WmsSAPDbWriter(mesDataSourceProxy, pisces2DataSourceProxy);
}
// new 的对象需要手工注入 bean // new 的对象需要手工注入 bean
if (SpringContextsUtil.getApplicationContext() != null) { if (SpringContextsUtil.getApplicationContext() != null) {
@ -140,7 +151,8 @@ public class MesSAPDbAdapter {
DynamicDataSourceProxy sapDataSourceProxy, DynamicDataSourceProxy sapDataSourceProxy,
DynamicDataSourceProxy mesDataSourceProxy, DynamicDataSourceProxy mesDataSourceProxy,
DynamicDataSourceProxy piscesDataSourceProxy, DynamicDataSourceProxy piscesDataSourceProxy,
DynamicDataSourceProxy pisces1DataSourceProxy) { DynamicDataSourceProxy pisces1DataSourceProxy,
DynamicDataSourceProxy pisces2DataSourceProxy) {
WmsSAPDbReader wmsSAPDbReader = null; WmsSAPDbReader wmsSAPDbReader = null;
@ -168,6 +180,14 @@ public class MesSAPDbAdapter {
wmsSAPDbReader = new WmsSAPDbReader(mesDataSourceProxy); wmsSAPDbReader = new WmsSAPDbReader(mesDataSourceProxy);
} }
if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.PISCES22MES.getCode())) {
wmsSAPDbReader = new WmsSAPDbReader(pisces2DataSourceProxy);
}
if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.MES2PISCES2.getCode())) {
wmsSAPDbReader = new WmsSAPDbReader(mesDataSourceProxy);
}
// if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.WMS2MES.getName())) { // if (groupName.equals(MesInterfaceEnumUtil.DIRECTION_TYPE.WMS2MES.getName())) {
// wmsSAPDbReader = new WmsSAPDbReader(mesDataSourceProxy); // wmsSAPDbReader = new WmsSAPDbReader(mesDataSourceProxy);
// } // }
@ -220,11 +240,11 @@ public class MesSAPDbAdapter {
// 不需要在这里处理 // 不需要在这里处理
//initConnection(); //initConnection();
writer = buildWriter(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy); writer = buildWriter(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy,pisces2DataSourceProxy);
writer.setSrcConn(this.srcConn); writer.setSrcConn(this.srcConn);
writer.setDestConn(this.destConn); writer.setDestConn(this.destConn);
reader = buildReader(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy); reader = buildReader(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy,pisces2DataSourceProxy);
reader.setSrcConn(this.srcConn); reader.setSrcConn(this.srcConn);
@ -381,11 +401,11 @@ public class MesSAPDbAdapter {
// 不需要在这里处理 // 不需要在这里处理
//initConnection(); //initConnection();
writer = buildWriter(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy); writer = buildWriter(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy,pisces2DataSourceProxy);
writer.setSrcConn(this.srcConn); writer.setSrcConn(this.srcConn);
writer.setDestConn(this.destConn); writer.setDestConn(this.destConn);
reader = buildReader(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy); reader = buildReader(groupName, sapDataSourceProxy, mesDataSourceProxy,piscesDataSourceProxy,pisces1DataSourceProxy,pisces2DataSourceProxy);
reader.setSrcConn(this.srcConn); reader.setSrcConn(this.srcConn);

@ -20,6 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -35,6 +36,7 @@ import java.util.List;
**/ **/
@DisallowConcurrentExecution @DisallowConcurrentExecution
@ApiOperation("MES_QMS报废品汇总Job") @ApiOperation("MES_QMS报废品汇总Job")
@Service
public class MesQmsScrapJob extends BaseMesScheduleJob { public class MesQmsScrapJob extends BaseMesScheduleJob {
public static final Logger LOGGER = LoggerFactory.getLogger(MesQmsScrapJob.class); public static final Logger LOGGER = LoggerFactory.getLogger(MesQmsScrapJob.class);
@ -74,17 +76,19 @@ public class MesQmsScrapJob extends BaseMesScheduleJob {
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue(), "ncStatus", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue(), "ncStatus", packBean);
//查同步标识为3的数据如果接口映射同步则更新为1 //查同步标识为3的数据如果接口映射同步则更新为1
DdlPreparedPack.getNumEqualPack(3, "systemSyncStatus", packBean); DdlPreparedPack.getNumNOEqualPack(1, "systemSyncStatus", packBean);
DdlPreparedPack.timeBuilder( DdlPreparedPack.timeBuilder(
new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00", new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00",
TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true); TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true);
List<MesPartInspection> mesPartInspectionList = partInspectionRepository.findByHqlWhere(packBean); List<MesPartInspection> mesPartInspectionList = partInspectionRepository.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(mesPartInspectionList)) { if (!CollectionUtils.isEmpty(mesPartInspectionList)) {
LOGGER.info("一共需要汇总{}条报废数据2", mesPartInspectionList.size());
qmsScrapService.doQmsScrapByPartInspection(mesPartInspectionList, organizeCode); qmsScrapService.doQmsScrapByPartInspection(mesPartInspectionList, organizeCode);
for (MesPartInspection mesPartInspection : mesPartInspectionList) { for (MesPartInspection mesPartInspection : mesPartInspectionList) {
mesPartInspection.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); mesPartInspection.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
// ConvertBean.serviceModelUpdate(mesPartInspection, MesExtConstWords.JOB); // ConvertBean.serviceModelUpdate(mesPartInspection, MesExtConstWords.JOB);
} }
partInspectionRepository.saveAll(mesPartInspectionList); partInspectionRepository.saveAll(mesPartInspectionList);

@ -2,17 +2,18 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesBtoJobService; import cn.estsh.i3plus.ext.mes.api.base.IMesBtoJobService;
import cn.estsh.i3plus.ext.mes.api.base.strategy.IRoundnessStrategy; import cn.estsh.i3plus.ext.mes.api.base.strategy.IRoundnessStrategy;
import cn.estsh.i3plus.ext.mes.apiservice.config.AuthUtilExt;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerMessagePoint; import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroup;
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupDetail;
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupWindowTime;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
import cn.estsh.i3plus.pojo.mes.repository.MesCustSoftInfoRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesPartProdGroupWindowTimeRepository; import cn.estsh.i3plus.pojo.mes.repository.MesPartProdGroupWindowTimeRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -41,7 +42,8 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
@Autowired @Autowired
private MesCustSoftInfoServiceImpl mesCustSoftInfoService; private MesCustSoftInfoServiceImpl mesCustSoftInfoService;
@Autowired
private MesCustSoftInfoRepository mesCustSoftInfoRepository;
@Autowired @Autowired
private MesPartProdGroupWindowTimeRepository windowTimeRao; private MesPartProdGroupWindowTimeRepository windowTimeRao;
@ -50,6 +52,9 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
public void doCreateBto(String organizeCode, List<String> groupCodeList) { public void doCreateBto(String organizeCode, List<String> groupCodeList) {
//1. 根据 organizeCode 和 groupCodeList 查询零件生产组 //1. 根据 organizeCode 和 groupCodeList 查询零件生产组
List<MesPartProdGroup> mesPartProdGroups = mesPartProdGroupService.findMesPartProdGroups(organizeCode, groupCodeList); List<MesPartProdGroup> mesPartProdGroups = mesPartProdGroupService.findMesPartProdGroups(organizeCode, groupCodeList);
// 初始找原因
updateCustsort(organizeCode, mesPartProdGroups);
for (MesPartProdGroup prodGroup : mesPartProdGroups) { for (MesPartProdGroup prodGroup : mesPartProdGroups) {
//2. 根据生产组的infoPointCode 获取 过点信息MES_CUSTOMER_MESSAGE_POINT //2. 根据生产组的infoPointCode 获取 过点信息MES_CUSTOMER_MESSAGE_POINT
MesCustomerMessagePoint messagePoint = mesCustomerMessagePointService.getPointByCode(prodGroup.getCustInfoPoint(),organizeCode); MesCustomerMessagePoint messagePoint = mesCustomerMessagePointService.getPointByCode(prodGroup.getCustInfoPoint(),organizeCode);
@ -66,6 +71,9 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
List<String> custPartNoList = details.stream().map(MesPartProdGroupDetail::getCustPartNo).collect(Collectors.toList()); List<String> custPartNoList = details.stream().map(MesPartProdGroupDetail::getCustPartNo).collect(Collectors.toList());
List<MesCustSortInfo> sortInfoList = mesCustSoftInfoService.queryCustSortInfoList(prodGroup.getCustCode(), prodGroup.getCustOrganizeCode(), prodGroup.getCustInfoPoint(), organizeCode, custPartNoList); List<MesCustSortInfo> sortInfoList = mesCustSoftInfoService.queryCustSortInfoList(prodGroup.getCustCode(), prodGroup.getCustOrganizeCode(), prodGroup.getCustInfoPoint(), organizeCode, custPartNoList);
// List<MesCustSortInfo> allSortInfoList = mesCustSoftInfoService.queryAllCustSortInfoList(organizeCode);
//6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参 //6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参
String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundMethod()); String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundMethod());
if (sortInfoList.isEmpty()){ if (sortInfoList.isEmpty()){
@ -122,6 +130,23 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
} }
private void updateCustsort(String organizeCode, List<MesPartProdGroup> mesPartProdGroups) {
List<MesPartProdGroupDetail> allDetails = new ArrayList<>();
for (MesPartProdGroup prodGroup : mesPartProdGroups) {
List<MesPartProdGroupDetail> details = mesPartProdGroupService.findDetailByCode(prodGroup.getPartProdGroupCode(), organizeCode);
allDetails.addAll(details);
}
List<String> allCustPartNoList = allDetails.stream().map(MesPartProdGroupDetail::getCustPartNo).distinct().collect(Collectors.toList());
List<MesCustSortInfo> allCustSortInfoList = mesCustSoftInfoService.queryAllCustSortInfoList(organizeCode);
for (MesCustSortInfo mesCustSortInfo : allCustSortInfoList) {
if (!allCustPartNoList.contains(mesCustSortInfo.getCustPartNo())) {
String msg = String.format("客户零件号:%s,零件号:%s,未配置零件生产组明细", mesCustSortInfo.getCustPartNo(), mesCustSortInfo.getErpPartNo());
mesCustSortInfo.setDescription(msg);
}
}
mesCustSoftInfoRepository.saveAll(allCustSortInfoList);
}
/** /**
* *
* @param infoPointCode * @param infoPointCode

@ -33,10 +33,25 @@ public class MesCustSoftInfoServiceImpl extends BaseMesService<MesCustSortInfo>
} }
@Override @Override
public List<MesCustSortInfo> queryAllCustSortInfoList(String organizeCode) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),"serviceFlag", ddlPackBean);
return baseRDao.findByHqlWhere(ddlPackBean);
}
@Override
public void updateCustSortInfo(MesCustSortInfo custSortInfo) { public void updateCustSortInfo(MesCustSortInfo custSortInfo) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(custSortInfo.getOrganizeCode()); DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(custSortInfo.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(custSortInfo.getId(),"id",ddlPackBean); DdlPreparedPack.getNumEqualPack(custSortInfo.getId(),"id",ddlPackBean);
baseRDao.updateByProperties(new String[]{"serviceFlag","modifyUser","modifyDatetime"},new Object[]{CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),"edi", TimeTool.getNowTime(true)},ddlPackBean); baseRDao.updateByPropertiesNoSync(new String[]{"serviceFlag","modifyUser","modifyDatetime"},new Object[]{CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),"edi", TimeTool.getNowTime(true)},ddlPackBean);
}
@Override
public void updateMsgCustSortInfo(MesCustSortInfo custSortInfo) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(custSortInfo.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(custSortInfo.getId(),"id",ddlPackBean);
baseRDao.updateByProperties(new String[]{"description","modifyUser","modifyDatetime"},new Object[]{custSortInfo.getDescription(),"edi", TimeTool.getNowTime(true)},ddlPackBean);
} }
} }

@ -0,0 +1,61 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesCustomerPartTypeService;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPartType;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/11/5 17:25
* @Modify:
**/
@Service
@Slf4j
public class MesCustomerPartTypeServiceImpl extends BaseMesService<MesCustomerPartType> implements IMesCustomerPartTypeService {
@Override
protected void onInsertBean(MesCustomerPartType item) {
checkData(item);
}
@Override
protected void onUpdateBean(MesCustomerPartType item) {
checkData(item);
}
@Override
protected void setPackQueryBean(MesCustomerPartType bean, DdlPackBean packBean) {
DdlPreparedPack.getStringLikerPack(bean.getPartTypeCode(), "partTypeCode", packBean);
DdlPreparedPack.getStringLikerPack(bean.getPartTypeName(), "partTypeName", packBean);
DdlPreparedPack.getStringLikerPack(bean.getCustPartNo(), "custPartNo", packBean);
DdlPreparedPack.getStringLikerPack(bean.getCustPartName(), "custPartName", packBean);
DdlPreparedPack.getStringLikerPack(bean.getCustCode(), "custCode", packBean);
}
private void checkData(MesCustomerPartType item) {
// 数据校验
ValidatorBean.checkNotNull(item.getPartTypeCode(), "零件类型代码不能为空");
ValidatorBean.checkNotNull(item.getCustPartNo(), "客户物料号不能为空");
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "partTypeCode", seriesPackBean);
DdlPreparedPack.getStringEqualPack(item.getCustPartNo(), "custPartNo", seriesPackBean);
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", seriesPackBean);
boolean flg = baseRDao.isExitByHql(seriesPackBean);
if (flg) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("类型【%s】客户零件【%s】数据已存在请检查数据", item.getPartTypeCode(), item.getCustPartNo())
.build();
}
}
}

@ -46,6 +46,9 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
//43326 电子化检验发送给QMS的数据按照零件号+责任人类型分组发送 //43326 电子化检验发送给QMS的数据按照零件号+责任人类型分组发送
Map<String, List<MesPartInspection>> workOrderPartMap = mesPartInspectionList.stream().collect(Collectors.groupingBy(p -> p.getPartNo() +"="+p.getResponsibleParty())); Map<String, List<MesPartInspection>> workOrderPartMap = mesPartInspectionList.stream().collect(Collectors.groupingBy(p -> p.getPartNo() +"="+p.getResponsibleParty()));
//根据物料对可疑品分组 //根据物料对可疑品分组
List<MesQmsScrap> qmsScrapList = new ArrayList<>();
log.info("一共需要汇总{}条报废数据2", workOrderPartMap.size());
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : workOrderPartMap.entrySet()) { for (Map.Entry<String, List<MesPartInspection>> stringListEntry : workOrderPartMap.entrySet()) {
String keyPartNo = stringListEntry.getKey().split("=")[0]; String keyPartNo = stringListEntry.getKey().split("=")[0];
List<MesPartInspection> mesPartInspections = stringListEntry.getValue(); List<MesPartInspection> mesPartInspections = stringListEntry.getValue();
@ -69,8 +72,10 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
mesQmsScrap.setReponsibilityId(next.getResponsibleParty()); mesQmsScrap.setReponsibilityId(next.getResponsibleParty());
mesQmsScrap.setNcJudger(next.getModifyUser()); mesQmsScrap.setNcJudger(next.getModifyUser());
ConvertBean.serviceModelInitialize(mesQmsScrap, "MesScrapJob"); ConvertBean.serviceModelInitialize(mesQmsScrap, "MesScrapJob");
qmsScrapList.add(mesQmsScrap);
baseRDao.insert(mesQmsScrap);
} }
log.info("一共需要汇总{}条报废数据3", qmsScrapList.size());
baseRDao.saveAll(qmsScrapList);
} }
} }

@ -74,6 +74,8 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
DdlPreparedPack.getStringLikerPack(bean.getRemark(), "remark", packBean); DdlPreparedPack.getStringLikerPack(bean.getRemark(), "remark", packBean);
DdlPreparedPack.getNumEqualPack(bean.getStatus(), "status", packBean); DdlPreparedPack.getNumEqualPack(bean.getStatus(), "status", packBean);
DdlPreparedPack.getInPackArray(bean.getStatusArray(), "status", packBean); DdlPreparedPack.getInPackArray(bean.getStatusArray(), "status", packBean);
DdlPreparedPack.getStringBiggerPack(bean.getPlanArriveEndTimeStart(), "planArriveEndTime", packBean);
DdlPreparedPack.getStringSmallerPack(bean.getPlanArriveEndTimeEnd(), "planArriveEndTime", packBean);
if (!StringUtils.isEmpty(bean.getReleaseTimeStart()) || !StringUtils.isEmpty(bean.getReleaseTimeEnd())) { if (!StringUtils.isEmpty(bean.getReleaseTimeStart()) || !StringUtils.isEmpty(bean.getReleaseTimeEnd())) {
DdlPreparedPack.timeBuilder(bean.getReleaseTimeStart(), bean.getReleaseTimeEnd(), "releaseTime", packBean, false); DdlPreparedPack.timeBuilder(bean.getReleaseTimeStart(), bean.getReleaseTimeEnd(), "releaseTime", packBean, false);
} }

@ -1255,11 +1255,11 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
// 根据id 获取工单数据 // 根据id 获取工单数据
List<MesWorkOrder> mesWorkOrderList = getMesWorkOrderList(ids, organizeCode); List<MesWorkOrder> mesWorkOrderList = getMesWorkOrderList(ids, organizeCode);
return packPrintResultMap(organizeCode, mesWorkOrderList, userName); return packPrintResultMap(organizeCode, mesWorkOrderList, userName,false);
} }
private List<Map<String, Object>> packPrintResultMap(String organizeCode, List<MesWorkOrder> mesWorkOrderList, String userName) { private List<Map<String, Object>> packPrintResultMap(String organizeCode, List<MesWorkOrder> mesWorkOrderList, String userName,Boolean isShow) {
// 根据工单号对工单分组 // 根据工单号对工单分组
Map<String, MesWorkOrder> workOrderMapByWorkOrderNo = mesWorkOrderList.stream().collect(Collectors.toMap(MesWorkOrder::getWorkOrderNo, Function.identity(), (x, y) -> y)); Map<String, MesWorkOrder> workOrderMapByWorkOrderNo = mesWorkOrderList.stream().collect(Collectors.toMap(MesWorkOrder::getWorkOrderNo, Function.identity(), (x, y) -> y));
@ -1311,7 +1311,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
MesException.throwMesBusiException("工单【%s】关联零件生产组【%s】打印模板为空", mesWorkOrder.getWorkOrderNo(), mesWorkOrder.getPartProdGroupCode()); MesException.throwMesBusiException("工单【%s】关联零件生产组【%s】打印模板为空", mesWorkOrder.getWorkOrderNo(), mesWorkOrder.getPartProdGroupCode());
} }
MesLabelTemplate labelTemplate = labelTemplateService.getLabelTemplate(printTemplate, organizeCode); MesLabelTemplate labelTemplate = labelTemplateService.getLabelTemplate(isShow ? printTemplate + "_SHOW" : printTemplate, organizeCode);
//模板信息丢失抛出异常 //模板信息丢失抛出异常
if (Objects.isNull(labelTemplate) || StringUtils.isEmpty(labelTemplate.getMethodCode())) { if (Objects.isNull(labelTemplate) || StringUtils.isEmpty(labelTemplate.getMethodCode())) {
MesException.throwMesBusiException("工单【%s】关联零件生产组【%s】打印模板【%s】为空", mesWorkOrder.getWorkOrderNo(), mesWorkOrder.getPartProdGroupCode(), labelTemplate.getTemplateCode()); MesException.throwMesBusiException("工单【%s】关联零件生产组【%s】打印模板【%s】为空", mesWorkOrder.getWorkOrderNo(), mesWorkOrder.getPartProdGroupCode(), labelTemplate.getTemplateCode());
@ -1379,7 +1379,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
List<MesWorkOrder> workOrderList = new ArrayList<>(); List<MesWorkOrder> workOrderList = new ArrayList<>();
workOrderList.add(workOrder); workOrderList.add(workOrder);
return packPrintResultMap(organizeCode, workOrderList, userName); return packPrintResultMap(organizeCode, workOrderList, userName,true);
} }
private Map<String, MesCustomerCarModel> getMesCustomerCarModelMap(String organizeCode, List<MesWorkOrder> workOrderList) { private Map<String, MesCustomerCarModel> getMesCustomerCarModelMap(String organizeCode, List<MesWorkOrder> workOrderList) {

@ -9,6 +9,7 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.*; import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
@ -112,11 +113,28 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
//看看多少倍乘以圆整数量就是需求数QTY就是多累积数 //看看多少倍乘以圆整数量就是需求数QTY就是多累积数
multiple = (int) Math.round(Math.ceil(Math.ceil(qty / roundQty))); multiple = (int) Math.round(Math.ceil(Math.ceil(qty / roundQty)));
} }
if (StringUtil.isEmpty(detail.getProductPartNo())) {
String msg = String.format("零件生生产组:%s,客户零件号:%s没有配置生产零件号", detail.getPartProdGroupName(), detail.getCustPartNo());
log.info("零件生生产组:{},客户零件号:{}s没有配置生产零件号", partProdGroup.getPartProdGroupName(), detail.getCustPartNo());
//更新 custSortInfo 状态已解析
for (MesCustSortInfo sortInfo : sortInfos) {
sortInfo.setDescription(msg);
custSoftInfoService.updateMsgCustSortInfo(sortInfo);
}
continue;
}
//获取生产零件信息 //获取生产零件信息
MesPartSap mesPartSap = getMesPart(detail.getProductPartNo(), detail.getOrganizeCode()); MesPartSap mesPartSap = getMesPart(detail.getProductPartNo(), detail.getOrganizeCode());
if (mesPartSap.getId() == null) { if (mesPartSap.getId() == null) {
String msg = String.format("零件生生产组:%s,生产零件:%s找不到对应的零件信息", partProdGroup.getPartProdGroupName(), detail.getProductPartNo());
log.info("零件生生产组:{},生产零件:{}找不到对应的零件信息", partProdGroup.getPartProdGroupName(), detail.getProductPartNo()); log.info("零件生生产组:{},生产零件:{}找不到对应的零件信息", partProdGroup.getPartProdGroupName(), detail.getProductPartNo());
//更新 custSortInfo 状态已解析
for (MesCustSortInfo sortInfo : sortInfos) {
sortInfo.setDescription(msg);
custSoftInfoService.updateMsgCustSortInfo(sortInfo);
}
continue; continue;
// throw ImppExceptionBuilder.newInstance().setErrorDetail("零件生成组零件:{}找不到对应的零件信息", detail.getProductPartNo()).build(); // throw ImppExceptionBuilder.newInstance().setErrorDetail("零件生成组零件:{}找不到对应的零件信息", detail.getProductPartNo()).build();
} }
@ -152,7 +170,8 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
DdlPreparedPack.getStringEqualPack(detail.getWorkCenterCode(), "workCenterCode", workCenterPackBean); DdlPreparedPack.getStringEqualPack(detail.getWorkCenterCode(), "workCenterCode", workCenterPackBean);
List<MesWorkCenter> centerList = mesWorkCenterRao.findByHqlWhere(workCenterPackBean); List<MesWorkCenter> centerList = mesWorkCenterRao.findByHqlWhere(workCenterPackBean);
if (!centerList.isEmpty()) { if (!centerList.isEmpty()) {
mesWorkOrder.setErpWorkCenter(centerList.get(0).getErpWorkCenter()); // 2024-10-30 BTO的工作中心需要用生产版本的工作中心而不是取的产线
//mesWorkOrder.setErpWorkCenter(centerList.get(0).getErpWorkCenter());
} }
//产线 //产线
mesWorkOrder.setWorkCenterCode(detail.getWorkCenterCode()); mesWorkOrder.setWorkCenterCode(detail.getWorkCenterCode());
@ -210,6 +229,7 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
}else { }else {
String productVersion = prodVersion.getProductVersion(); String productVersion = prodVersion.getProductVersion();
mesWorkOrder.setProductVersion(productVersion); mesWorkOrder.setProductVersion(productVersion);
mesWorkOrder.setErpWorkCenter(prodVersion.getWorkCenterCode());
} }
// 14.bomCode partNo + 生产版本+ organizeCode // 14.bomCode partNo + 生产版本+ organizeCode
// 数量 // 数量

Loading…
Cancel
Save