Compare commits

...

2 Commits

Author SHA1 Message Date
guochaojie a02f2c7668 Merge remote-tracking branch 'origin/master'
2 months ago
guochaojie 98b9654b91 MRP 运算 init2
2 months ago

@ -29,7 +29,8 @@ public interface YysBillMaterialService extends IService<YysBillMaterialEntity>
//子表方法
//副表数据方法
String checkForm(YysBillMaterialForm form,int i);
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);
}
@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
private YysMonthlyProductionService yysMonthlyProductionService;
@Autowired
private YysBillMaterialService bomService;
@Autowired
private ConfigValueUtil configValueUtil;
@ -557,14 +560,20 @@ public class YysMonthlyProductionController {
if (unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划");
// 获取没有生成MRP的月度生产计划
Set<Map<String, Object>> collect = unMPRList.stream().map(entity -> {
Map<String, Object> map = new HashMap<>();
map.put("productId", entity.getProductId());
return map;
}).collect(Collectors.toSet());
Set<String> productIds = unMPRList.stream().map(YysMonthlyProductionEntity::getProductId).collect(Collectors.toSet());
if(productIds.size()==0){
return ActionResult.fail("没有需要生成MRP的月度生产计划");
}
// 根据计划生成的物料 获取BOM清单
List<YysBillMaterialEntity> bomList = bomService.getListByProductIds(new ArrayList<>(productIds));
// 获取bom 清单详情
// 获取 物料信息
// 获取单位信息
// 计算一个计划的物料需求量

Loading…
Cancel
Save