手动分配(取消分配)代码缺失补全
This commit is contained in:
+42
@@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,7 +165,48 @@ public class StockOutOrderApi extends BaseController {
|
|||||||
return toAjax(stockOutOrderApplicationService.cancelAssign(stockOutOrderDO));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成拣货单
|
* 生成拣货单
|
||||||
|
|||||||
Reference in New Issue
Block a user