|
|
|
@ -1,11 +1,28 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.config.AuthUtilExt;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCutScheme;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCutSchemeMaterial;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCutSchemeMaterialRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 裁片工单
|
|
|
|
|
*/
|
|
|
|
@ -14,4 +31,26 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesCutScheme")
|
|
|
|
|
public class MesCutSchemeController extends BaseMesController<MesCutScheme>{
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCutSchemeMaterialRepository cutSchemeMaterialRepository;
|
|
|
|
|
//查询后执行
|
|
|
|
|
public void afterList(List<MesCutScheme> mesCutSchemes) {
|
|
|
|
|
|
|
|
|
|
List<String> cutCodes = mesCutSchemes.stream().map(MesCutScheme::getCutCode).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(AuthUtilExt.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getInPackList(cutCodes, "cutCode", ddlPackBean);
|
|
|
|
|
List<MesCutSchemeMaterial> mesCutSchemeMaterials = cutSchemeMaterialRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
if (CollectionUtils.isEmpty(mesCutSchemeMaterials)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<String,List<MesCutSchemeMaterial>> materialMap = mesCutSchemeMaterials.stream().collect(Collectors.groupingBy(MesCutSchemeMaterial::getCutCode));
|
|
|
|
|
|
|
|
|
|
for (MesCutScheme mesCutScheme : mesCutSchemes) {
|
|
|
|
|
List<MesCutSchemeMaterial> list = materialMap.get(mesCutScheme.getCutCode());
|
|
|
|
|
mesCutScheme.setPartNos(list.stream().map(MesCutSchemeMaterial::getPartNo).map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|