|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
|
|
|
|
@ -10,6 +11,7 @@ import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesProduceSnRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -40,6 +43,9 @@ public class MesAssemblySaveNosortStepService extends BaseStepService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProductionAssemblyRepository productionAssemblyRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProduceSnExtService produceSnExtService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
|
@ -71,14 +77,18 @@ public class MesAssemblySaveNosortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
Map<Integer, MesProductionPsOutContext> ppMap = CollectionUtils.isEmpty(productionPsOutContextList) ? null : productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toMap(MesProductionPsOutContext::getForeignKey, o -> o));
|
|
|
|
|
|
|
|
|
|
List<Long> productSnId = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//保存装配记录
|
|
|
|
|
prodRuleContextList.stream().filter(o -> null != o).forEach(o -> saveProductionAssemblyData(reqBean, resultBean, stepResult, productionProcessContext, o, ppMap, cellEquipContext));
|
|
|
|
|
prodRuleContextList.stream().filter(o -> null != o).forEach(o -> saveProductionAssemblyData(reqBean, resultBean, stepResult, productSnId, productionProcessContext, o, ppMap, cellEquipContext));
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(productSnId)) produceSnExtService.saveProduceSnList(reqBean, MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY.getValue(), productSnId);
|
|
|
|
|
|
|
|
|
|
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "保存装配记录成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveProductionAssemblyData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult,
|
|
|
|
|
private void saveProductionAssemblyData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List<Long> productSnId,
|
|
|
|
|
MesProductionProcessContext productionProcessContext, MesProdRuleContext prodRuleContext, Map<Integer, MesProductionPsOutContext> ppMap, MesCellEquipContext cellEquipContext) {
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) return;
|
|
|
|
@ -127,9 +137,10 @@ public class MesAssemblySaveNosortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
productionAssemblyRepository.insert(productionAssembly);
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(productionAssemblyNosortContext.getProductSnId())) productSnId.add(productionAssemblyNosortContext.getProductSnId());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|