出库管理手动分配调整

This commit is contained in:
秦鸿展
2026-02-03 17:50:20 +08:00
parent db313639db
commit d436601507
3 changed files with 71 additions and 58 deletions
@@ -168,4 +168,16 @@ public class MaterialInventoryQueryListDTO extends MaterialBaseDTO {
@ApiModelProperty("物料/库位信息")
@Excel(name = "物料/库位信息")
private String storageInfo;
@ApiModelProperty("Batch Ref NO's")
@Excel(name = "Batch Ref NO's")
private String batchRefNo;
@ApiModelProperty("Sheet Ref NO's")
@Excel(name = "Sheet Ref NO's")
private String sheetRefNo;
@ApiModelProperty("箱号/卡板号")
@Excel(name = "箱号/卡板号")
private String boxPalletNo;
}
@@ -24,7 +24,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
@@ -165,48 +164,7 @@ public class StockOutOrderApi extends BaseController {
return toAjax(stockOutOrderApplicationService.cancelAssign(stockOutOrderDO));
}
/**
* 手动取消分配(点击确认后直接取消分配)
* 前端点击取消分配按钮时弹出确认对话框,点击确认后调用此接口
* 只需要传递出库单ID和物料明细ID,会自动取消该明细的所有已分配数量
*/
@ApiOperation("手动取消分配")
@PostMapping("/manualCancelAssign")
public AjaxResult manualCancelAssign(@RequestBody StockOutOrderDTO stockOutOrderDTO) {
// 检查参数
if (stockOutOrderDTO.getOutOrderId() == null) {
return error("出库单ID不能为空");
}
if (stockOutOrderDTO.getMaterialDetailList() == null || stockOutOrderDTO.getMaterialDetailList().isEmpty()) {
return error("物料明细不能为空,请选择要取消分配的物料明细");
}
StockOutOrderDO stockOutOrderDO = new StockOutOrderDO();
BeanUtils.copyProperties(stockOutOrderDTO, stockOutOrderDO);
// 转换物料明细列表,手动转换确保materialDetailId字段正确传递
List<OutMaterialDetailDO> materialDetailList = new ArrayList<>();
for (OutMaterialDetailDTO detailDTO : stockOutOrderDTO.getMaterialDetailList()) {
OutMaterialDetailDO detailDO = new OutMaterialDetailDO();
// 只复制必要的字段,确保materialDetailId被正确传递
detailDO.setMaterialDetailId(detailDTO.getMaterialDetailId());
detailDO.setUniqueId(detailDTO.getUniqueId());
detailDO.setAllocationQuantity(detailDTO.getAllocationQuantity());
// 如果有子明细,也转换
if (detailDTO.getMaterialDetailList() != null && !detailDTO.getMaterialDetailList().isEmpty()) {
List<OutMaterialDetailDO> children = new ArrayList<>();
for (OutMaterialDetailDTO childDTO : detailDTO.getMaterialDetailList()) {
OutMaterialDetailDO childDO = new OutMaterialDetailDO();
childDO.setMaterialDetailId(childDTO.getMaterialDetailId());
childDO.setAllocationQuantity(childDTO.getAllocationQuantity());
children.add(childDO);
}
detailDO.setChildren(children);
}
materialDetailList.add(detailDO);
}
stockOutOrderDO.setMaterialDetailList(materialDetailList);
return toAjax(stockOutOrderApplicationService.manualCancelAssign(stockOutOrderDO));
}
/**
* 生成拣货单