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

dev-temp-xw-202501150000-44852
jun 4 months ago
commit cf77b07eda

@ -0,0 +1,7 @@
package cn.estsh.i3plus.ext.mes.api.base;
import cn.estsh.i3plus.pojo.mes.bean.MesPackingRuleDetail;
public interface IMesPackingRuleDetailService extends IBaseMesService<MesPackingRuleDetail> {
}

@ -0,0 +1,7 @@
package cn.estsh.i3plus.ext.mes.api.base;
import cn.estsh.i3plus.pojo.mes.bean.MesPackingRule;
public interface IMesPackingRuleService extends IBaseMesService<MesPackingRule> {
}

@ -1,10 +1,26 @@
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.excel.MesExcelTool;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesAssemblyNosortCfg;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import cn.estsh.impp.framework.boot.util.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
@ -13,4 +29,36 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesAssemblyNosortCfg")
public class MesAssemblyNosortCfgController extends BaseMesController<MesAssemblyNosortCfg>{
@PostMapping(value = "/import-data")
@ApiOperation(value = "导入数据")
public ResultBean importNew(@RequestParam("file") MultipartFile file, @RequestParam("sourceId")Long sourceId) {
try {
MesExcelTool excelTool = new MesExcelTool(entityManager, RedisCacheTool.getImppRedis());
List<MesAssemblyNosortCfg> beanList = excelTool.importData(file.getOriginalFilename(), file.getInputStream(), mesClass);
beanList.forEach(mesAssemblyNosortCfg -> {
mesAssemblyNosortCfg.setPid(sourceId);
});
String userName = AuthUtil.getSessionUser().getUserName();
String organizeCode = AuthUtil.getOrganize().getOrganizeCode();
// 导入数据初始化
for (MesAssemblyNosortCfg bean : beanList) {
ConvertBean.serviceModelInitialize(bean, userName);
bean.setOrganizeCode(organizeCode);
bean.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
}
baseService.insertBatch(beanList);
// 导入后
afterImport(beanList);
return ResultBean.success("导入成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -63,8 +63,8 @@ public class MesCraftRouteController extends BaseMesController<MesCraftRoute> {
MesCraftRoute.class, "MesCraftRoute", true);
List<MesCraftRouteDetail> routeDetailList = getDataAndInitValid(excelTool, file.getOriginalFilename(), file.getInputStream(),
MesCraftRouteDetail.class, "MesCraftRouteDetail", true);
//String userName = AuthUtil.getSessionUser().getUserName();
String userName ="zxw";
String userName = AuthUtil.getSessionUser().getUserName();
//String userName ="zxw";
routeList.forEach(mesCraftRoute -> {
mesCraftRoute.setOrganizeCode(organizeCode);
ConvertBean.serviceModelInitialize(mesCraftRoute,userName);

@ -0,0 +1,13 @@
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.MesPackingRule;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api("成品包装规则")
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesPackingRule")
public class MesPackingRuleController extends BaseMesController<MesPackingRule>{
}

@ -0,0 +1,13 @@
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.MesPackingRuleDetail;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api("成品包装明细规则")
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesPackingRuleDetail")
public class MesPackingRuleDetailController extends BaseMesController<MesPackingRuleDetail>{
}

@ -1,11 +1,41 @@
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleNosortCfg;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.ExcelTool;
import cn.estsh.i3plus.platform.common.tool.JsonUtilTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.repository.MesAssemblyNosortCfgRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentProdParamCfgRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesTimeEfficientCfgRepository;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import cn.estsh.impp.framework.boot.util.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
*
@ -14,4 +44,93 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesProdRuleNosortCfg")
public class MesProdRuleNosortCfgController extends BaseMesController<MesProdRuleNosortCfg>{
public static final Logger LOGGER = LoggerFactory.getLogger(MesProdRuleNosortCfgController.class);
@Autowired
private MesAssemblyNosortCfgRepository assemblyNosortCfgRepository;
@Autowired
private MesEquipmentProdParamCfgRepository equipmentProdParamCfgRepository;
@Autowired
private MesTimeEfficientCfgRepository timeEfficientCfgRepository;
@PostMapping(value = "/all/import")
@ApiOperation(value = "流程导入")
public ResultBean allImport(@RequestParam("file") MultipartFile file) {
try {
String organizeCode = AuthUtil.getOrganizeCode();
//String organizeCode = "CK01";
//数据空校验以及转换
ExcelTool excelTool = new ExcelTool(entityManager, RedisCacheTool.getImppRedis());
List<MesProdRuleNosortCfg> ruleNosortCfgList = getDataAndInitValid(excelTool, file.getOriginalFilename(), file.getInputStream(),
MesProdRuleNosortCfg.class, "MesProdRuleNosortCfg", true);
List<MesAssemblyNosortCfg> assemblyNosortCfgList = getDataAndInitValid(excelTool, file.getOriginalFilename(), file.getInputStream(),
MesAssemblyNosortCfg.class, "MesAssemblyNosortCfg", true);
List<MesEquipmentProdParamCfg> equipmentProdParamCfgList = getDataAndInitValid(excelTool, file.getOriginalFilename(), file.getInputStream(),
MesEquipmentProdParamCfg.class, "MesEquipmentProdParamCfg", true);
List<MesTimeEfficientCfg> timeEfficientCfgList = getDataAndInitValid(excelTool, file.getOriginalFilename(), file.getInputStream(),
MesTimeEfficientCfg.class, "MesTimeEfficientCfg", true);
String userName = AuthUtil.getSessionUser().getUserName();
//String userName ="zxw";
ruleNosortCfgList.forEach(ruleNosortCfg -> {
ruleNosortCfg.setOrganizeCode(organizeCode);
ConvertBean.serviceModelInitialize(ruleNosortCfg,userName);
});
List<MesProdRuleNosortCfg> ruleNosortCfgs = baseService.insertBatch(ruleNosortCfgList);
Map<String, List<MesProdRuleNosortCfg>> ruleNosortCfgMap = ruleNosortCfgs.stream().collect(Collectors.groupingBy(MesProdRuleNosortCfg::getNo));
assemblyNosortCfgList.forEach(assemblyNosortCfg -> {
List<MesProdRuleNosortCfg> mesProdRuleNosortCfgs = ruleNosortCfgMap.get(assemblyNosortCfg.getNo());
assemblyNosortCfg.setPid(mesProdRuleNosortCfgs.get(0).getId());
assemblyNosortCfg.setOrganizeCode(organizeCode);
ConvertBean.serviceModelInitialize(assemblyNosortCfg,userName);
});
assemblyNosortCfgRepository.saveAll(assemblyNosortCfgList);
equipmentProdParamCfgList.forEach(equipmentProdParamCfg -> {
List<MesProdRuleNosortCfg> mesProdRuleNosortCfgs = ruleNosortCfgMap.get(equipmentProdParamCfg.getNo());
equipmentProdParamCfg.setSourceId(mesProdRuleNosortCfgs.get(0).getId());
equipmentProdParamCfg.setOrganizeCode(organizeCode);
ConvertBean.serviceModelInitialize(equipmentProdParamCfg,userName);
});
equipmentProdParamCfgRepository.saveAll(equipmentProdParamCfgList);
timeEfficientCfgList.forEach(timeEfficientCfg -> {
List<MesProdRuleNosortCfg> mesProdRuleNosortCfgs = ruleNosortCfgMap.get(timeEfficientCfg.getNo());
timeEfficientCfg.setSourceId(mesProdRuleNosortCfgs.get(0).getId());
timeEfficientCfg.setOrganizeCode(organizeCode);
ConvertBean.serviceModelInitialize(timeEfficientCfg,userName);
});
timeEfficientCfgRepository.saveAll(timeEfficientCfgList);
return ResultBean.success("导入成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
* SHEET
*
* @param excelTool
* @param fileName
* @param inputStream
* @param dataBean
* @param sheetName
* @param <T>
* @return
* @throws Exception
*/
private <T> List<T> getDataAndInitValid(ExcelTool excelTool, String fileName, InputStream inputStream,
Class<T> dataBean, String sheetName, boolean isCheckDataEmpty) throws Exception {
List<T> beanList = excelTool.importData(fileName, inputStream, dataBean, sheetName);
LOGGER.info("导入的【" + sheetName + "】数据" + JsonUtilTool.getJSONArrayByList(beanList));
if (isCheckDataEmpty && CollectionUtils.isEmpty(beanList)) {
MesException.throwBusiException(String.format("导入的【%s】数据为空", sheetName));
}
return beanList;
}
}

@ -15,6 +15,6 @@ import java.util.List;
**/
public interface IMesProductionRecordReportExtDao {
ListPager<MesProductionRecordReportExtModel> queryProductionRecordUnionWorkOrderLogReport(MesProductionRecordReportExtModel model, Pager pager, List<Integer> reportStatusList);
ListPager<MesProductionRecordReportExtModel> queryProductionRecordUnionWorkOrderLogReport(MesProductionRecordReportExtModel model, Pager pager, List<Integer> reportStatusList2Pr, List<Integer> reportStatusList2Wo);
}

@ -34,7 +34,8 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
private EntityManager entityManager;
@Override
public ListPager<MesProductionRecordReportExtModel> queryProductionRecordUnionWorkOrderLogReport(MesProductionRecordReportExtModel model, Pager pager, List<Integer> reportStatusList) {
public ListPager<MesProductionRecordReportExtModel> queryProductionRecordUnionWorkOrderLogReport(
MesProductionRecordReportExtModel model, Pager pager, List<Integer> reportStatusList2Pr, List<Integer> reportStatusList2Wo) {
List<MesProductionRecordReportExtModel> resultList = new ArrayList<>();
@ -48,7 +49,7 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
StringBuilder endHql = new StringBuilder();
StringBuilder limitHql = new StringBuilder();
if (!CollectionUtils.isEmpty(reportStatusList) && model.getIsQueryWo()) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr) && !CollectionUtils.isEmpty(reportStatusList2Wo)) {
unionQueryHql.append("SELECT " +
" o.workCenterCode, " +
" o.workCellCode, " +
@ -70,7 +71,7 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
countQueryHql.append("SELECT count(1) FROM ( ");
}
if (!CollectionUtils.isEmpty(reportStatusList)) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr)) {
prQueryHql.append("" +
" SELECT " +
" a.work_center_code AS workCenterCode, " +
@ -92,7 +93,7 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
" AND a.is_valid = :isValid " +
" AND a.complete_date_time >= :completeDateTimeStart " +
" AND a.complete_date_time <= :completeDateTimeEnd ");
if (reportStatusList.size() == 1) {
if (reportStatusList2Pr.size() == 1) {
prQueryHql.append(" AND a.report_status = :reportStatus ");
} else {
prQueryHql.append(" AND a.report_status in (:reportStatus) ");
@ -123,11 +124,11 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
}
if (!CollectionUtils.isEmpty(reportStatusList) && model.getIsQueryWo()) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr) && !CollectionUtils.isEmpty(reportStatusList2Wo)) {
prQueryHql.append(" ) UNION ALL ( ");
}
if (model.getIsQueryWo()) {
if (!CollectionUtils.isEmpty(reportStatusList2Wo)) {
woQueryHql.append("" +
" SELECT " +
" b.work_center_code AS workCenterCode, " +
@ -137,7 +138,7 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
" b.shift_code AS shiftCode, " +
" ' ' AS equipmentCode, " +
" ' ' AS equipmentName, " +
" 30 AS reportStatus, " +
" b.type AS reportStatus, " +
" 2 AS dataSource, " +
" SUM( modify_qty ) AS statisticsQty " +
" FROM ");
@ -148,8 +149,12 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
" AND b.is_deleted = :isDeleted " +
" AND b.is_valid = :isValid " +
" AND b.modify_date_time >= :completeDateTimeStart " +
" AND b.modify_date_time <= :completeDateTimeEnd " +
" AND b.type = :messageType ");
" AND b.modify_date_time <= :completeDateTimeEnd ");
if (reportStatusList2Wo.size() == 1) {
woQueryHql.append(" AND b.type = :messageType ");
} else {
woQueryHql.append(" AND b.type in (:messageType) ");
}
if (!StringUtils.isEmpty(model.getPartNo())) {
woQueryHql.append(" AND b.part_no = :partNo ");
}
@ -168,7 +173,7 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
}
if (!CollectionUtils.isEmpty(reportStatusList) && model.getIsQueryWo()) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr) && !CollectionUtils.isEmpty(reportStatusList2Wo)) {
endHql.append(" )) AS o ");
} else {
endHql.append(" ) AS o ");
@ -176,11 +181,11 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
limitHql.append(" LIMIT :startRow , :pageSize ");
if (!CollectionUtils.isEmpty(reportStatusList) && model.getIsQueryWo()) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr) && !CollectionUtils.isEmpty(reportStatusList2Wo)) {
queryHql.append(unionQueryHql).append(prQueryHql).append(woQueryHql).append(endHql).append(limitHql);
countHql.append(countQueryHql).append(prQueryHql).append(woQueryHql).append(endHql);
} else {
if (!CollectionUtils.isEmpty(reportStatusList)) {
if (!CollectionUtils.isEmpty(reportStatusList2Pr)) {
queryHql.append(prQueryHql).append(limitHql);
countHql.append(countQueryHql).append(prQueryHql).append(endHql);
} else {
@ -193,9 +198,9 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
// log.info("countHql: --- {}", countHql.toString());
Query dataQuery = entityManager.createNativeQuery(queryHql.toString());
setQueryParams(dataQuery, model, reportStatusList, pager);
setQueryParams(dataQuery, model, reportStatusList2Pr, reportStatusList2Wo, pager);
Query countQuery = entityManager.createNativeQuery(countHql.toString());
setQueryParams(countQuery, model, reportStatusList, null);
setQueryParams(countQuery, model, reportStatusList2Pr, reportStatusList2Wo, null);
Object o = countQuery.getSingleResult();
@ -219,7 +224,9 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
if (result.getDataSource().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) {
if (result.getReportStatus().compareTo(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue()) == 0) result.setReportStatusName(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getDescription());
else result.setReportStatusName(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getDescription());
} else result.setReportStatusName(MesExtEnumUtil.WORK_ORDER_LOG_TYPE.REPORT.getDescription());
} else {
result.setReportStatusName(MesExtEnumUtil.WORK_ORDER_LOG_TYPE.valueOfDescription(result.getReportStatus()));
}
}
resultList.add(result);
@ -231,20 +238,26 @@ public class MesProductionRecordReportExtDao implements IMesProductionRecordRepo
}
private void setQueryParams(Query query, MesProductionRecordReportExtModel model, List<Integer> reportStatusList, Pager pager) {
private void setQueryParams(Query query, MesProductionRecordReportExtModel model, List<Integer> reportStatusList2Pr, List<Integer> reportStatusList2Wo, Pager pager) {
query.setParameter(MesExtConstWords.ORGANIZE_CODE, model.getOrganizeCode());
query.setParameter(MesExtConstWords.IS_DELETED, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
query.setParameter(MesExtConstWords.IS_VALID, CommonEnumUtil.IS_VAILD.VAILD.getValue());
query.setParameter(MesExtConstWords.COMPLETE_DATE_TIME_START, model.getCompleteDateTimeStart());
query.setParameter(MesExtConstWords.COMPLETE_DATE_TIME_END, model.getCompleteDateTimeEnd());
if (!CollectionUtils.isEmpty(reportStatusList)) {
if (reportStatusList.size() == 1) {
query.setParameter(MesExtConstWords.REPORT_STATUS, reportStatusList.get(0));
if (!CollectionUtils.isEmpty(reportStatusList2Pr)) {
if (reportStatusList2Pr.size() == 1) {
query.setParameter(MesExtConstWords.REPORT_STATUS, reportStatusList2Pr.get(0));
} else {
query.setParameter(MesExtConstWords.REPORT_STATUS, reportStatusList2Pr);
}
}
if (!CollectionUtils.isEmpty(reportStatusList2Wo)) {
if (reportStatusList2Wo.size() == 1) {
query.setParameter(MesExtConstWords.MESSAGE_TYPE, reportStatusList2Wo.get(0));
} else {
query.setParameter(MesExtConstWords.REPORT_STATUS, reportStatusList);
query.setParameter(MesExtConstWords.MESSAGE_TYPE, reportStatusList2Wo);
}
}
if (model.getIsQueryWo()) query.setParameter(MesExtConstWords.MESSAGE_TYPE, MesExtEnumUtil.WORK_ORDER_LOG_TYPE.REPORT.getValue());
if (!StringUtils.isEmpty(model.getPartNo())) {
query.setParameter(MesExtConstWords.PART_NO, model.getPartNo());
}

@ -23,7 +23,7 @@ public class MesAssemblyNosortCfgService extends BaseMesService<MesAssemblyNosor
for (MesAssemblyNosortCfg item : beanList) {
// 数据校验
ValidatorBean.checkNotNull(item.getPid(), "非排序加工规则ID");
ValidatorBean.checkNotNull(item.getPid(), "非排序加工规则ID不能为空");
ValidatorBean.checkNotNull(item.getAssemblyPartNo(), "原料零件号不能为空");
}

@ -230,7 +230,9 @@ public class MesBomService extends BaseMesService<MesBom> implements IMesBomServ
public MesBom findBom(String organizeCode, String bomVersion, String partNo) {
DdlPackBean bomPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(partNo, MesExtConstWords.PART_NO, bomPackBean);
if (bomVersion != null){
DdlPreparedPack.getStringEqualPack(bomVersion, MesExtConstWords.BOM_VERSION, bomPackBean);
}
DdlPreparedPack.getOrderBy(MesExtConstWords.EFF_START_TIME, CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), bomPackBean);
List<MesBom> bomList = this.baseRDao.findByHqlTopWhere(bomPackBean,1);
return bomList.isEmpty() ? null : bomList.get(0);

@ -0,0 +1,22 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesPackingRuleDetailService;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesPackingRuleDetail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class MesPackingRuleDetailService extends BaseMesService<MesPackingRuleDetail> implements IMesPackingRuleDetailService {
@Override
protected void setPackQueryBean(MesPackingRuleDetail bean, DdlPackBean packBean) {
DdlPreparedPack.getStringLikerPack(bean.getPackageCode(), MesExtConstWords.PACKAGE_CODE, packBean);
DdlPreparedPack.getStringLikerPack(bean.getPartNo(), MesExtConstWords.PART_NO, packBean);
DdlPreparedPack.getStringEqualPack(bean.getPartType(), MesExtConstWords.PART_TYPE, packBean);
}
}

@ -0,0 +1,26 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesPackingRuleService;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesPackingRule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class MesPackingRuleService extends BaseMesService<MesPackingRule> implements IMesPackingRuleService {
@Override
protected void setPackQueryBean(MesPackingRule bean, DdlPackBean packBean) {
DdlPreparedPack.getStringLikerPack(bean.getPackageCode(), MesExtConstWords.PACKAGE_CODE, packBean);
DdlPreparedPack.getNumEqualPack(bean.getDefaultFlag(), MesExtConstWords.DEFAULT_FLAG, packBean);
DdlPreparedPack.getNumEqualPack(bean.getGenerateType(), MesExtConstWords.GENERATE_TYPE, packBean);
DdlPreparedPack.getStringLikerPack(bean.getPackCode(), MesExtConstWords.PACK_CODE, packBean);
DdlPreparedPack.getStringLikerPack(bean.getPackageBarcodeRule(), MesExtConstWords.PACKAGE_BARCODE_RULE, packBean);
DdlPreparedPack.getStringLikerPack(bean.getPackageTemplate(), MesExtConstWords.PACKAGE_TEMPLATE, packBean);
DdlPreparedPack.getStringLikerPack(bean.getPrinter(), MesExtConstWords.PRINTER, packBean);
}
}

@ -5,10 +5,16 @@ 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.MesDefectType;
import cn.estsh.i3plus.pojo.mes.bean.MesPartType;
import cn.estsh.i3plus.pojo.mes.bean.MesPartTypeDefect;
import cn.estsh.i3plus.pojo.mes.repository.MesDefectTypeRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesPartTypeRepository;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@ -17,6 +23,11 @@ import java.util.List;
@Slf4j
public class MesPartTypeDefectService extends BaseMesService<MesPartTypeDefect> implements IBaseMesService<MesPartTypeDefect> {
@Autowired
private MesPartTypeRepository partTypeRepository;
@Autowired
private MesDefectTypeRepository defectTypeRepository;
@Override
protected void setPackQueryBean(MesPartTypeDefect bean, DdlPackBean packBean) {
@ -87,4 +98,52 @@ public class MesPartTypeDefectService extends BaseMesService<MesPartTypeDefect>
}
}
}
@Override
public List<MesPartTypeDefect> validateReturnImport(List<MesPartTypeDefect> beanList) {
for (MesPartTypeDefect item : beanList) {
// 数据校验
ValidatorBean.checkNotNull(item.getDefectTypeCode(), "缺陷类型不能为空");
ValidatorBean.checkNotNull(item.getPartTypeCode(), "零件类型不能为空");
DdlPackBean roadPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getDefectTypeCode(), "defectTypeCode", roadPackBean);
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "partTypeCode", roadPackBean);
boolean flg = baseRDao.isExitByHql(roadPackBean);
if (flg) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("缺陷类型【%s】零件类型【%s】已经存在请检查数据", item.getDefectTypeCode(), item.getPartTypeCode())
.build();
}
DdlPackBean partTypePackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "partTypeCode", partTypePackBean);
MesPartType partType = partTypeRepository.getByProperty(partTypePackBean);
if (partType == null) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("零件类型【%s】不存在请检查数据", item.getPartTypeCode())
.build();
}
item.setPartTypeName(partType.getPartTypeName());
DdlPackBean defectTypePackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "defectTypeCode", defectTypePackBean);
MesDefectType defectType = defectTypeRepository.getByProperty(defectTypePackBean);
if (defectTypeRepository == null) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("缺陷类型【%s】不存在请检查数据", item.getPartTypeCode())
.build();
}
item.setDefectTypeName(defectType.getDefectTypeName());
}
return beanList;
}
}

@ -92,9 +92,15 @@ public class MesSortRuleCfgOfflineServiceImpl implements IMesSortRuleCfgOfflineS
if (count > 0){
return;
}
MesProductVersion mesProductVersion = getMesProductVersion(productPartNo, organizeCode);
MesProductVersion mesProductVersion= null;
if (mesPartProdGroup.getEnableBomVersion() == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()){
mesProductVersion = getMesProductVersion(productPartNo, organizeCode);
}
//4.总成零件号打散bom
String bomVersion = mesProductVersion.getAlternativePartList();
String bomVersion = null;
if (mesProductVersion != null){
bomVersion = mesProductVersion.getAlternativePartList();
}
MesBom bom = mesBomService.findBom(organizeCode, bomVersion, productPartNo);
if (bom == null) {
return;
@ -109,6 +115,9 @@ public class MesSortRuleCfgOfflineServiceImpl implements IMesSortRuleCfgOfflineS
}
//5.打散的bom 获取排序加工规则
List<MesWorkOrderPart> workOrderPartList = dismantleBom(productPartNo, 1, TimeTool.getNowTime(true), bom.getBomCode(), organizeCode, detail.getWorkCellCode());
if (workOrderPartList.isEmpty()){
return;
}
//6.装配件获取的三种条件
String custCode = mesCustomerPart.getCustCode();
MesCustomerCarModel mesCustomerCarModel = getMesCustomerCarModel(custPartNo, organizeCode, custCode);
@ -257,7 +266,7 @@ public class MesSortRuleCfgOfflineServiceImpl implements IMesSortRuleCfgOfflineS
ddlPackBean.setOrderByStr(" order by createDatetime desc ");
List<MesProductVersion> mesProductVersionList = mesProductVersionRDao.findByHqlTopWhere(ddlPackBean, 1);
if (Objects.isNull(mesProductVersionList) || mesProductVersionList.isEmpty()) {
MesException.throwMesBusiException("物料【%s】对应的生产版本信息不存在", partNo);
return null;
}
return mesProductVersionList.get(0);
}

@ -36,11 +36,15 @@ public class MesProductionRecordReportExtService implements IMesProductionRecord
public ListPager<MesProductionRecordReportExtModel> queryProductionRecordUnionWorkOrderLogReport(MesProductionRecordReportExtModel model, Pager pager) {
List<Integer> reportStatusList = !StringUtils.isEmpty(model.getReportStatusList())
? Arrays.asList(model.getReportStatusList().split(MesExtConstWords.COMMA)).stream().map(Integer::parseInt).collect(Collectors.toList())
: Stream.of(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_10.getValue(),
MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_20.getValue(), MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_30.getValue()).collect(Collectors.toList());
? Arrays.asList(model.getReportStatusList().split(MesExtConstWords.COMMA)).stream().map(Integer::parseInt).collect(Collectors.toList()) :
Stream.of(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_10.getValue(),
MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_20.getValue(),
MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_30.getValue(),
MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_40.getValue()
).collect(Collectors.toList());
List<Integer> reportStatusList2Pr = null;
List<Integer> reportStatusList2Wo = null;
if (reportStatusList.contains(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_10.getValue())) {
reportStatusList2Pr = new ArrayList<>();
reportStatusList2Pr.add(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue());
@ -51,10 +55,13 @@ public class MesProductionRecordReportExtService implements IMesProductionRecord
reportStatusList2Pr.add(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue());
}
if (StringUtils.isEmpty(model.getWorkCellCode()) && StringUtils.isEmpty(model.getEquipmentCode()) &&
reportStatusList.contains(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_30.getValue())) model.setIsQueryWo(true);
if (StringUtils.isEmpty(model.getWorkCellCode()) && StringUtils.isEmpty(model.getEquipmentCode())) {
reportStatusList2Wo = new ArrayList<>();
if (reportStatusList.contains(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_30.getValue())) reportStatusList2Wo.add(MesExtEnumUtil.WORK_ORDER_LOG_TYPE.REPORT.getValue());
if (reportStatusList.contains(MesExtEnumUtil.PRODUCTION_RECORD_QUREY_REPORT_STATUS.REPORT_STATUS_40.getValue())) reportStatusList2Wo.add(MesExtEnumUtil.WORK_ORDER_LOG_TYPE.REPORT_ADJUST.getValue());
}
ListPager<MesProductionRecordReportExtModel> listPager = productionRecordReportExtDao.queryProductionRecordUnionWorkOrderLogReport(model, pager, reportStatusList2Pr);
ListPager<MesProductionRecordReportExtModel> listPager = productionRecordReportExtDao.queryProductionRecordUnionWorkOrderLogReport(model, pager, reportStatusList2Pr, reportStatusList2Wo);
return listPager;

@ -59,9 +59,6 @@ public class MesProductionRecordReportExtModel implements Serializable {
@ApiParam("汇报状态名称")
private String reportStatusName;
@ApiParam("是否查询工单日志表")
private Boolean isQueryWo = false;
public MesProductionRecordReportExtModel() {}
public MesProductionRecordReportExtModel(Object workCenterCode, Object workCellCode, Object partNo, Object partName, Object shiftCode, Object equipmentCode, Object equipmentName, Object reportStatus, Object dataSource, Object qty) {

@ -225,7 +225,20 @@ public class MesExtConstWords {
public static final String REWORK_ORDER = "reworkOrder";
//零件类别
public static final String PART_TYPE_CODE = "partTypeCode";
//包装代码
public static final String PACKAGE_CODE = "packageCode";
//统计方式
public static final String GENERATE_TYPE = "generateType";
//箱类别代号
public static final String PACK_CODE = "packCode";
//包装条码编码规则
public static final String PACKAGE_BARCODE_RULE = "packageBarcodeRule";
//包装条码模板
public static final String PACKAGE_TEMPLATE = "packageTemplate";
//是否默认
public static final String DEFAULT_FLAG = "defaultFlag";
//零件类型
public static final String PART_TYPE = "partType";
//时间[开始/结束]条件
public static final String START_TIME_START = "startTimeStart";

Loading…
Cancel
Save