Merge branch 'dev' into dev-wuhan

# Conflicts:
#	modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/MesWorkOrderService.java
tags/yfai-mes-ext-v2.3
jun 7 months ago
commit 94a22fa575

@ -39,6 +39,15 @@ public interface IMesBomService extends IBaseMesService<MesBom> {
@ApiOperation(value = "查询BOM树结构")
ListPager<MesBom> queryMesDataTree(MesBom bom, Pager pager);
/**
* MES
*
* @param bom
* @return
*/
@ApiOperation(value = "查询BOM树结构平铺")
ListPager<MesBom> queryMesDataTreeAll(MesBom bom, Pager pager);
@ApiOperation(value = "查询bom信息")
List<MesBom> findMesBomByPartNoAndBomVersion(String partNo, String organizeCode, String bomVersion);

@ -153,6 +153,7 @@ public abstract class BaseMesController<T extends BaseBean> extends BaseControll
public ResultBean<T> queryByPager(T bean, Pager pager) {
try {
bean.setOrganizeCode(AuthUtilExt.getOrganizeCode());
//bean.setOrganizeCode("ck01");
ListPager<T> listPager = getBaseService().queryPager(bean, pager);
return ResultBean.success("操作成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())

@ -89,4 +89,23 @@ public class MesBomController extends BaseMesController<MesBom> {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping(value = "/tree/queryAll")
@ApiOperation(value = "查询MES组织模型数据返回树结构-获取所有")
public ResultBean queryMesDataTreeAll(MesBom bom, Pager pager) {
try {
ValidatorBean.checkNotNull(bom.getPartNo(), "父零件号不能为空");
ValidatorBean.checkNotNull(bom.getBomVersion(), "BOM版本不能为空");
ValidatorBean.checkNotNull(bom.getBomCode(), "BOM代码不能为空");
ValidatorBean.checkNotNull(bom.getEffStartTime(), "生效时间不能为空");
bom.setOrganizeCode(AuthUtil.getOrganizeCode());
//bom.setOrganizeCode("CK01");
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setListPager(bomService.queryMesDataTreeAll(bom, pager));
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -59,6 +59,7 @@ public class MesWorkOrderController extends BaseMesController<MesWorkOrder> {
public ResultBean queryMesProdRuleByPager(MesProductVersion mesProductVersion, Pager pager){
try {
String organizeCode = AuthUtil.getOrganize().getOrganizeCode();
//String organizeCode ="CK01";
mesProductVersion.setOrganizeCode(organizeCode);
ListPager<MesProductVersion> productVersionListPager = mesWorkOrderService.queryMesProductVersionByPager(mesProductVersion, pager);
return ResultBean.success("生产版本查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).

@ -68,15 +68,19 @@ public class MesAccountJob extends BaseMesScheduleJob {
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
JSONObject jsonObject = new JSONObject();
String json = this.getJobParam();
//String json = "{\"startTime\":\"2024-09-13 07:50:00\",\"endTime\":\"2024-09-19 08:00:00\"}";
com.alibaba.fastjson.JSONObject reqJson = com.alibaba.fastjson.JSONObject.parseObject(json);
String startDateTime = reqJson.getString("startTime");
String endDateTime = reqJson.getString("endTime");
if (reqJson == null || (StringUtils.isEmpty(startDateTime) && StringUtils.isEmpty(endDateTime))) {
//String json = "{\"startTime\":\"2024-09-25 08:00:00\",\"endTime\":\"2024-09-26 08:00:00\"}";
String startDateTime = "";
String endDateTime = "";
if (StringUtils.isEmpty(json)) {
Date yesterday = TimeTool.getDateBefore(new Date(), 1);
startDateTime = FORMAT_YYYY_MM_DD.format(yesterday) + " " + " 07:50:00";
endDateTime = TimeTool.getToday() + " 08:00:00";
} else {
com.alibaba.fastjson.JSONObject reqJson = com.alibaba.fastjson.JSONObject.parseObject(json);
startDateTime = reqJson.getString("startTime");
endDateTime = reqJson.getString("endTime");
}
jsonObject.putIfAbsent("organizeCode", "CK01");
@ -96,7 +100,7 @@ public class MesAccountJob extends BaseMesScheduleJob {
//String endDateTime = TimeTool.getToday() + " 08:00:00";
//String startDateTime = "2024-09-14 07:50:00";
//String endDateTime = "2024-09-15 08:00:00";
//List<String> list = Stream.of("A88_EOL_Electric_inspection").collect(Collectors.toList());
//List<String> list = Stream.of("HT2800MIX").collect(Collectors.toList());
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
//DdlPreparedPack.getInPackList(list, "equipmentCode", ddlPackBean);
DdlPreparedPack.getNumEqualPack(10, "equipmentType", ddlPackBean);
@ -148,10 +152,13 @@ public class MesAccountJob extends BaseMesScheduleJob {
}
for (MesProductRecordLog log : recordLogs) {
if (!StringUtils.isEmpty(log.getPartNo()) && log.getEquipVariableName() != null
/*if (log.getId() == 1288497096009187355l) {
int i = 1;
}*/
/*if (!StringUtils.isEmpty(log.getPartNo()) && log.getEquipVariableName() != null
&& !log.getEquipVariableName().contains("InjDataSeries")) {
continue;
}
}*/
if (log.getType().equals("logdetail") && log.getEquipVariableName().contains("InjDataSeries")) {
if (StringUtils.isEmpty(log.getEquipVariableValue())) {
continue;

@ -101,6 +101,35 @@ public class MesBomService extends BaseMesService<MesBom> implements IMesBomServ
return new ListPager<>(resultList, pager);
}
/**
*
*
* @param bom
* @return
*/
@Override
public ListPager<MesBom> queryMesDataTreeAll(MesBom bom, Pager pager) {
MesBomTreeModel organize = new MesBomTreeModel();
organize.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
organize.setName(AuthUtil.getOrganize().getName());
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bom.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(bom.getPartNo(), "partNo", packBean);
DdlPreparedPack.getStringEqualPack(bom.getBomVersion(), "bomVersion", packBean);
DdlPreparedPack.getStringEqualPack(bom.getBomCode(), "bomCode", packBean);
DdlPreparedPack.getStringSmallerPack(bom.getEffStartTime(), "effStartTime", packBean);
packBean.setOrderByStr(" order by createDatetime desc ");
pager = PagerHelper.getPager(pager, baseRDao.findByHqlWhereCount(packBean));
List<MesBom> bomList = baseRDao.findByHqlWherePage(packBean, pager);
List<MesBom> list = recursionBomListAll(bomList,bom.getEffStartTime(), null);;
return new ListPager<>(list, pager);
}
public List<MesBom> findMesBomByPartNoAndBomVersion(String partNo, String organizeCode, String bomVersion, String bomCode, String effStartTime) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
@ -225,6 +254,29 @@ public class MesBomService extends BaseMesService<MesBom> implements IMesBomServ
return bomList;
}
/**
* bom
*
* @return
*/
private List<MesBom> recursionBomListAll(List<MesBom> bomList,String effStartTime,List<MesBom> allList) {
if (CollectionUtils.isEmpty(allList)) {
allList = new ArrayList<>();
allList.addAll(bomList);
}
if (!CollectionUtils.isEmpty(bomList)) {
for (MesBom bom : bomList) {
if (Objects.equals("X", bom.getPartType())) {
List<MesBom> resultList = findMesBomByPartNoAndBomVersion(bom.getItemPartNo(), bom.getOrganizeCode(), bom.getBomVersion(), bom.getBomCode(), effStartTime);
allList.addAll(resultList);
recursionBomListAll(resultList,effStartTime, allList);
}
}
}
return allList;
}
}

@ -1,14 +1,13 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesCustomerCarModelDetailService;
import cn.estsh.i3plus.ext.mes.api.base.IMesCustomerCarModelService;
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.*;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerCarModel;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerCarModelDetail;
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerCarModelDetailRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerCarModelRepository;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import lombok.extern.slf4j.Slf4j;
@ -39,13 +38,14 @@ public class MesCustomerCarModelService extends BaseMesService<MesCustomerCarMod
DdlPackBean roadPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getCarModelCode(), "carModelCode", roadPackBean);
DdlPreparedPack.getStringEqualPack(item.getCustCode(), "custCode", roadPackBean);
DdlPreparedPack.getStringEqualPack(item.getCustOrganizeCode(), "custOrganizeCode", 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.getOrganizeCode(),item.getCustCode())
.setErrorDetail("客户代码【%s】客户工厂代码【%s】车型【%s】已经存在请检查数据", item.getCustCode(),item.getCustOrganizeCode(),item.getCarModelCode())
.build();
}
@ -58,13 +58,14 @@ public class MesCustomerCarModelService extends BaseMesService<MesCustomerCarMod
DdlPackBean roadPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(item.getCarModelCode(), "carModelCode", roadPackBean);
DdlPreparedPack.getStringEqualPack(item.getCustCode(), "custCode", roadPackBean);
DdlPreparedPack.getStringEqualPack(item.getCustOrganizeCode(), "custOrganizeCode", roadPackBean);
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", 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.getOrganizeCode(),item.getCustCode())
.setErrorDetail("客户代码【%s】客户工厂代码【%s】车型【%s】已经存在请检查数据", item.getCustCode(),item.getCustOrganizeCode(),item.getCarModelCode())
.build();
}
}

@ -44,7 +44,7 @@ public class MesEquipmentSpotCheckDetailService extends BaseMesService<MesEquipm
DdlPreparedPack.getNumEqualPack(bean.getDataType(), "dataType", packBean);
DdlPreparedPack.getNumEqualPack(bean.getSpotCheckItemType(), "spotCheckItemType", packBean);
//43100 设备点检设置明细导入完成后,期望序列号可以正排
packBean.setOrderByStr(" order by seqCode ");
packBean.setOrderByStr(" order by convert(spot_check_item_code, SIGNED) ");
}

@ -20,6 +20,7 @@ import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -76,6 +77,9 @@ public class MesPartInspectionService extends BaseMesService<MesPartInspection>
String inventoryLocationCode = bean.getInventoryLocationCode();
List<String> collect = orgList.stream().filter(o->o.getInventoryLocationCode().equals(inventoryLocationCode))
.map(MesOrg::getResponsibleParty).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect) || collect.get(0) == null) {
return new ListPager<>(new ArrayList<>(), pager);
}
DdlPreparedPack.getInPackList(collect,"responsibleParty", packBean);
}
}

@ -319,6 +319,17 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
"\n" +
"\n" +
"UNION\n" +
"select \n" +
"eqcount.part_no,\n" +
"eqcount.equipment_code,\n" +
"me.equipment_name,\n" +
"me.work_cell_code,\n" +
"me.work_center_code,\n" +
"eqcount.product_count,\n" +
"eqcount.detail_count,\n" +
"eqcount.error_reason\n" +
"\n" +
"from (" +
"SELECT\n" +
"\teqcount.part_no,\n" +
"\teqcount.equipment_code ,\n" +
@ -370,11 +381,14 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
if (!StringUtils.isEmpty(productAccountModel.getEquipmentCode())) {
sqlStr += "and eqcount.equipment_code= :equipmentCode ";
}
sqlStr += "\tand eqcount.product_count is not null and eqcount.detail_count is not null ) mpr \n" +
sqlStr += "\tand eqcount.product_count is not null and eqcount.detail_count is not null " +
") eqcount \t \n" +
"left join mes_wc_equipment me ON eqcount.equipment_code = me.equipment_code and me.is_deleted = 2 and me.is_valid = 1 "+
") mpr \n" +
"\t\n" +
"\tleft join mes_equipment me\n" +
"\ton mpr.equipment_code = me.equipment_code\n" +
"\n" +
"\t " +
"where (mpr.product_count != 0 or mpr.detail_count != 0)\n" +
"and me.equipment_type = 10 order by me.equipment_code asc";
@ -597,7 +611,7 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
return partitionList;
}
private String handleNotHT(List<MesProductRecordLog> recordLogs) {
/*private String handleNotHT(List<MesProductRecordLog> recordLogs) {
int result = 0;
String startTime = "";
String endTime = "";
@ -614,9 +628,9 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
for (MesProductRecordLog recordLog : recordLogs) {
int errorCount = 0;
/*if (recordLog.getId() ==1834566428726444032l) {
if (recordLog.getId() == 1838536402558042112l) {
int a = 1;
}*/
}
if (Objects.equal(recordLog.getType(), "monitor") && recordLog.getMessage().contains("客户端下线")) {
startTime = recordLog.getCreateDatetime();
offlineFlag = true;
@ -625,8 +639,9 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
if (Objects.equal(recordLog.getType(), "monitor") && recordLog.getMessage().contains("客户端上线") ) {
endTime = recordLog.getCreateDatetime();
offlineFlag = false;
if (errorCount > 0) {
reason += String.format(offlineReason, startTime, endTime, errorCount + "");
if (result > 0) {
reason += String.format(offlineReason, startTime, endTime, 1 + "");
result = 0;
errorCount = 0;
}
//result = 0;
@ -690,6 +705,158 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
}
}
}
// 如果走到最后,还有预编译的错误,则直接加上
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
}
return reason;
}*/
private String handleNotHT(List<MesProductRecordLog> recordLogs) {
int result = 0;
// 定义有问题的开始时间
String startTime = "";
// 定义有问题的结束时间
String endTime = "";
// 错误个数
// 异常原因
String reason = "";
String reasonOffline = "因其他原因:系统,网络,发版等,导致【%s】的完成信号丢失;";
String offlineReason = "【%s】到【%s】,客户端下线,导致【%s】个完成信号丢失;";
String reasonQuality = "【%s】设备信号质量为0视为无效;";
String reasonBypass = "【%s】的完成信号,设备打BYPASS,视为无效;";
// BYPASS 默认fasle
boolean bypassFlag = false;
// BYPASS 默认fasle
boolean offlineFlag = false;
//List<String> finishList = Stream.of("Product_finish","PART_OK","Part_Finish","Product_OK").collect(Collectors.toList());
List<String> finishList = Stream.of("Product_finish","Part_Finish").collect(Collectors.toList());
String preReason = "";
for (MesProductRecordLog recordLog : recordLogs) {
int errorCount = 0;
if (recordLog.getId() ==1838536264741601280l) {
int a = 1;
}
if (Objects.equal(recordLog.getType(), "monitor") && recordLog.getMessage().contains("客户端下线")) {
startTime = recordLog.getCreateDatetime();
offlineFlag = true;
continue;
}
if (Objects.equal(recordLog.getType(), "monitor") && recordLog.getMessage().contains("客户端上线") ) {
endTime = recordLog.getCreateDatetime();
offlineFlag = false;
if (result > 0) {
reason += String.format(offlineReason, startTime, endTime, 1 + "");
preReason = "";
result = 0;
errorCount = 0;
}
//result = 0;
continue;
}
// 如果是bypass 遇到的所有加工完成指令 都计数并且原因是bypass导致
if (bypassFlag && finishList.contains(recordLog.getCategoryLevelTwo()) && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
}
preReason = String.format(reasonBypass,startTime, 1 +"");
//reason += String.format(reasonBypass,startTime, 1 +"");
continue;
}
if (offlineFlag && finishList.contains(recordLog.getCategoryLevelTwo()) && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 如果经过了1个finish然后再经过客户端下线再遇到finish则认为是客户端下线引起,如果没有需要预处理一个下线的原因
errorCount ++;
if (result > 0) {
reason += preReason;
preReason = String.format(offlineReason, endTime, recordLog.getCreateDatetime(), errorCount + "");
endTime = recordLog.getCreateDatetime();
continue;
} else {
endTime = recordLog.getCreateDatetime();
preReason = String.format(offlineReason, startTime,endTime, errorCount + "");
}
result++;
continue ;
}
if (Objects.equal(recordLog.getCategoryLevelTwo(), "BYPASS") && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 如果有finish然后遇到bypass 需要预处理
if (result > 0) {
reason += String.format(reasonBypass,startTime, 1 +"");
result = 0;
}
startTime = recordLog.getCreateDatetime();
endTime = recordLog.getCreateDatetime();
bypassFlag = true;
continue;
}
// 遇到bypass = false 则重置错误次数
if (bypassFlag && Objects.equal(recordLog.getCategoryLevelTwo(), "BYPASS") && Objects.equal(recordLog.getEquipVariableValue(), "False")) {
endTime = recordLog.getCreateDatetime();
errorCount = 0;
bypassFlag = false;
continue;
}
// BYPASS 逻辑结束 result = 1 代表一个成功新型号,遇到一个加工记录就会-1 变成0
if (result == 0) {
// 没有加工完成指令或者没有release指令但是有加工记录则也需要重置
if (recordLog.getType().equals("record")) {
bypassFlag = false;
preReason = "";
}
if (!finishList.contains(recordLog.getCategoryLevelTwo()) || !Objects.equal(recordLog.getEquipVariableValue(), "True")) {
continue;
}
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
preReason = "";
}
result ++;
startTime = recordLog.getCreateDatetime();
} else {
if (finishList.contains(recordLog.getCategoryLevelTwo()) && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 上一个加工记录信号还没走完这边又继续发一个加工记录且没有release 两个都要判定问题
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
}
if (Objects.equal(recordLog.getQuality(), "192")) {
reason += String.format(reasonOffline,startTime, 1 +"");
} else {
reason += String.format(reasonQuality,startTime, 1 +"");
}
// 每次preReason附完值都需要更新startTime完成信号
startTime = recordLog.getCreateDatetime();
}
if (recordLog.getType().equals("record")) {
bypassFlag = false;
offlineFlag = false;
result --;
preReason = "";
startTime = "";
errorCount = 0;
}
}
}
// 如果走到最后,还有预编译的错误,则直接加上
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
} else {
if (result > 0) {
reason += String.format(reasonOffline,startTime, 1 +"");
}
}
return reason;
}
@ -723,7 +890,7 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
for (MesProductRecordLog recordLog : recordLogs) {
int errorCount = 0;
if (recordLog.getId() ==1288411771211612170l) {
if (recordLog.getId() ==1838551951325315072l) {
int a = 1;
}
if (Objects.equal(recordLog.getType(), "monitor") && recordLog.getMessage().contains("客户端下线")) {
@ -735,7 +902,15 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
endTime = recordLog.getCreateDatetime();
offlineFlag = false;
if (result > 0) {
reason += String.format(offlineReason, startTime, endTime, 1 + "");
// 如果preReason已经有则代表已经判定过可以直接获取
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
startTime = recordLog.getCreateDatetime();
preReason = "";
} else {
reason += String.format(offlineReason, startTime, endTime, 1 + "");
}
result = 0;
errorCount = 0;
}
//result = 0;
@ -751,21 +926,26 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
continue;
}
if (offlineFlag && finishList.contains(recordLog.getCategoryLevelTwo()) && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 如果经过了1个finish然后再经过客户端下线再遇到finish则认为是客户端下线引起
// 如果经过了1个finish然后再经过客户端下线再遇到finish则认为是客户端下线引起,如果没有需要预处理一个下线的原因
errorCount ++;
if (result > 0) {
//endTime = recordLog.getCreateDatetime();
errorCount ++;
reason += String.format(offlineReason, startTime, startTime, errorCount + "");
continue;
} else {
endTime = recordLog.getCreateDatetime();
preReason = String.format(offlineReason, startTime,endTime, errorCount + "");
}
errorCount ++;
result++;
continue ;
}
if (Objects.equal(recordLog.getCategoryLevelTwo(), "BYPASS") && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 如果有finish然后遇到bypass 需要预处理
if (result > 0) {
reason += String.format(reasonBypass,startTime, 1 +"");
result = 0;
}
startTime = recordLog.getCreateDatetime();
endTime = recordLog.getCreateDatetime();
bypassFlag = true;
continue;
@ -820,7 +1000,8 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
result ++;
continue;
} if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
reason += preReason;
preReason = "";
}
result ++;
startTime = recordLog.getCreateDatetime();
@ -828,15 +1009,20 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
} else {
if (finishList.contains(recordLog.getCategoryLevelTwo()) && Objects.equal(recordLog.getEquipVariableValue(), "True")) {
// 上一个加工记录信号还没走完这边又继续发一个加工记录且没有release 两个都要判定问题
if (!StringUtils.isEmpty(preReason)) {
reason += preReason;
}
if (!releaseFlag) {
startTime = recordLog.getCreateDatetime();
reason += String.format(releaseBypass, startTime, 1 + "");
preReason = String.format(releaseBypass, startTime, 1 + "");
} else {
if (Objects.equal(recordLog.getQuality(), "192")) {
reason += String.format(reasonOffline,startTime, 1 +"");
} else {
reason += String.format(reasonQuality,startTime, 1 +"");
}
// 每次preReason附完值都需要更新startTime完成信号
startTime = recordLog.getCreateDatetime();
}
}
@ -903,7 +1089,6 @@ public class MesProductionRecordServiceImpl extends BaseMesService<MesProduction
if (Objects.equal(recordLog.getCategoryLevelTwo(),"shot_counter") && recordLog.getEquipVariableValue().compareTo("0") > 0) {
startTime = recordLog.getCreateDatetime();
endTime = recordLog.getCreateDatetime();
if (Objects.equal(recordLog.getQuality(), "192")) {
reason += String.format(reasonOffline,startTime, 1 +"");
} else {

@ -43,11 +43,11 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
DdlPreparedPack.getInPackList(idList, "pid", packBean);
List<MesPartInspectionDetail> partInspectionDetails = partInspectionDetailRDao.findByHqlWhere(packBean);
Map<Long, List<MesPartInspectionDetail>> idDetailListMap = partInspectionDetails.stream().collect(Collectors.groupingBy(MesPartInspectionDetail::getPid));
Map<String, List<MesPartInspection>> workOrderPartMap = mesPartInspectionList.stream().collect(Collectors.groupingBy(MesPartInspection::getPartNo));
//43326 电子化检验发送给QMS的数据按照零件号+责任人类型分组发送
Map<String, List<MesPartInspection>> workOrderPartMap = mesPartInspectionList.stream().collect(Collectors.groupingBy(p -> p.getPartNo() +"="+p.getResponsibleParty()));
//根据物料对可疑品分组
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : workOrderPartMap.entrySet()) {
String key = stringListEntry.getKey();
String keyPartNo = stringListEntry.getKey().split("=")[0];
List<MesPartInspection> mesPartInspections = stringListEntry.getValue();
MesPartInspection next = mesPartInspections.iterator().next();
List<MesPartInspectionDetail> mesPartInspectionDetails = new ArrayList<>();
@ -62,7 +62,7 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
mesQmsScrap.setSource("MES");
double sum = mesPartInspections.stream().mapToDouble(MesPartInspection::getRejectQty).sum();
mesQmsScrap.setRejectQty((int) sum);
mesQmsScrap.setPartNo(key);
mesQmsScrap.setPartNo(keyPartNo);
mesQmsScrap.setPartName(next.getPartName());
String defectTypeName = mesPartInspectionDetails.stream().map(MesPartInspectionDetail::getDefectTypeName).collect(Collectors.joining(";"));
mesQmsScrap.setDefectTypeName(defectTypeName);

@ -70,7 +70,9 @@ public class MesWorkOrderLogService extends BaseMesService<MesWorkOrderLog> impl
" wol.wo_source as workOrderSource," +
" wol.adjust_qty as adjustQty,"+
" wol.modify_qty as modifyQty,"+
" wol.remark as remark ";
" wol.remark as remark," +
" wol.description as description "
;
String sql = " from mes_work_order_log wol" +
" where 1=1 " +

@ -903,6 +903,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
@Override
public void doProductReport(MesWorkOrder mesWorkOrder) {
MesWorkOrder mesWorkOrderDb = getMesWorkOrder(mesWorkOrder.getWorkOrderNo(),mesWorkOrder.getOrganizeCode());
mesWorkOrderDb.setDescription(mesWorkOrder.getDescription());
//查询物料信息
MesPart mesPart = iMesPartService.getPartByPartNo(mesWorkOrderDb.getPartNo(), mesWorkOrderDb.getOrganizeCode());
//查询产线信息
@ -956,7 +957,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
String nowTime = StringUtil.isEmpty(mesWorkOrder.getDescription())?TimeTool.getNowTime(true):mesWorkOrder.getDescription();
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, false,nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, false,nowTime,mesBoms.size()));
}
mesProductOffLineService.insertBatch(mesProductOffLineList);
}
@ -1047,7 +1048,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
if (isReport) {
String nowTime = TimeTool.getNowTime(true);
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrderNew, mesProductVersion, sn, mesBom, false,nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrderNew, mesProductVersion, sn, mesBom, false,nowTime,mesBoms.size()));
}
}
//成品移库
@ -1062,7 +1063,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
if (MesExtEnumUtil.NOSORT_REPORT_TYPE.REPORT.getValue() == mesProdRuleNoSortCfg.getReportType()) {
String nowTime = TimeTool.getNowTime(true);
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrderNew, mesProductVersion, sn, mesBom, false,nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrderNew, mesProductVersion, sn, mesBom, false,nowTime,mesBoms.size()));
}
}
@ -1076,6 +1077,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
//保存报工记录 试制单不报工
if (CollectionUtils.isNotEmpty(mesProductOffLineList) && (Objects.isNull(mesWorkOrder.getOrderFlag()) || !MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue().equals(mesWorkOrder.getOrderFlag()))) {
mesProductOffLineList.forEach(t->t.setBomTotalSize(mesProductOffLineList.size()));
mesProductOffLineService.insertBatch(mesProductOffLineList);
}
//保存移库记录
@ -1131,7 +1133,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
//生成流水码
model.setSn(getStringList(model.getOrganizeCode()));
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(getMesProductOffLine(model, mesPart, mesProductVersion, mesBom, nowTime));
mesProductOffLineList.add(getMesProductOffLine(model, mesPart, mesProductVersion, mesBom,nowTime,mesBoms.size()));
}
} else {
//按照条码查询之前报工数据
@ -1383,7 +1385,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
workOrderLogService.saveMesWorkOrderLog(mesWorkOrder,type,qty);
}
private MesProductOffLine getMesProductOffLine(WmsProductModel model, MesPart mesPart, MesProductVersion mesProductVersion, MesBom mesBom,String nowTime) {
private MesProductOffLine getMesProductOffLine(WmsProductModel model, MesPart mesPart, MesProductVersion mesProductVersion, MesBom mesBom,String nowTime,Integer bomTotalSize) {
MesProductOffLine newMesProductOffLine = new MesProductOffLine();
newMesProductOffLine.setReportPartNo(mesPart.getPartNo());
newMesProductOffLine.setReportPartNameRdd(mesPart.getPartName());
@ -1406,6 +1408,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
newMesProductOffLine.setCustNo(model.getCustNo());
newMesProductOffLine.setCustOrder(model.getCustOrderNo());
newMesProductOffLine.setDescription(nowTime);
newMesProductOffLine.setBomTotalSize(bomTotalSize);
ConvertBean.serviceModelInitialize(newMesProductOffLine, model.getUserName());
return newMesProductOffLine;
@ -1455,7 +1458,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
//汇报
if (isItemReport) {
String nowTime = TimeTool.getNowTime(true);
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, true,nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, true,nowTime,mesBoms.size()));
}
//移库
if (isItemMove) {
@ -1513,7 +1516,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
private MesProductOffLine creatMesProductOffLine(MesWorkOrder mesWorkOrder, MesProductVersion mesProductVersion,
String sn, MesBom mesBom, boolean isItemReport,String nowTime) {
String sn, MesBom mesBom, boolean isItemReport,String nowTime,Integer bomTotalSize) {
MesProductOffLine newMesProductOffLine;
newMesProductOffLine = new MesProductOffLine();
if (!isItemReport) {
@ -1541,6 +1544,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
newMesProductOffLine.setOrganizeCode(mesWorkOrder.getOrganizeCode());
newMesProductOffLine.setDescription(nowTime);
newMesProductOffLine.setBomCode(mesBom.getBomCode());
newMesProductOffLine.setBomTotalSize(bomTotalSize);
ConvertBean.serviceModelInitialize(newMesProductOffLine, mesWorkOrder.getCreateUser());
return newMesProductOffLine;
@ -1774,6 +1778,7 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
newMesProductOffLine.setReportType(mesWorkOrderDb.getReportType());
newMesProductOffLine.setSapWorkCenter(mesWorkOrderDb.getErpWorkCenter());
newMesProductOffLine.setOrganizeCode(organizeCode);
newMesProductOffLine.setBomTotalSize(mesBoms.size());
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
mesProductOffLineList.add(newMesProductOffLine);

Loading…
Cancel
Save