Merge remote-tracking branch 'origin/master'

master
jiyufei 2 months ago
commit fe0a503363

@ -32,4 +32,7 @@ public interface YysMonthlyProductionService extends IService<YysMonthlyProducti
String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm,String id, boolean isSave); String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm,String id, boolean isSave);
// 查询未进行MPR运算的计划
List<YysMonthlyProductionEntity> getUnMPRList(String month);
} }

@ -340,4 +340,14 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
} }
return "操作失败"; return "操作失败";
} }
@Override
public List<YysMonthlyProductionEntity> getUnMPRList(String month) {
QueryWrapper<YysMonthlyProductionEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YysMonthlyProductionEntity::getYears, month)
.isNull(YysMonthlyProductionEntity::getDeleteMark)
.isNull(YysMonthlyProductionEntity::getPlanNumber)
.orderByDesc(YysMonthlyProductionEntity::getDeliveryTime);
return this.list();
}
} }

@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
@ -525,4 +528,72 @@ public class YysMonthlyProductionController {
return ActionResult.success(yysMonthlyProductionMap); return ActionResult.success(yysMonthlyProductionMap);
} }
@PostMapping("/mrp/{month}")
@Operation(summary = "MRP运算")
public ActionResult MRP(@PathVariable String month) {
if (StringUtil.isNotEmpty(month)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
try {
format.parse(month);
} catch (ParseException e) {
return ActionResult.fail("月份格式不正确");
}
} else {
return ActionResult.fail("月份不能为空");
}
List<YysMonthlyProductionEntity> unMPRList = yysMonthlyProductionService.getUnMPRList(month);
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());
// 根据计划生成的物料 获取BOM清单
// 计算一个计划的物料需求量
// 循环计划
// 所需物料 合并同类项
// 获取已排产未生产的物料
// 计算未生产的物料需求量
// 与所需物料编码 交集 求同类需求量
// 根据同类需求量 获取库存量
// 计算同类需求量 采购未入库的物料量
// 计算 同类需求量 - 库存量 - 采购未入库的物料量 = 需要采购的物料量
// 插入物料需求计划表中
// 更新计划表中物料需求计划ID
// 完结
return ActionResult.success("成功");
}
@PostMapping("/scheduling")
@Operation(summary = "生产排产")
public ActionResult ProductionScheduling(@RequestBody YysMonthlyProductionStrategyVO strategyVO) {
// 获取月度生产计划
// 根据计划生成的物料 获取BOM清单
// 计算一个计划的物料需求量
// 循环计划
return ActionResult.success("成功");
}
} }

@ -30,6 +30,8 @@ public class YysMonthlyProductionEntity {
private String measurementNumber; private String measurementNumber;
@TableField(value = "CURRENT_INVENTORY" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "CURRENT_INVENTORY" , updateStrategy = FieldStrategy.IGNORED)
private String currentInventory; private String currentInventory;
@TableField(value = "PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String planNumber;
@TableField(value = "DELIVERY_TIME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "DELIVERY_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date deliveryTime; private Date deliveryTime;
@TableField("F_CREATOR_TIME") @TableField("F_CREATOR_TIME")

@ -0,0 +1,17 @@
package jnpf.model.yysmonthlyproduction;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class YysMonthlyProductionStrategyVO {
private String month;
private String strategy;
private List<String> shifts;
}
Loading…
Cancel
Save