新增物料盘点和移库单
parent
cd18e05358
commit
b3bc122741
@ -0,0 +1,117 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckVo;
|
||||
import org.dromara.wms.service.IWmsInventoryCheckService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 库存盘点
|
||||
* 前端访问路由地址为:/system/inventoryCheck
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/inventoryCheck")
|
||||
public class WmsInventoryCheckController extends BaseController {
|
||||
|
||||
private final IWmsInventoryCheckService wmsInventoryCheckService;
|
||||
|
||||
/**
|
||||
* 查询库存盘点列表
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsInventoryCheckVo> list(WmsInventoryCheckBo bo, PageQuery pageQuery) {
|
||||
return wmsInventoryCheckService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存盘点列表
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:export")
|
||||
@Log(title = "库存盘点", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsInventoryCheckBo bo, HttpServletResponse response) {
|
||||
List<WmsInventoryCheckVo> list = wmsInventoryCheckService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "库存盘点", WmsInventoryCheckVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存盘点详细信息
|
||||
*
|
||||
* @param inventoryCheckId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:query")
|
||||
@GetMapping("/{inventoryCheckId}")
|
||||
public R<WmsInventoryCheckVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long inventoryCheckId) {
|
||||
return R.ok(wmsInventoryCheckService.queryById(inventoryCheckId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:add")
|
||||
@Log(title = "库存盘点", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@RequestBody WmsInventoryCheckBo bo) {
|
||||
return toAjax(wmsInventoryCheckService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:edit")
|
||||
@Log(title = "库存盘点", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsInventoryCheckBo bo) {
|
||||
return toAjax(wmsInventoryCheckService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点
|
||||
*
|
||||
* @param inventoryCheckIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheck:remove")
|
||||
@Log(title = "库存盘点", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{inventoryCheckIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] inventoryCheckIds) {
|
||||
return toAjax(wmsInventoryCheckService.deleteWithValidByIds(List.of(inventoryCheckIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询库存盘点列表
|
||||
*/
|
||||
|
||||
@GetMapping("getWmsInventoryCheckList")
|
||||
public R<List<WmsInventoryCheckVo>> getWmsInventoryChecklist(WmsInventoryCheckBo bo) {
|
||||
List<WmsInventoryCheckVo> list = wmsInventoryCheckService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckRecordBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckRecordVo;
|
||||
import org.dromara.wms.service.IWmsInventoryCheckRecordService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 盘点记录和调整工单
|
||||
* 前端访问路由地址为:/system/inventoryCheckRecord
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/inventoryCheckRecord")
|
||||
public class WmsInventoryCheckRecordController extends BaseController {
|
||||
|
||||
private final IWmsInventoryCheckRecordService wmsInventoryCheckRecordService;
|
||||
|
||||
/**
|
||||
* 查询盘点记录和调整工单列表
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsInventoryCheckRecordVo> list(WmsInventoryCheckRecordBo bo, PageQuery pageQuery) {
|
||||
return wmsInventoryCheckRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出盘点记录和调整工单列表
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:export")
|
||||
@Log(title = "盘点记录和调整工单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsInventoryCheckRecordBo bo, HttpServletResponse response) {
|
||||
List<WmsInventoryCheckRecordVo> list = wmsInventoryCheckRecordService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "盘点记录和调整工单", WmsInventoryCheckRecordVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取盘点记录和调整工单详细信息
|
||||
*
|
||||
* @param icRecordId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:query")
|
||||
@GetMapping("/{icRecordId}")
|
||||
public R<WmsInventoryCheckRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long icRecordId) {
|
||||
return R.ok(wmsInventoryCheckRecordService.queryById(icRecordId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点记录和调整工单
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:add")
|
||||
@Log(title = "盘点记录和调整工单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsInventoryCheckRecordBo bo) {
|
||||
return toAjax(wmsInventoryCheckRecordService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改盘点记录和调整工单
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:edit")
|
||||
@Log(title = "盘点记录和调整工单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsInventoryCheckRecordBo bo) {
|
||||
return toAjax(wmsInventoryCheckRecordService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除盘点记录和调整工单
|
||||
*
|
||||
* @param icRecordIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:inventoryCheckRecord:remove")
|
||||
@Log(title = "盘点记录和调整工单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{icRecordIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] icRecordIds) {
|
||||
return toAjax(wmsInventoryCheckRecordService.deleteWithValidByIds(List.of(icRecordIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询盘点记录和调整工单列表
|
||||
*/
|
||||
|
||||
@GetMapping("getWmsInventoryCheckRecordList")
|
||||
public R<List<WmsInventoryCheckRecordVo>> getWmsInventoryCheckRecordlist(WmsInventoryCheckRecordBo bo) {
|
||||
List<WmsInventoryCheckRecordVo> list = wmsInventoryCheckRecordService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
|
||||
import org.dromara.wms.domain.vo.WmsMoveOrderVo;
|
||||
import org.dromara.wms.service.IWmsMoveOrderService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 移库工单
|
||||
* 前端访问路由地址为:/system/moveOrder
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/moveOrder")
|
||||
public class WmsMoveOrderController extends BaseController {
|
||||
|
||||
private final IWmsMoveOrderService wmsMoveOrderService;
|
||||
|
||||
/**
|
||||
* 查询移库工单列表
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsMoveOrderVo> list(WmsMoveOrderBo bo, PageQuery pageQuery) {
|
||||
return wmsMoveOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出移库工单列表
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:export")
|
||||
@Log(title = "移库工单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsMoveOrderBo bo, HttpServletResponse response) {
|
||||
List<WmsMoveOrderVo> list = wmsMoveOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "移库工单", WmsMoveOrderVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取移库工单详细信息
|
||||
*
|
||||
* @param moveId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:query")
|
||||
@GetMapping("/{moveId}")
|
||||
public R<WmsMoveOrderVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long moveId) {
|
||||
return R.ok(wmsMoveOrderService.queryById(moveId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增移库工单
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:add")
|
||||
@Log(title = "移库工单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsMoveOrderBo bo) {
|
||||
return toAjax(wmsMoveOrderService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改移库工单
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:edit")
|
||||
@Log(title = "移库工单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsMoveOrderBo bo) {
|
||||
return toAjax(wmsMoveOrderService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除移库工单
|
||||
*
|
||||
* @param moveIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:moveOrder:remove")
|
||||
@Log(title = "移库工单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{moveIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] moveIds) {
|
||||
return toAjax(wmsMoveOrderService.deleteWithValidByIds(List.of(moveIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询移库工单列表
|
||||
*/
|
||||
|
||||
@GetMapping("getWmsMoveOrderList")
|
||||
public R<List<WmsMoveOrderVo>> getWmsMoveOrderlist(WmsMoveOrderBo bo) {
|
||||
List<WmsMoveOrderVo> list = wmsMoveOrderService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsInventoryCheck;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckVo;
|
||||
|
||||
/**
|
||||
* 库存盘点Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface WmsInventoryCheckMapper extends BaseMapperPlus<WmsInventoryCheck, WmsInventoryCheckVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsInventoryCheckRecord;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckRecordVo;
|
||||
|
||||
/**
|
||||
* 盘点记录和调整工单Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface WmsInventoryCheckRecordMapper extends BaseMapperPlus<WmsInventoryCheckRecord, WmsInventoryCheckRecordVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsMoveOrder;
|
||||
import org.dromara.wms.domain.vo.WmsMoveOrderVo;
|
||||
|
||||
/**
|
||||
* 移库工单Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface WmsMoveOrderMapper extends BaseMapperPlus<WmsMoveOrder, WmsMoveOrderVo> {
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckRecordBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckRecordVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 盘点记录和调整工单Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface IWmsInventoryCheckRecordService {
|
||||
|
||||
/**
|
||||
* 查询盘点记录和调整工单
|
||||
*
|
||||
* @param icRecordId 主键
|
||||
* @return 盘点记录和调整工单
|
||||
*/
|
||||
WmsInventoryCheckRecordVo queryById(Long icRecordId);
|
||||
|
||||
/**
|
||||
* 分页查询盘点记录和调整工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 盘点记录和调整工单分页列表
|
||||
*/
|
||||
TableDataInfo<WmsInventoryCheckRecordVo> queryPageList(WmsInventoryCheckRecordBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的盘点记录和调整工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 盘点记录和调整工单列表
|
||||
*/
|
||||
List<WmsInventoryCheckRecordVo> queryList(WmsInventoryCheckRecordBo bo);
|
||||
|
||||
/**
|
||||
* 新增盘点记录和调整工单
|
||||
*
|
||||
* @param bo 盘点记录和调整工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsInventoryCheckRecordBo bo);
|
||||
|
||||
/**
|
||||
* 修改盘点记录和调整工单
|
||||
*
|
||||
* @param bo 盘点记录和调整工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsInventoryCheckRecordBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除盘点记录和调整工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存盘点Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface IWmsInventoryCheckService {
|
||||
|
||||
/**
|
||||
* 查询库存盘点
|
||||
*
|
||||
* @param inventoryCheckId 主键
|
||||
* @return 库存盘点
|
||||
*/
|
||||
WmsInventoryCheckVo queryById(Long inventoryCheckId);
|
||||
|
||||
/**
|
||||
* 分页查询库存盘点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 库存盘点分页列表
|
||||
*/
|
||||
TableDataInfo<WmsInventoryCheckVo> queryPageList(WmsInventoryCheckBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的库存盘点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 库存盘点列表
|
||||
*/
|
||||
List<WmsInventoryCheckVo> queryList(WmsInventoryCheckBo bo);
|
||||
|
||||
/**
|
||||
* 新增库存盘点
|
||||
*
|
||||
* @param bo 库存盘点
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsInventoryCheckBo bo);
|
||||
|
||||
/**
|
||||
* 修改库存盘点
|
||||
*
|
||||
* @param bo 库存盘点
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsInventoryCheckBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除库存盘点信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
|
||||
import org.dromara.wms.domain.vo.WmsMoveOrderVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 移库工单Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface IWmsMoveOrderService {
|
||||
|
||||
/**
|
||||
* 查询移库工单
|
||||
*
|
||||
* @param moveId 主键
|
||||
* @return 移库工单
|
||||
*/
|
||||
WmsMoveOrderVo queryById(Long moveId);
|
||||
|
||||
/**
|
||||
* 分页查询移库工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 移库工单分页列表
|
||||
*/
|
||||
TableDataInfo<WmsMoveOrderVo> queryPageList(WmsMoveOrderBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的移库工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 移库工单列表
|
||||
*/
|
||||
List<WmsMoveOrderVo> queryList(WmsMoveOrderBo bo);
|
||||
|
||||
/**
|
||||
* 新增移库工单
|
||||
*
|
||||
* @param bo 移库工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsMoveOrderBo bo);
|
||||
|
||||
/**
|
||||
* 修改移库工单
|
||||
*
|
||||
* @param bo 移库工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsMoveOrderBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除移库工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.wms.domain.WmsInventoryCheckRecord;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckRecordBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckRecordVo;
|
||||
import org.dromara.wms.mapper.WmsInventoryCheckRecordMapper;
|
||||
import org.dromara.wms.service.IWmsInventoryCheckRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 盘点记录和调整工单Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsInventoryCheckRecordServiceImpl implements IWmsInventoryCheckRecordService {
|
||||
|
||||
private final WmsInventoryCheckRecordMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询盘点记录和调整工单
|
||||
*
|
||||
* @param icRecordId 主键
|
||||
* @return 盘点记录和调整工单
|
||||
*/
|
||||
@Override
|
||||
public WmsInventoryCheckRecordVo queryById(Long icRecordId){
|
||||
return baseMapper.selectVoById(icRecordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询盘点记录和调整工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 盘点记录和调整工单分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsInventoryCheckRecordVo> queryPageList(WmsInventoryCheckRecordBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsInventoryCheckRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsInventoryCheckRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的盘点记录和调整工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 盘点记录和调整工单列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInventoryCheckRecordVo> queryList(WmsInventoryCheckRecordBo bo) {
|
||||
MPJLambdaWrapper<WmsInventoryCheckRecord> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsInventoryCheckRecord> buildQueryWrapper(WmsInventoryCheckRecordBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsInventoryCheckRecord> lqw = JoinWrappers.lambda(WmsInventoryCheckRecord.class)
|
||||
.selectAll(WmsInventoryCheckRecord.class)
|
||||
.eq(bo.getIcRecordId() != null, WmsInventoryCheckRecord::getIcRecordId, bo.getIcRecordId())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInventoryCheckRecord::getMaterialCategories, bo.getMaterialCategories())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckCode()), WmsInventoryCheckRecord::getCheckCode, bo.getCheckCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsInventoryCheckRecord::getBatchCode, bo.getBatchCode())
|
||||
.eq(bo.getMaterialId() != null, WmsInventoryCheckRecord::getMaterialId, bo.getMaterialId())
|
||||
.eq(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventoryCheckRecord::getLocationCode, bo.getLocationCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsInventoryCheckRecord::getMaterialCode, bo.getMaterialCode())
|
||||
.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsInventoryCheckRecord::getMaterialName, bo.getMaterialName())
|
||||
.eq(StringUtils.isNotBlank(bo.getInventoryQty()), WmsInventoryCheckRecord::getInventoryQty, bo.getInventoryQty())
|
||||
.eq(bo.getCheckQty() != null, WmsInventoryCheckRecord::getCheckQty, bo.getCheckQty())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckStatus()), WmsInventoryCheckRecord::getCheckStatus, bo.getCheckStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsInventoryCheckRecord::getErpSynchronousStatus, bo.getErpSynchronousStatus())
|
||||
.eq(bo.getErpSynchronousQty() != null, WmsInventoryCheckRecord::getErpSynchronousQty, bo.getErpSynchronousQty())
|
||||
.eq(StringUtils.isNotBlank(bo.getIsAdjust()), WmsInventoryCheckRecord::getIsAdjust, bo.getIsAdjust())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsInventoryCheckRecord::getAuditBy, bo.getAuditBy())
|
||||
.eq(bo.getAuditTime() != null, WmsInventoryCheckRecord::getAuditTime, bo.getAuditTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsInventoryCheckRecord::getAuditStatus, bo.getAuditStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsInventoryCheckRecord::getAuditComments, bo.getAuditComments())
|
||||
.eq(StringUtils.isNotBlank(bo.getAdjustStatus()), WmsInventoryCheckRecord::getAdjustStatus, bo.getAdjustStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAdjustType()), WmsInventoryCheckRecord::getAdjustType, bo.getAdjustType())
|
||||
.orderByDesc(WmsInventoryCheckRecord::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点记录和调整工单
|
||||
*
|
||||
* @param bo 盘点记录和调整工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsInventoryCheckRecordBo bo) {
|
||||
WmsInventoryCheckRecord add = MapstructUtils.convert(bo, WmsInventoryCheckRecord.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setIcRecordId(add.getIcRecordId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改盘点记录和调整工单
|
||||
*
|
||||
* @param bo 盘点记录和调整工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsInventoryCheckRecordBo bo) {
|
||||
WmsInventoryCheckRecord update = MapstructUtils.convert(bo, WmsInventoryCheckRecord.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsInventoryCheckRecord entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除盘点记录和调整工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.wms.domain.WmsBaseWarehouse;
|
||||
import org.dromara.wms.domain.WmsInstockOrder;
|
||||
import org.dromara.wms.domain.WmsInventoryCheck;
|
||||
import org.dromara.wms.domain.bo.WmsInstockOrderBo;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryCheckBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryCheckVo;
|
||||
import org.dromara.wms.mapper.WmsInventoryCheckMapper;
|
||||
import org.dromara.wms.service.IWmsInventoryCheckService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 库存盘点Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
|
||||
|
||||
private final WmsInventoryCheckMapper baseMapper;
|
||||
private static final AtomicInteger sequence = new AtomicInteger(999);
|
||||
public static Integer nextSequence() {
|
||||
return sequence.incrementAndGet();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点
|
||||
*
|
||||
* @param inventoryCheckId 主键
|
||||
* @return 库存盘点
|
||||
*/
|
||||
@Override
|
||||
public WmsInventoryCheckVo queryById(Long inventoryCheckId){
|
||||
return baseMapper.selectVoById(inventoryCheckId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询库存盘点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 库存盘点分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsInventoryCheckVo> queryPageList(WmsInventoryCheckBo bo, PageQuery pageQuery) {
|
||||
// MPJLambdaWrapper<WmsInventoryCheck> lqw = buildQueryWrapper(bo);
|
||||
MPJLambdaWrapper<WmsInventoryCheck> lqw = buildJoinQueryWrapper(bo);
|
||||
Page<WmsInventoryCheckVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的库存盘点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 库存盘点列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInventoryCheckVo> queryList(WmsInventoryCheckBo bo) {
|
||||
MPJLambdaWrapper<WmsInventoryCheck> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsInventoryCheck> buildQueryWrapper(WmsInventoryCheckBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsInventoryCheck> lqw = JoinWrappers.lambda(WmsInventoryCheck.class)
|
||||
.selectAll(WmsInventoryCheck.class)
|
||||
.eq(bo.getInventoryCheckId() != null, WmsInventoryCheck::getInventoryCheckId, bo.getInventoryCheckId())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckCode()), WmsInventoryCheck::getCheckCode, bo.getCheckCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInventoryCheck::getMaterialCategories, bo.getMaterialCategories())
|
||||
.eq(bo.getPlanWarehouseId() != null, WmsInventoryCheck::getPlanWarehouseId, bo.getPlanWarehouseId())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckType()), WmsInventoryCheck::getCheckType, bo.getCheckType())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckStatus()), WmsInventoryCheck::getCheckStatus, bo.getCheckStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsInventoryCheck::getAuditBy, bo.getAuditBy())
|
||||
.eq(bo.getAuditTime() != null, WmsInventoryCheck::getAuditTime, bo.getAuditTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsInventoryCheck::getAuditStatus, bo.getAuditStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsInventoryCheck::getAuditComments, bo.getAuditComments())
|
||||
.eq(bo.getBeginTime() != null, WmsInventoryCheck::getBeginTime, bo.getBeginTime())
|
||||
.eq(bo.getEndTime() != null, WmsInventoryCheck::getEndTime, bo.getEndTime())
|
||||
.orderByDesc(WmsInventoryCheck::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
private MPJLambdaWrapper<WmsInventoryCheck> buildJoinQueryWrapper(WmsInventoryCheckBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsInventoryCheck> lqw = JoinWrappers.lambda(WmsInventoryCheck.class)
|
||||
.selectAll(WmsInventoryCheck.class)
|
||||
.select(WmsBaseWarehouse::getWarehouseCode)
|
||||
.leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsInventoryCheck::getPlanWarehouseId);
|
||||
lqw.eq(bo.getInventoryCheckId() != null, WmsInventoryCheck::getInventoryCheckId, bo.getInventoryCheckId())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckCode()), WmsInventoryCheck::getCheckCode, bo.getCheckCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInventoryCheck::getMaterialCategories, bo.getMaterialCategories())
|
||||
.eq(bo.getPlanWarehouseId() != null, WmsInventoryCheck::getPlanWarehouseId, bo.getPlanWarehouseId())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckType()), WmsInventoryCheck::getCheckType, bo.getCheckType())
|
||||
.eq(StringUtils.isNotBlank(bo.getCheckStatus()), WmsInventoryCheck::getCheckStatus, bo.getCheckStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsInventoryCheck::getAuditBy, bo.getAuditBy())
|
||||
.eq(bo.getAuditTime() != null, WmsInventoryCheck::getAuditTime, bo.getAuditTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsInventoryCheck::getAuditStatus, bo.getAuditStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsInventoryCheck::getAuditComments, bo.getAuditComments())
|
||||
.eq(bo.getBeginTime() != null, WmsInventoryCheck::getBeginTime, bo.getBeginTime())
|
||||
.eq(bo.getEndTime() != null, WmsInventoryCheck::getEndTime, bo.getEndTime())
|
||||
.orderByDesc(WmsInventoryCheck::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点
|
||||
*
|
||||
* @param bo 库存盘点
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsInventoryCheckBo bo) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm");
|
||||
String orderDate = format.format(date).substring(2);
|
||||
String order = "ST";
|
||||
String orderLast="";
|
||||
Integer value = nextSequence();
|
||||
if (value.toString().length()==4){
|
||||
sequence.set(1);
|
||||
orderLast = generateOrder(sequence.get());
|
||||
}else {
|
||||
orderLast = generateOrder(value);
|
||||
}
|
||||
String stockingOrder = order + orderDate + orderLast;
|
||||
WmsInventoryCheck add = MapstructUtils.convert(bo, WmsInventoryCheck.class);
|
||||
add.setCheckCode(stockingOrder);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setInventoryCheckId(add.getInventoryCheckId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
public String generateOrder(Integer value){
|
||||
if (value.toString().length()<3){
|
||||
String fixedLengthString = String.format("%03d", value);
|
||||
return fixedLengthString;
|
||||
}else if (value.toString().length()==3){
|
||||
return value.toString();
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点
|
||||
*
|
||||
* @param bo 库存盘点
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsInventoryCheckBo bo) {
|
||||
WmsInventoryCheck update = MapstructUtils.convert(bo, WmsInventoryCheck.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsInventoryCheck entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除库存盘点信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.wms.domain.BaseMaterialInfo;
|
||||
import org.dromara.wms.domain.WmsBaseWarehouse;
|
||||
import org.dromara.wms.domain.WmsInventory;
|
||||
import org.dromara.wms.domain.WmsMoveOrder;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryBo;
|
||||
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryVo;
|
||||
import org.dromara.wms.domain.vo.WmsMoveOrderVo;
|
||||
import org.dromara.wms.mapper.WmsMoveOrderMapper;
|
||||
import org.dromara.wms.service.IWmsInventoryService;
|
||||
import org.dromara.wms.service.IWmsMoveOrderService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 移库工单Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsMoveOrderServiceImpl implements IWmsMoveOrderService {
|
||||
|
||||
private final WmsMoveOrderMapper baseMapper;
|
||||
@Autowired
|
||||
private IWmsInventoryService wmsInventoryService;
|
||||
|
||||
/**
|
||||
* 查询移库工单
|
||||
*
|
||||
* @param moveId 主键
|
||||
* @return 移库工单
|
||||
*/
|
||||
@Override
|
||||
public WmsMoveOrderVo queryById(Long moveId){
|
||||
return baseMapper.selectVoById(moveId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询移库工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 移库工单分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsMoveOrderVo> queryPageList(WmsMoveOrderBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsMoveOrder> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsMoveOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的移库工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 移库工单列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsMoveOrderVo> queryList(WmsMoveOrderBo bo) {
|
||||
MPJLambdaWrapper<WmsMoveOrder> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsMoveOrder> buildQueryWrapper(WmsMoveOrderBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsMoveOrder> lqw = JoinWrappers.lambda(WmsMoveOrder.class)
|
||||
.selectAll(WmsMoveOrder.class).select(WmsBaseWarehouse::getWarehouseCode).select(BaseMaterialInfo::getMaterialCode)
|
||||
.leftJoin(WmsBaseWarehouse.class,WmsBaseWarehouse::getWarehouseId,WmsMoveOrder::getWarehouseId)
|
||||
.leftJoin(BaseMaterialInfo.class,BaseMaterialInfo::getMaterialId,WmsMoveOrder::getMaterialId)
|
||||
.eq(bo.getMoveId() != null, WmsMoveOrder::getMoveId, bo.getMoveId())
|
||||
.eq(bo.getMaterialId() != null, WmsMoveOrder::getMaterialId, bo.getMaterialId())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsMoveOrder::getMaterialCategories, bo.getMaterialCategories())
|
||||
.eq(bo.getWarehouseId() != null, WmsMoveOrder::getWarehouseId, bo.getWarehouseId())
|
||||
.eq(bo.getPlanLocationCode() != null, WmsMoveOrder::getPlanLocationCode, bo.getPlanLocationCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getOrderStatus()), WmsMoveOrder::getOrderStatus, bo.getOrderStatus())
|
||||
.eq(bo.getTargetLocationCode() != null, WmsMoveOrder::getTargetLocationCode, bo.getTargetLocationCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsMoveOrder::getAuditBy, bo.getAuditBy())
|
||||
.eq(bo.getAuditTime() != null, WmsMoveOrder::getAuditTime, bo.getAuditTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsMoveOrder::getAuditStatus, bo.getAuditStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsMoveOrder::getAuditComments, bo.getAuditComments())
|
||||
.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsMoveOrder::getErpSynchronousStatus, bo.getErpSynchronousStatus())
|
||||
.eq(bo.getErpSynchronousQty() != null, WmsMoveOrder::getErpSynchronousQty, bo.getErpSynchronousQty())
|
||||
.orderByDesc(WmsMoveOrder::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增移库工单
|
||||
*
|
||||
* @param bo 移库工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsMoveOrderBo bo) {
|
||||
//查询仓库现有的物料数量
|
||||
HashMap<String, List<WmsInventoryVo>> list = wmsInventoryService.selectInventorys(bo);
|
||||
List<WmsInventoryVo> planList = list.get("planList");//计划库位数据
|
||||
if (CollectionUtils.isEmpty(planList)){
|
||||
return false;
|
||||
}
|
||||
ArrayList<WmsInventory> updateList = new ArrayList<>();
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
List<WmsInventoryVo> targetList = list.get("targetList");//目标库位数据
|
||||
Map<String, List<WmsInventoryVo>> resultList = targetList.stream().collect(Collectors.groupingBy(WmsInventoryVo::getBatchCode));
|
||||
for (WmsInventoryVo vo : planList) {
|
||||
WmsInventory wmsInventory = new WmsInventory();
|
||||
if (CollectionUtils.isEmpty(resultList.get(vo.getBatchCode()))){
|
||||
vo.setLocationCode(bo.getTargetLocationCode());
|
||||
BeanUtils.copyProperties(vo,wmsInventory);
|
||||
updateList.add(wmsInventory);
|
||||
}else {
|
||||
WmsInventoryVo target = resultList.get(vo.getBatchCode()).get(0);
|
||||
BigDecimal add = target.getInventoryQty().add(vo.getInventoryQty());
|
||||
target.setInventoryQty(add);
|
||||
BeanUtils.copyProperties(target,wmsInventory);
|
||||
updateList.add(wmsInventory);
|
||||
ids.add(vo.getInventoryId());
|
||||
}
|
||||
}
|
||||
int removeRows = wmsInventoryService.deletePlanList(ids);
|
||||
int rows = wmsInventoryService.updateWmsInventorys(updateList);
|
||||
WmsMoveOrder add = MapstructUtils.convert(bo, WmsMoveOrder.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setMoveId(add.getMoveId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改移库工单
|
||||
*
|
||||
* @param bo 移库工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsMoveOrderBo bo) {
|
||||
WmsMoveOrder update = MapstructUtils.convert(bo, WmsMoveOrder.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsMoveOrder entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除移库工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsInventoryCheckMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsMoveOrderMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue