修复酸轧实绩提交问题,规程重新完成逻辑

This commit is contained in:
2026-05-21 13:41:21 +08:00
parent 2c9cc6241f
commit eb5601ade3
6 changed files with 677 additions and 557 deletions

View File

@@ -61,7 +61,13 @@ public class DrMillProcessRecipeController extends BaseController {
@GetMapping("/version/list/{recipeId}")
public R<List<DrMillProcessRecipeVersion>> versionList(@PathVariable Long recipeId) {
return R.ok(versionService.listByRecipeId(recipeId));
List<DrMillProcessRecipeVersion> list = versionService.listByRecipeId(recipeId);
// 同步版本到主库 wms_process_spec_version幂等
DrMillProcessRecipe recipe = recipeService.selectDetailById(recipeId);
if (recipe != null) {
syncService.syncVersionsToSpec(recipe.getRecipeNo(), list);
}
return R.ok(list);
}
@GetMapping("/version/{versionId}")
@@ -71,7 +77,14 @@ public class DrMillProcessRecipeController extends BaseController {
@PostMapping("/version")
public R<Long> addVersion(@RequestBody DrMillProcessRecipeVersion version) {
return R.ok(versionService.save(version));
Long newId = versionService.save(version);
// 新增后重新同步该方案的所有版本
List<DrMillProcessRecipeVersion> all = versionService.listByRecipeId(version.getRecipeId());
DrMillProcessRecipe recipe = recipeService.selectDetailById(version.getRecipeId());
if (recipe != null) {
syncService.syncVersionsToSpec(recipe.getRecipeNo(), all);
}
return R.ok(newId);
}
@PutMapping("/version")
@@ -83,6 +96,15 @@ public class DrMillProcessRecipeController extends BaseController {
@PutMapping("/version/activate/{versionId}")
public R<Void> activate(@PathVariable Long versionId) {
versionService.activate(versionId);
// 激活后重新同步 isActive 状态到主库
DrMillProcessRecipeVersion ver = versionService.getDetailById(versionId);
if (ver != null) {
List<DrMillProcessRecipeVersion> all = versionService.listByRecipeId(ver.getRecipeId());
DrMillProcessRecipe recipe = recipeService.selectDetailById(ver.getRecipeId());
if (recipe != null) {
syncService.syncVersionsToSpec(recipe.getRecipeNo(), all);
}
}
return R.ok();
}