MRP 运算 init2

master
guochaojie 2 months ago
parent 148e927e5c
commit 98b9654b91

@ -29,7 +29,8 @@ public interface YysBillMaterialService extends IService<YysBillMaterialEntity>
//子表方法 //子表方法
//副表数据方法 //副表数据方法
String checkForm(YysBillMaterialForm form,int i); String checkForm(YysBillMaterialForm form,int i);
void saveOrUpdate(YysBillMaterialForm yysBillMaterialForm,String id, boolean isSave) throws Exception; void saveOrUpdate(YysBillMaterialForm yysBillMaterialForm,String id, boolean isSave) throws Exception;
YysBillMaterialEntity getByProductId(String id);
List<YysBillMaterialEntity> getListByProductIds(List<String> id);
} }

@ -284,4 +284,18 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
this.saveOrUpdate(entity); this.saveOrUpdate(entity);
} }
@Override
public YysBillMaterialEntity getByProductId(String id) {
QueryWrapper<YysBillMaterialEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YysBillMaterialEntity::getPieceId,id);
return this.getOne(wrapper);
}
@Override
public List<YysBillMaterialEntity> getListByProductIds(List<String> id) {
QueryWrapper<YysBillMaterialEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().in(YysBillMaterialEntity::getPieceId,id);
return this.list(wrapper);
}
} }

@ -81,6 +81,9 @@ public class YysMonthlyProductionController {
@Autowired @Autowired
private YysMonthlyProductionService yysMonthlyProductionService; private YysMonthlyProductionService yysMonthlyProductionService;
@Autowired
private YysBillMaterialService bomService;
@Autowired @Autowired
private ConfigValueUtil configValueUtil; private ConfigValueUtil configValueUtil;
@ -545,14 +548,20 @@ public class YysMonthlyProductionController {
if(unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划"); if(unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划");
// 获取没有生成MRP的月度生产计划 // 获取没有生成MRP的月度生产计划
Set<Map<String, Object>> collect = unMPRList.stream().map(entity -> { Set<String> productIds = unMPRList.stream().map(YysMonthlyProductionEntity::getProductId).collect(Collectors.toSet());
Map<String, Object> map = new HashMap<>();
map.put("productId", entity.getProductId()); if(productIds.size()==0){
return map; return ActionResult.fail("没有需要生成MRP的月度生产计划");
}).collect(Collectors.toSet()); }
// 根据计划生成的物料 获取BOM清单 // 根据计划生成的物料 获取BOM清单
List<YysBillMaterialEntity> bomList = bomService.getListByProductIds(new ArrayList<>(productIds));
// 获取bom 清单详情
// 获取 物料信息
// 获取单位信息
// 计算一个计划的物料需求量 // 计算一个计划的物料需求量

Loading…
Cancel
Save