增加库存盘点和物料分类管理

This commit is contained in:
chuzhichao 2023-04-27 17:41:08 +08:00
parent c206356687
commit 5979cfd37f
30 changed files with 2014 additions and 0 deletions

22
sql/inventoryCheck.sql Normal file
View File

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据', '3', '1', 'inventoryCheck', 'wms/inventoryCheck/index', 1, 0, 'C', '0', '0', 'wms:inventoryCheck:list', '#', 1, sysdate(), '', null, '库存盘点单据菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheck:query', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheck:add', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheck:edit', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheck:remove', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheck:export', '#', 1, sysdate(), '', null, '');

View File

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情', '3', '1', 'inventoryCheckDetail', 'wms/inventoryCheckDetail/index', 1, 0, 'C', '0', '0', 'wms:inventoryCheckDetail:list', '#', 1, sysdate(), '', null, '库存盘点单据详情菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheckDetail:query', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheckDetail:add', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheckDetail:edit', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheckDetail:remove', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('库存盘点单据详情导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wms:inventoryCheckDetail:export', '#', 1, sysdate(), '', null, '');

22
sql/itemType.sql Normal file
View File

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表', '3', '1', 'itemType', 'wms/itemType/index', 1, 0, 'C', '0', '0', 'wms:itemType:list', '#', 1, sysdate(), '', null, '物料类型表菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wms:itemType:query', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wms:itemType:add', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wms:itemType:edit', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wms:itemType:remove', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料类型表导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wms:itemType:export', '#', 1, sysdate(), '', null, '');

View File

@ -0,0 +1,102 @@
package com.cyl.wms.controller;
import java.util.List;
import com.cyl.wms.pojo.vo.form.InventoryCheckFrom;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.cyl.wms.convert.InventoryCheckConvert;
import com.cyl.wms.domain.InventoryCheck;
import com.cyl.wms.pojo.query.InventoryCheckQuery;
import com.cyl.wms.service.InventoryCheckService;
import com.cyl.wms.pojo.vo.InventoryCheckVO;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 库存盘点单据Controller
*
* @author zcc
* @date 2023-04-25
*/
@Api(description ="库存盘点单据接口列表")
@RestController
@RequestMapping("/wms/inventoryCheck")
public class InventoryCheckController extends BaseController {
@Autowired
private InventoryCheckService service;
@Autowired
private InventoryCheckConvert convert;
@ApiOperation("查询库存盘点单据列表")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:list')")
@PostMapping("/list")
public ResponseEntity<Page<InventoryCheck>> list(@RequestBody InventoryCheckQuery query, Pageable page) {
List<InventoryCheck> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@ApiOperation("导出库存盘点单据列表")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:export')")
@Log(title = "库存盘点单据", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public ResponseEntity<String> export(InventoryCheckQuery query) {
List<InventoryCheck> list = service.selectList(query, null);
ExcelUtil<InventoryCheckVO> util = new ExcelUtil<>(InventoryCheckVO.class);
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "库存盘点单据数据"));
}
@ApiOperation("获取库存盘点单据详细信息")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:query')")
@GetMapping(value = "/{id}")
public ResponseEntity<InventoryCheckFrom> getInfo(@PathVariable("id") Long id) {
return ResponseEntity.ok(service.selectById(id));
}
@ApiOperation("新增库存盘点单据")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:add')")
@Log(title = "库存盘点单据", businessType = BusinessType.INSERT)
@PostMapping
public ResponseEntity<Integer> add(@RequestBody InventoryCheck inventoryCheck) {
return ResponseEntity.ok(service.insert(inventoryCheck));
}
@ApiOperation("修改库存盘点单据")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:edit')")
@Log(title = "库存盘点单据", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody InventoryCheck inventoryCheck) {
return ResponseEntity.ok(service.update(inventoryCheck));
}
@ApiOperation("删除库存盘点单据")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:remove')")
@Log(title = "库存盘点单据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
return ResponseEntity.ok(service.deleteByIds(ids));
}
@ApiOperation("新增或更新盘点单据以及盘点单据明细")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheck:edit')")
@Log(title = "库存盘点单据", businessType = BusinessType.INSERT)
@PostMapping("add-or-update")
public ResponseEntity<Integer> addOrUpdate(@RequestBody InventoryCheckFrom inventoryCheckFrom) {
return ResponseEntity.ok(service.addOrUpdate(inventoryCheckFrom));
}
}

View File

@ -0,0 +1,93 @@
package com.cyl.wms.controller;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.cyl.wms.convert.InventoryCheckDetailConvert;
import com.cyl.wms.domain.InventoryCheckDetail;
import com.cyl.wms.pojo.query.InventoryCheckDetailQuery;
import com.cyl.wms.service.InventoryCheckDetailService;
import com.cyl.wms.pojo.vo.InventoryCheckDetailVO;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 库存盘点单据详情Controller
*
* @author zcc
* @date 2023-04-25
*/
@Api(description ="库存盘点单据详情接口列表")
@RestController
@RequestMapping("/wms/inventoryCheckDetail")
public class InventoryCheckDetailController extends BaseController {
@Autowired
private InventoryCheckDetailService service;
@Autowired
private InventoryCheckDetailConvert convert;
@ApiOperation("查询库存盘点单据详情列表")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:list')")
@PostMapping("/list")
public ResponseEntity<Page<InventoryCheckDetail>> list(@RequestBody InventoryCheckDetailQuery query, Pageable page) {
List<InventoryCheckDetail> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@ApiOperation("导出库存盘点单据详情列表")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:export')")
@Log(title = "库存盘点单据详情", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public ResponseEntity<String> export(InventoryCheckDetailQuery query) {
List<InventoryCheckDetail> list = service.selectList(query, null);
ExcelUtil<InventoryCheckDetailVO> util = new ExcelUtil<>(InventoryCheckDetailVO.class);
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "库存盘点单据详情数据"));
}
@ApiOperation("获取库存盘点单据详情详细信息")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:query')")
@GetMapping(value = "/{id}")
public ResponseEntity<InventoryCheckDetail> getInfo(@PathVariable("id") Long id) {
return ResponseEntity.ok(service.selectById(id));
}
@ApiOperation("新增库存盘点单据详情")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:add')")
@Log(title = "库存盘点单据详情", businessType = BusinessType.INSERT)
@PostMapping
public ResponseEntity<Integer> add(@RequestBody InventoryCheckDetail inventoryCheckDetail) {
return ResponseEntity.ok(service.insert(inventoryCheckDetail));
}
@ApiOperation("修改库存盘点单据详情")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:edit')")
@Log(title = "库存盘点单据详情", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody InventoryCheckDetail inventoryCheckDetail) {
return ResponseEntity.ok(service.update(inventoryCheckDetail));
}
@ApiOperation("删除库存盘点单据详情")
@PreAuthorize("@ss.hasPermi('wms:inventoryCheckDetail:remove')")
@Log(title = "库存盘点单据详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
return ResponseEntity.ok(service.deleteByIds(ids));
}
}

View File

@ -0,0 +1,107 @@
package com.cyl.wms.controller;
import com.cyl.wms.convert.ItemTypeConvert;
import com.cyl.wms.domain.ItemType;
import com.cyl.wms.pojo.query.ItemTypeQuery;
import com.cyl.wms.pojo.vo.ItemTypeVO;
import com.cyl.wms.service.ItemTypeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 物料类型表Controller
*
* @author zhangcheng
* @date 2023-04-03
*/
@Api(description = "物料类型表接口列表")
@RestController
@RequestMapping("/wms/itemType")
public class ItemTypeController extends BaseController {
@Autowired
private ItemTypeService service;
@Autowired
private ItemTypeConvert convert;
@ApiOperation("查询物料类型表列表")
@PreAuthorize("@ss.hasPermi('wms:itemType:list')")
@PostMapping("/list")
public ResponseEntity<Page<ItemType>> list(@RequestBody ItemTypeQuery query, Pageable page) {
List<ItemType> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page) list).getTotal()));
}
/**
* 查询物料类型表列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/noPageList")
public AjaxResult list(ItemTypeQuery query) {
List<ItemType> depts = service.selectList(query, null);
return AjaxResult.success(depts);
}
@ApiOperation("导出物料类型表列表")
@PreAuthorize("@ss.hasPermi('wms:itemType:export')")
@Log(title = "物料类型表", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public ResponseEntity<String> export(ItemTypeQuery query) {
List<ItemType> list = service.selectList(query, null);
ExcelUtil<ItemTypeVO> util = new ExcelUtil<>(ItemTypeVO.class);
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "物料类型表数据"));
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(ItemTypeQuery query) {
List<ItemType> itemTypes = service.selectList(query, null);
return AjaxResult.success(service.buildItemTypeTreeSelect(itemTypes));
}
@ApiOperation("获取物料类型表详细信息")
@PreAuthorize("@ss.hasPermi('wms:itemType:query')")
@GetMapping(value = "/{itemTypeId}")
public ResponseEntity<ItemType> getInfo(@PathVariable("itemTypeId") Long itemTypeId) {
return ResponseEntity.ok(service.selectByItemTypeId(itemTypeId));
}
@ApiOperation("新增物料类型表")
@PreAuthorize("@ss.hasPermi('wms:itemType:add')")
@Log(title = "物料类型表", businessType = BusinessType.INSERT)
@PostMapping
public ResponseEntity<Integer> add(@RequestBody ItemType itemType) {
return ResponseEntity.ok(service.insert(itemType));
}
@ApiOperation("修改物料类型表")
@PreAuthorize("@ss.hasPermi('wms:itemType:edit')")
@Log(title = "物料类型表", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody ItemType itemType) {
return ResponseEntity.ok(service.update(itemType));
}
@ApiOperation("删除物料类型表")
@PreAuthorize("@ss.hasPermi('wms:itemType:remove')")
@Log(title = "物料类型表", businessType = BusinessType.DELETE)
@DeleteMapping("/{itemTypeIds}")
public ResponseEntity<Integer> remove(@PathVariable Long[] itemTypeIds) {
return ResponseEntity.ok(service.deleteByItemTypeIds(itemTypeIds));
}
}

View File

@ -0,0 +1,32 @@
package com.cyl.wms.convert;
import com.cyl.wms.pojo.vo.form.InventoryCheckFrom;
import org.mapstruct.Mapper;
import com.cyl.wms.domain.InventoryCheck;
import com.cyl.wms.pojo.dto.InventoryCheckDTO;
import com.cyl.wms.pojo.vo.InventoryCheckVO;
import java.util.List;
/**
* 库存盘点单据 DO <=> DTO <=> VO / BO / Query
*
* @author zcc
*/
@Mapper(componentModel = "spring")
public interface InventoryCheckConvert {
/**
* @param source DO
* @return DTO
*/
InventoryCheckDTO do2dto(InventoryCheck source);
/**
* @param source DTO
* @return DO
*/
InventoryCheck dto2do(InventoryCheckDTO source);
List<InventoryCheckVO> dos2vos(List<InventoryCheck> list);
InventoryCheckFrom do2form(InventoryCheck inventoryCheck);
}

View File

@ -0,0 +1,34 @@
package com.cyl.wms.convert;
import com.cyl.wms.domain.InventoryHistory;
import org.mapstruct.Mapper;
import com.cyl.wms.domain.InventoryCheckDetail;
import com.cyl.wms.pojo.dto.InventoryCheckDetailDTO;
import com.cyl.wms.pojo.vo.InventoryCheckDetailVO;
import java.util.List;
/**
* 库存盘点单据详情 DO <=> DTO <=> VO / BO / Query
*
* @author zcc
*/
@Mapper(componentModel = "spring")
public interface InventoryCheckDetailConvert {
/**
* @param source DO
* @return DTO
*/
InventoryCheckDetailDTO do2dto(InventoryCheckDetail source);
/**
* @param source DTO
* @return DO
*/
InventoryCheckDetail dto2do(InventoryCheckDetailDTO source);
List<InventoryCheckDetailVO> dos2vos(List<InventoryCheckDetail> list);
List<InventoryCheckDetail> vos2dos(List<InventoryCheckDetailVO> details);
InventoryHistory vo2InventoryHistory(InventoryCheckDetailVO it);
}

View File

@ -0,0 +1,29 @@
package com.cyl.wms.convert;
import org.mapstruct.Mapper;
import com.cyl.wms.domain.ItemType;
import com.cyl.wms.pojo.dto.ItemTypeDTO;
import com.cyl.wms.pojo.vo.ItemTypeVO;
import java.util.List;
/**
* 物料类型表 DO <=> DTO <=> VO / BO / Query
*
* @author zcc
*/
@Mapper(componentModel = "spring")
public interface ItemTypeConvert {
/**
* @param source DO
* @return DTO
*/
ItemTypeDTO do2dto(ItemType source);
/**
* @param source DTO
* @return DO
*/
ItemType dto2do(ItemTypeDTO source);
List<ItemTypeVO> dos2vos(List<ItemType> list);
}

View File

@ -0,0 +1,85 @@
package com.cyl.wms.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* 库存盘点单据对象 wms_inventory_check
*
* @author zcc
*/
@ApiModel(description="库存盘点单据对象")
@Data
@TableName("wms_inventory_check")
public class InventoryCheck extends BaseAudit {
private static final long serialVersionUID = 1L;
public static String CREATED = "11";
public static String FINISH = "22";
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("库存盘点单号,系统自动生成")
@Excel(name = "库存盘点单号,系统自动生成")
private String inventoryCheckNo;
@ApiModelProperty("库存盘点类型")
@Excel(name = "库存盘点类型")
private Integer inventoryCheckType;
@ApiModelProperty("库存盘点单状态11盘点中 22已完成")
@Excel(name = "库存盘点单状态11盘点中 22已完成")
private Integer inventoryCheckStatus;
@ApiModelProperty("盈亏数")
@Excel(name = "盈亏数")
private BigDecimal inventoryCheckTotal;
@ApiModelProperty("审核状态")
@Excel(name = "审核状态")
private Integer checkStatus;
@ApiModelProperty("审核人")
@Excel(name = "审核人")
private Long checkUserId;
@ApiModelProperty("审核时间")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime checkTime;
@ApiModelProperty("所属仓库")
@Excel(name = "所属仓库")
private Long warehouseId;
@ApiModelProperty("所属库区")
@Excel(name = "所属库区")
private Long areaId;
@ApiModelProperty("货架")
@Excel(name = "货架")
private Long rackId;
@ApiModelProperty("附件文件")
@Excel(name = "附件文件")
private String attachment;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("删除标识")
private Integer delFlag;
@TableField(exist = false)
private List<Long> place;
}

View File

@ -0,0 +1,59 @@
package com.cyl.wms.domain;
import java.math.BigDecimal;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* 库存盘点单据详情对象 wms_inventory_check_detail
*
* @author zcc
*/
@ApiModel(description="库存盘点单据详情对象")
@Data
@TableName("wms_inventory_check_detail")
public class InventoryCheckDetail extends BaseAudit {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("库存盘点单")
@Excel(name = "库存盘点单")
private Long inventoryCheckId;
@ApiModelProperty("物料")
@Excel(name = "物料")
private Long itemId;
@ApiModelProperty("库存数量")
@Excel(name = "库存数量")
private BigDecimal quantity;
@ApiModelProperty("盘点数量")
@Excel(name = "盘点数量")
private BigDecimal checkQuantity;
@ApiModelProperty("所属仓库")
@Excel(name = "所属仓库")
private Long warehouseId;
@ApiModelProperty("所属库区")
@Excel(name = "所属库区")
private Long areaId;
@ApiModelProperty("货架")
@Excel(name = "货架")
private Long rackId;
@ApiModelProperty("删除标识")
private Integer delFlag;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}

View File

@ -0,0 +1,159 @@
package com.cyl.wms.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;
/**
* 物料类型表对象 wms_item_type
*
* @author zhangcheng
*/
@ApiModel(description = "物料类型表对象")
@TableName("wms_item_type")
public class ItemType extends BaseAudit {
private static final long serialVersionUID = 1L;
@ApiModelProperty("物料类型id")
@TableField(value = "item_type_id")
@TableId(type = IdType.AUTO)
private Long itemTypeId;
public Long getItemTypeId() {
return itemTypeId;
}
public void setItemTypeId(Long itemTypeId) {
this.itemTypeId = itemTypeId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public void setChildren(List<ItemType> children) {
this.children = children;
}
@ApiModelProperty("父物料类型id")
@Excel(name = "父物料类型id")
private Long parentId;
@ApiModelProperty("祖级列表")
@Excel(name = "祖级列表")
private String ancestors;
@ApiModelProperty("物料类型名称")
@Excel(name = "物料类型名称")
private String typeName;
@ApiModelProperty("显示顺序")
@Excel(name = "显示顺序")
private String orderNum;
@ApiModelProperty("物料类型状态0正常 1停用")
@Excel(name = "物料类型状态", readConverterExp = "0=正常,1=停用")
private String status;
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag;
/**
* 父部门名称
*/
@TableField(exist = false)
private String parentName = "11";
/**
* 子部门
*/
@TableField(exist = false)
private List<ItemType> children = new ArrayList<ItemType>();
public List<ItemType> getChildren() {
return children;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
@NotBlank(message = "显示顺序不能为空")
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("itemTypeId", getItemTypeId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("typeName", getTypeName())
.append("orderNum", getOrderNum())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,35 @@
package com.cyl.wms.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.cyl.wms.domain.InventoryCheckDetail;
/**
* 库存盘点单据详情Mapper接口
*
* @author zcc
*/
public interface InventoryCheckDetailMapper extends BaseMapper<InventoryCheckDetail> {
/**
* 查询库存盘点单据详情列表
*
* @param inventoryCheckDetail 库存盘点单据详情
* @return 库存盘点单据详情集合
*/
List<InventoryCheckDetail> selectByEntity(InventoryCheckDetail inventoryCheckDetail);
/**
* 批量软删除
* @param ids
* @return
*/
int updateDelFlagByIds(@Param("ids") Long[] ids);
/**
* 批量插入
* @param inventoryCheckDetails 库存盘点单据详情
* @return 插入结果
*/
int batchInsert(List<InventoryCheckDetail> inventoryCheckDetails);
}

View File

@ -0,0 +1,28 @@
package com.cyl.wms.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.cyl.wms.domain.InventoryCheck;
/**
* 库存盘点单据Mapper接口
*
* @author zcc
*/
public interface InventoryCheckMapper extends BaseMapper<InventoryCheck> {
/**
* 查询库存盘点单据列表
*
* @param inventoryCheck 库存盘点单据
* @return 库存盘点单据集合
*/
List<InventoryCheck> selectByEntity(InventoryCheck inventoryCheck);
/**
* 批量软删除
* @param ids
* @return
*/
int updateDelFlagByIds(@Param("ids") Long[] ids);
}

View File

@ -0,0 +1,28 @@
package com.cyl.wms.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.cyl.wms.domain.ItemType;
/**
* 物料类型表Mapper接口
*
* @author zcc
*/
public interface ItemTypeMapper extends BaseMapper<ItemType> {
/**
* 查询物料类型表列表
*
* @param itemType 物料类型表
* @return 物料类型表集合
*/
List<ItemType> selectByEntity(ItemType itemType);
/**
* 批量软删除
* @param ids
* @return
*/
int updateDelFlagByIds(@Param("ids") Long[] ids);
}

View File

@ -0,0 +1,27 @@
package com.cyl.wms.pojo.dto;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 库存盘点单据 DTO 对象
*
* @author zcc
*/
@Data
public class InventoryCheckDTO extends BaseAudit {
private Long id;
private String inventoryCheckNo;
private Integer inventoryCheckType;
private Integer inventoryCheckStatus;
private BigDecimal inventoryCheckTotal;
private Integer checkStatus;
private Long checkUserId;
private LocalDateTime checkTime;
private Long warehouseId;
private Long areaId;
private Long rackId;
private String attachment;
private String remark;
}

View File

@ -0,0 +1,22 @@
package com.cyl.wms.pojo.dto;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 库存盘点单据详情 DTO 对象
*
* @author zcc
*/
@Data
public class InventoryCheckDetailDTO extends BaseAudit {
private Long id;
private Long inventoryCheckId;
private Long itemId;
private BigDecimal quantity;
private BigDecimal checkQuantity;
private Long warehouseId;
private Long areaId;
private Long rackId;
private String remark;
}

View File

@ -0,0 +1,18 @@
package com.cyl.wms.pojo.dto;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 物料类型表 DTO 对象
*
* @author zcc
*/
@Data
public class ItemTypeDTO extends BaseAudit {
private Long itemTypeId;
private Long parentId;
private String ancestors;
private String typeName;
private Integer orderNum;
private String status;
}

View File

@ -0,0 +1,37 @@
package com.cyl.wms.pojo.query;
import java.math.BigDecimal;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 库存盘点单据详情 查询 对象
*
* @author zcc
*/
@ApiModel(description="库存盘点单据详情 查询 对象")
@Data
public class InventoryCheckDetailQuery {
@ApiModelProperty("库存盘点单 精确匹配")
private Long inventoryCheckId;
@ApiModelProperty("物料 精确匹配")
private Long itemId;
@ApiModelProperty("库存数量 精确匹配")
private BigDecimal quantity;
@ApiModelProperty("盘点数量 精确匹配")
private BigDecimal checkQuantity;
@ApiModelProperty("所属仓库 精确匹配")
private Long warehouseId;
@ApiModelProperty("所属库区 精确匹配")
private Long areaId;
@ApiModelProperty("货架 精确匹配")
private Long rackId;
}

View File

@ -0,0 +1,50 @@
package com.cyl.wms.pojo.query;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 库存盘点单据 查询 对象
*
* @author zcc
*/
@ApiModel(description="库存盘点单据 查询 对象")
@Data
public class InventoryCheckQuery {
@ApiModelProperty("库存盘点单号,系统自动生成 精确匹配")
private String inventoryCheckNo;
@ApiModelProperty("库存盘点类型 精确匹配")
private Integer inventoryCheckType;
@ApiModelProperty("库存盘点单状态11盘点中 22已完成 精确匹配")
private Integer inventoryCheckStatus;
@ApiModelProperty("盈亏数 精确匹配")
private BigDecimal inventoryCheckTotal;
@ApiModelProperty("审核状态 精确匹配")
private Integer checkStatus;
@ApiModelProperty("审核人 精确匹配")
private Long checkUserId;
@ApiModelProperty("审核时间 精确匹配")
private LocalDateTime checkTime;
@ApiModelProperty("所属仓库 精确匹配")
private Long warehouseId;
@ApiModelProperty("所属库区 精确匹配")
private Long areaId;
@ApiModelProperty("货架 精确匹配")
private Long rackId;
@ApiModelProperty("附件文件 精确匹配")
private String attachment;
}

View File

@ -0,0 +1,30 @@
package com.cyl.wms.pojo.query;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 物料类型表 查询 对象
*
* @author zcc
*/
@ApiModel(description="物料类型表 查询 对象")
@Data
public class ItemTypeQuery {
@ApiModelProperty("父物料类型id 精确匹配")
private Long parentId;
@ApiModelProperty("祖级列表 精确匹配")
private String ancestors;
@ApiModelProperty("物料类型名称 精确匹配")
private String typeNameLike;
@ApiModelProperty("显示顺序 精确匹配")
private Integer orderNum;
@ApiModelProperty("物料类型状态0正常 1停用 精确匹配")
private String status;
}

View File

@ -0,0 +1,44 @@
package com.cyl.wms.pojo.vo;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 库存盘点单据详情 数据视图对象
*
* @author zcc
*/
@Data
public class InventoryCheckDetailVO extends BaseAudit {
/** ID */
private Long id;
/** 库存盘点单 */
@Excel(name = "库存盘点单")
private Long inventoryCheckId;
/** 物料 */
@Excel(name = "物料")
private Long itemId;
/** 库存数量 */
@Excel(name = "库存数量")
private BigDecimal quantity;
/** 盘点数量 */
@Excel(name = "盘点数量")
private BigDecimal checkQuantity;
/** 所属仓库 */
@Excel(name = "所属仓库")
private Long warehouseId;
/** 所属库区 */
@Excel(name = "所属库区")
private Long areaId;
/** 货架 */
@Excel(name = "货架")
private Long rackId;
/** 备注 */
@Excel(name = "备注")
private String remark;
private List<Long> place;
}

View File

@ -0,0 +1,55 @@
package com.cyl.wms.pojo.vo;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.ruoyi.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 库存盘点单据 数据视图对象
*
* @author zcc
*/
@Data
public class InventoryCheckVO extends BaseAudit {
/** ID */
private Long id;
/** 库存盘点单号,系统自动生成 */
@Excel(name = "库存盘点单号,系统自动生成")
private String inventoryCheckNo;
/** 库存盘点类型 */
@Excel(name = "库存盘点类型")
private Integer inventoryCheckType;
/** 库存盘点单状态11盘点中 22已完成 */
@Excel(name = "库存盘点单状态11盘点中 22已完成")
private Integer inventoryCheckStatus;
/** 盈亏数 */
@Excel(name = "盈亏数")
private BigDecimal inventoryCheckTotal;
/** 审核状态 */
@Excel(name = "审核状态")
private Integer checkStatus;
/** 审核人 */
@Excel(name = "审核人")
private Long checkUserId;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime checkTime;
/** 所属仓库 */
@Excel(name = "所属仓库")
private Long warehouseId;
/** 所属库区 */
@Excel(name = "所属库区")
private Long areaId;
/** 货架 */
@Excel(name = "货架")
private Long rackId;
/** 附件文件 */
@Excel(name = "附件文件")
private String attachment;
/** 备注 */
@Excel(name = "备注")
private String remark;
}

View File

@ -0,0 +1,31 @@
package com.cyl.wms.pojo.vo;
import com.ruoyi.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
* 物料类型表 数据视图对象
*
* @author zcc
*/
@Data
public class ItemTypeVO extends BaseAudit {
/** 物料类型id */
private Long itemTypeId;
/** 父物料类型id */
@Excel(name = "父物料类型id")
private Long parentId;
/** 祖级列表 */
@Excel(name = "祖级列表")
private String ancestors;
/** 物料类型名称 */
@Excel(name = "物料类型名称")
private String typeName;
/** 显示顺序 */
@Excel(name = "显示顺序")
private Integer orderNum;
/** 物料类型状态0正常 1停用 */
@Excel(name = "物料类型状态", readConverterExp = "0=正常,1=停用")
private String status;
}

View File

@ -0,0 +1,153 @@
package com.cyl.wms.service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyl.wms.convert.InventoryCheckDetailConvert;
import com.cyl.wms.domain.InventoryHistory;
import com.cyl.wms.pojo.vo.InventoryCheckDetailVO;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.cyl.wms.mapper.InventoryCheckDetailMapper;
import com.cyl.wms.domain.InventoryCheckDetail;
import com.cyl.wms.pojo.query.InventoryCheckDetailQuery;
/**
* 库存盘点单据详情Service业务层处理
*
*
* @author zcc
*/
@Service
public class InventoryCheckDetailService {
@Autowired
private InventoryCheckDetailMapper inventoryCheckDetailMapper;
@Autowired
private InventoryCheckDetailConvert convert;
/**
* 查询库存盘点单据详情
*
* @param id 库存盘点单据详情主键
* @return 库存盘点单据详情
*/
public InventoryCheckDetail selectById(Long id) {
return inventoryCheckDetailMapper.selectById(id);
}
public List<InventoryCheckDetailVO> toVos(List<InventoryCheckDetail> items) {
List<InventoryCheckDetailVO> list = convert.dos2vos(items);
list.forEach(itemVO -> {
List<Long> place = new LinkedList<>();
if (itemVO.getWarehouseId() != null) {
place.add(itemVO.getWarehouseId());
}
if (itemVO.getAreaId() != null) {
place.add(itemVO.getAreaId());
}
if (itemVO.getRackId() != null) {
place.add(itemVO.getRackId());
}
itemVO.setPlace(place);
});
return list;
}
/**
* 查询库存盘点单据详情列表
*
* @param query 查询条件
* @param page 分页条件
* @return 库存盘点单据详情
*/
public List<InventoryCheckDetail> selectList(InventoryCheckDetailQuery query, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
QueryWrapper<InventoryCheckDetail> qw = new QueryWrapper<>();
qw.eq("del_flag",0);
Long inventoryCheckId = query.getInventoryCheckId();
if (inventoryCheckId != null) {
qw.eq("inventory_check_id", inventoryCheckId);
}
Long itemId = query.getItemId();
if (itemId != null) {
qw.eq("item_id", itemId);
}
BigDecimal quantity = query.getQuantity();
if (quantity != null) {
qw.eq("quantity", quantity);
}
BigDecimal checkQuantity = query.getCheckQuantity();
if (checkQuantity != null) {
qw.eq("check_quantity", checkQuantity);
}
Long warehouseId = query.getWarehouseId();
if (warehouseId != null) {
qw.eq("warehouse_id", warehouseId);
}
Long areaId = query.getAreaId();
if (areaId != null) {
qw.eq("area_id", areaId);
}
Long rackId = query.getRackId();
if (rackId != null) {
qw.eq("rack_id", rackId);
}
return inventoryCheckDetailMapper.selectList(qw);
}
/**
* 新增库存盘点单据详情
*
* @param inventoryCheckDetail 库存盘点单据详情
* @return 结果
*/
public int insert(InventoryCheckDetail inventoryCheckDetail) {
inventoryCheckDetail.setDelFlag(0);
inventoryCheckDetail.setCreateTime(LocalDateTime.now());
return inventoryCheckDetailMapper.insert(inventoryCheckDetail);
}
/**
* 修改库存盘点单据详情
*
* @param inventoryCheckDetail 库存盘点单据详情
* @return 结果
*/
public int update(InventoryCheckDetail inventoryCheckDetail) {
return inventoryCheckDetailMapper.updateById(inventoryCheckDetail);
}
/**
* 批量删除库存盘点单据详情
*
* @param ids 需要删除的库存盘点单据详情主键
* @return 结果
*/
public int deleteByIds(Long[] ids) {
return inventoryCheckDetailMapper.updateDelFlagByIds(ids);
}
/**
* 删除库存盘点单据详情信息
*
* @param id 库存盘点单据详情主键
* @return 结果
*/
public int deleteById(Long id) {
Long[] ids = {id};
return inventoryCheckDetailMapper.updateDelFlagByIds(ids);
}
public InventoryHistory vo2InventoryHistory(InventoryCheckDetailVO it) {
return convert.vo2InventoryHistory(it);
}
}

View File

@ -0,0 +1,321 @@
package com.cyl.wms.service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.time.LocalDateTime;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyl.wms.constant.ReceiptOrderConstant;
import com.cyl.wms.constant.ShipmentOrderConstant;
import com.cyl.wms.convert.InventoryCheckConvert;
import com.cyl.wms.convert.InventoryCheckDetailConvert;
import com.cyl.wms.domain.InventoryCheckDetail;
import com.cyl.wms.domain.InventoryHistory;
import com.cyl.wms.domain.Item;
import com.cyl.wms.mapper.InventoryCheckDetailMapper;
import com.cyl.wms.pojo.query.InventoryCheckDetailQuery;
import com.cyl.wms.pojo.query.ItemQuery;
import com.cyl.wms.pojo.vo.InventoryCheckDetailVO;
import com.cyl.wms.pojo.vo.ItemVO;
import com.cyl.wms.pojo.vo.form.InventoryCheckFrom;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.cyl.wms.mapper.InventoryCheckMapper;
import com.cyl.wms.domain.InventoryCheck;
import com.cyl.wms.pojo.query.InventoryCheckQuery;
import org.springframework.transaction.annotation.Transactional;
/**
* 库存盘点单据Service业务层处理
*
*
* @author zcc
*/
@Slf4j
@Service
public class InventoryCheckService {
@Autowired
private InventoryCheckMapper inventoryCheckMapper;
@Autowired
private InventoryCheckDetailMapper inventoryCheckDetailMapper;
@Autowired
private InventoryCheckDetailConvert detailConvert;
@Autowired
private InventoryCheckDetailService inventoryCheckDetailService;
@Autowired
private InventoryHistoryService inventoryHistoryService;
@Autowired
private InventoryService inventoryService;
@Autowired
private ItemService itemService;
@Autowired
private InventoryCheckConvert convert;
/**
* 查询库存盘点单据
*
* @param id 库存盘点单据主键
* @return 库存盘点单据
*/
public InventoryCheckFrom selectById(Long id) {
InventoryCheck inventoryCheck = inventoryCheckMapper.selectById(id);
if (inventoryCheck == null) return null;
InventoryCheckFrom from = do2form(inventoryCheck);
InventoryCheckDetailQuery inventoryCheckDetailQuery = new InventoryCheckDetailQuery();
inventoryCheckDetailQuery.setInventoryCheckId(id);
List<InventoryCheckDetail> inventoryCheckDetails = inventoryCheckDetailService.selectList(inventoryCheckDetailQuery, null);
List<InventoryCheckDetailVO> inventoryCheckDetailsVos = inventoryCheckDetailService.toVos(inventoryCheckDetails);
from.setDetails(inventoryCheckDetailsVos);
if (!CollUtil.isEmpty(from.getDetails())) {
List<Long> itemIds = from.getDetails().stream().map(InventoryCheckDetailVO::getItemId).distinct().collect(Collectors.toList());
ItemQuery query1 = new ItemQuery();
query1.setIds(itemIds);
List<Item> list = itemService.selectList(query1, null);
List<ItemVO> items = itemService.toVos(list);
from.setItems(items);
}
return from;
}
private InventoryCheckFrom do2form(InventoryCheck inventoryCheck) {
InventoryCheckFrom itemVO = convert.do2form(inventoryCheck);
List<Long> place = new LinkedList<>();
if (itemVO.getWarehouseId() != null) {
place.add(itemVO.getWarehouseId());
}
if (itemVO.getAreaId() != null) {
place.add(itemVO.getAreaId());
}
if (itemVO.getRackId() != null) {
place.add(itemVO.getRackId());
}
itemVO.setPlace(place);
return itemVO;
}
/**
* 查询库存盘点单据列表
*
* @param query 查询条件
* @param page 分页条件
* @return 库存盘点单据
*/
public List<InventoryCheck> selectList(InventoryCheckQuery query, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
QueryWrapper<InventoryCheck> qw = new QueryWrapper<>();
qw.eq("del_flag",0);
String inventoryCheckNo = query.getInventoryCheckNo();
if (!StringUtils.isEmpty(inventoryCheckNo)) {
qw.eq("inventory_check_no", inventoryCheckNo);
}
Integer inventoryCheckType = query.getInventoryCheckType();
if (inventoryCheckType != null) {
qw.eq("inventory_check_type", inventoryCheckType);
}
Integer inventoryCheckStatus = query.getInventoryCheckStatus();
if (inventoryCheckStatus != null) {
qw.eq("inventory_check_status", inventoryCheckStatus);
}
BigDecimal inventoryCheckTotal = query.getInventoryCheckTotal();
if (inventoryCheckTotal != null) {
qw.eq("inventory_check_total", inventoryCheckTotal);
}
Integer checkStatus = query.getCheckStatus();
if (checkStatus != null) {
qw.eq("check_status", checkStatus);
}
Long checkUserId = query.getCheckUserId();
if (checkUserId != null) {
qw.eq("check_user_id", checkUserId);
}
LocalDateTime checkTime = query.getCheckTime();
if (checkTime != null) {
qw.eq("check_time", checkTime);
}
Long warehouseId = query.getWarehouseId();
if (warehouseId != null) {
qw.eq("warehouse_id", warehouseId);
}
Long areaId = query.getAreaId();
if (areaId != null) {
qw.eq("area_id", areaId);
}
Long rackId = query.getRackId();
if (rackId != null) {
qw.eq("rack_id", rackId);
}
String attachment = query.getAttachment();
if (!StringUtils.isEmpty(attachment)) {
qw.eq("attachment", attachment);
}
return inventoryCheckMapper.selectList(qw);
}
/**
* 新增库存盘点单据
*
* @param inventoryCheck 库存盘点单据
* @return 结果
*/
public int insert(InventoryCheck inventoryCheck) {
inventoryCheck.setDelFlag(0);
inventoryCheck.setCreateTime(LocalDateTime.now());
return inventoryCheckMapper.insert(inventoryCheck);
}
/**
* 修改库存盘点单据
*
* @param inventoryCheck 库存盘点单据
* @return 结果
*/
public int update(InventoryCheck inventoryCheck) {
return inventoryCheckMapper.updateById(inventoryCheck);
}
/**
* 批量删除库存盘点单据
*
* @param ids 需要删除的库存盘点单据主键
* @return 结果
*/
public int deleteByIds(Long[] ids) {
return inventoryCheckMapper.updateDelFlagByIds(ids);
}
/**
* 删除库存盘点单据信息
*
* @param id 库存盘点单据主键
* @return 结果
*/
public int deleteById(Long id) {
Long[] ids = {id};
return inventoryCheckMapper.updateDelFlagByIds(ids);
}
/**
* 新增或更新盘点单据以及盘点单据明细
*
* @param inventoryCheckFrom 盘点单据
* @return 结果
*/
@Transactional
public int addOrUpdate(InventoryCheckFrom inventoryCheckFrom) {
int res;
// 1. 新增
if (inventoryCheckFrom.getId() == null) {
inventoryCheckFrom.setDelFlag(0);
inventoryCheckFrom.setCreateTime(LocalDateTime.now());
res = inventoryCheckMapper.insert(inventoryCheckFrom);
} else {
// 2.编辑
// 2.1 更新盘点单
res = inventoryCheckMapper.updateById(inventoryCheckFrom);
}
if (InventoryCheckFrom.CREATED.equals(String.valueOf(inventoryCheckFrom.getInventoryCheckStatus()))) {
// 3.暂存
// 3.1 删除明细单
LambdaQueryWrapper<InventoryCheckDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InventoryCheckDetail::getInventoryCheckId, inventoryCheckFrom.getId());
inventoryCheckDetailMapper.delete(queryWrapper);
// 3.2 保存明细单
saveDetails(inventoryCheckFrom.getId(), inventoryCheckFrom.getDetails());
} else if (InventoryCheckFrom.FINISH.equals(String.valueOf(inventoryCheckFrom.getInventoryCheckStatus()))) {
// 4.盘点结束
// 4.1 删除明细单
LambdaQueryWrapper<InventoryCheckDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InventoryCheckDetail::getInventoryCheckId, inventoryCheckFrom.getId());
inventoryCheckDetailMapper.delete(queryWrapper);
// 4.2 保存明细单
saveDetails(inventoryCheckFrom.getId(), inventoryCheckFrom.getDetails());
// 4.3 操作库存流水物料库存
saveInventory(inventoryCheckFrom.getId(), inventoryCheckFrom.getDetails());
}
return res;
}
/**
* 操作库存流水物料库存
*
* @param inventoryCheckId 操作单
* @param details 盘点单据详情
*/
private void saveInventory(final Long inventoryCheckId, List<InventoryCheckDetailVO> details) {
List<InventoryHistory> adds = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
Long userId = SecurityUtils.getUserId();
details.forEach(it -> {
BigDecimal subtract = it.getCheckQuantity().subtract(it.getQuantity());
InventoryHistory h = inventoryCheckDetailService.vo2InventoryHistory(it);
h.setFormId(inventoryCheckId);
if (subtract.compareTo(BigDecimal.ZERO) == 0) {
return;
} else if (subtract.compareTo(BigDecimal.ZERO) > 0) {
// 盘盈入库
h.setFormType(ReceiptOrderConstant.CHECK);
} else {
// 盘亏出库
h.setFormType(ShipmentOrderConstant.CHECK);
}
h.setQuantity(subtract);
h.setDelFlag(0);
h.setId(null);
h.setCreateTime(now);
h.setCreateBy(userId);
h.setUpdateBy(userId);
h.setUpdateTime(now);
adds.add(h);
});
if (adds.size() > 0) {
int add1 = inventoryHistoryService.batchInsert(adds);
int update1 = inventoryService.batchUpdate1(adds);
log.info("inventoryHistory: {}, inventory: {}", add1, update1);
}
}
/**
* 保存单据明细
*
* @param details 盘点单据详情
*/
private void saveDetails(Long checkId, List<InventoryCheckDetailVO> details) {
if (!CollUtil.isEmpty(details)) {
details.forEach(it -> it.setInventoryCheckId(checkId));
List<InventoryCheckDetail> inventoryCheckDetails = detailConvert.vos2dos(details);
inventoryCheckDetailMapper.batchInsert(inventoryCheckDetails);
}
}
}

View File

@ -0,0 +1,185 @@
package com.cyl.wms.service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.time.LocalDateTime;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyl.wms.domain.ItemTypeTreeSelect;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.cyl.wms.mapper.ItemTypeMapper;
import com.cyl.wms.domain.ItemType;
import com.cyl.wms.pojo.query.ItemTypeQuery;
/**
* 物料类型表Service业务层处理
*
*
* @author zcc
*/
@Service
public class ItemTypeService {
@Autowired
private ItemTypeMapper itemTypeMapper;
/**
* 查询物料类型表
*
* @param itemTypeId 物料类型表主键
* @return 物料类型表
*/
public ItemType selectByItemTypeId(Long itemTypeId) {
return itemTypeMapper.selectById(itemTypeId);
}
/**
* 查询物料类型表列表
*
* @param query 查询条件
* @param page 分页条件
* @return 物料类型表
*/
public List<ItemType> selectList(ItemTypeQuery query, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
QueryWrapper<ItemType> qw = new QueryWrapper<>();
qw.eq("del_flag",0);
Long parentId = query.getParentId();
if (parentId != null) {
qw.eq("parent_id", parentId);
}
String ancestors = query.getAncestors();
if (!StringUtils.isEmpty(ancestors)) {
qw.eq("ancestors", ancestors);
}
String typeNameLike = query.getTypeNameLike();
if (!StringUtils.isEmpty(typeNameLike)) {
qw.like("type_name", typeNameLike);
}
Integer orderNum = query.getOrderNum();
if (orderNum != null) {
qw.eq("order_num", orderNum);
}
String status = query.getStatus();
if (!StringUtils.isEmpty(status)) {
qw.eq("status", status);
}
return itemTypeMapper.selectList(qw);
}
/**
* 新增物料类型表
*
* @param itemType 物料类型表
* @return 结果
*/
public int insert(ItemType itemType) {
itemType.setDelFlag(String.valueOf(0));
itemType.setCreateTime(LocalDateTime.now());
return itemTypeMapper.insert(itemType);
}
/**
* 修改物料类型表
*
* @param itemType 物料类型表
* @return 结果
*/
public int update(ItemType itemType) {
return itemTypeMapper.updateById(itemType);
}
/**
* 批量删除物料类型表
*
* @param itemTypeIds 需要删除的物料类型表主键
* @return 结果
*/
public int deleteByItemTypeIds(Long[] itemTypeIds) {
return itemTypeMapper.updateDelFlagByIds(itemTypeIds);
}
/**
* 删除物料类型表信息
*
* @param itemTypeId 物料类型表主键
* @return 结果
*/
public int deleteByItemTypeId(Long itemTypeId) {
Long[] itemTypeIds = {itemTypeId};
return itemTypeMapper.updateDelFlagByIds(itemTypeIds);
}
public List<ItemTypeTreeSelect> buildItemTypeTreeSelect(List<ItemType> itemTypes) {
List<ItemType> itemTypeTrees = buildDeptTree(itemTypes);
return itemTypeTrees.stream().map(ItemTypeTreeSelect::new).collect(Collectors.toList());
}
/**
* 构建前端所需要树结构
*
* @param itemTypes 部门列表
* @return 树结构列表
*/
public List<ItemType> buildDeptTree(List<ItemType> itemTypes) {
List<ItemType> returnList = new ArrayList<>();
List<Long> tempList = new ArrayList<Long>();
for (ItemType dept : itemTypes) {
tempList.add(dept.getItemTypeId());
}
for (Iterator<ItemType> iterator = itemTypes.iterator(); iterator.hasNext(); ) {
ItemType dept = (ItemType) iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId())) {
recursionFn(itemTypes, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty()) {
returnList = itemTypes;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<ItemType> list, ItemType t) {
// 得到子节点列表
List<ItemType> childList = getChildList(list, t);
t.setChildren(childList);
for (ItemType tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<ItemType> getChildList(List<ItemType> list, ItemType t) {
List<ItemType> tlist = new ArrayList<>();
for (ItemType n : list) {
if (com.ruoyi.common.utils.StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getItemTypeId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<ItemType> list, ItemType t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}

View File

@ -0,0 +1,79 @@
<?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="com.cyl.wms.mapper.InventoryCheckDetailMapper">
<resultMap type="InventoryCheckDetail" id="InventoryCheckDetailResult">
<result property="id" column="id"/>
<result property="inventoryCheckId" column="inventory_check_id"/>
<result property="itemId" column="item_id"/>
<result property="quantity" column="quantity"/>
<result property="checkQuantity" column="check_quantity"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="areaId" column="area_id"/>
<result property="rackId" column="rack_id"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectInventoryCheckDetailVo">
select id, inventory_check_id, item_id, quantity, check_quantity, warehouse_id, area_id, rack_id, del_flag, remark, create_by, create_time, update_by, update_time from wms_inventory_check_detail
</sql>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into wms_inventory_check_detail
(inventory_check_id,
item_id,
quantity,
check_quantity,
warehouse_id,
area_id,
rack_id,
remark,
create_by,
create_time,
update_by,
update_time
)
values
<foreach collection="list" item="item" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.inventoryCheckId,jdbcType=BIGINT},#{item.itemId,jdbcType=BIGINT},#{item.quantity,jdbcType=DECIMAL},#{item.checkQuantity,jdbcType=DECIMAL},
#{item.warehouseId,jdbcType=BIGINT}, #{item.areaId,jdbcType=BIGINT}, #{item.rackId,jdbcType=BIGINT},
#{item.remark,jdbcType=VARCHAR},#{item.createBy,jdbcType=BIGINT},#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateBy,jdbcType=BIGINT},#{item.updateTime,jdbcType=TIMESTAMP},
</trim>
</foreach>
</insert>
<select id="selectByEntity" parameterType="InventoryCheckDetail" resultMap="InventoryCheckDetailResult">
<include refid="selectInventoryCheckDetailVo"/>
<where>
<if test="inventoryCheckId != null "> and inventory_check_id = #{inventoryCheckId}</if>
<if test="itemId != null "> and item_id = #{itemId}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="checkQuantity != null "> and check_quantity = #{checkQuantity}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="rackId != null "> and rack_id = #{rackId}</if>
</where>
</select>
<update id="updateDelFlagByIds">
update wms_inventory_check_detail set del_flag=1
<where>
id in <foreach collection="ids" open="(" item="it" close=")" separator=",">#{it}</foreach>
</where>
</update>
</mapper>

View File

@ -0,0 +1,59 @@
<?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="com.cyl.wms.mapper.InventoryCheckMapper">
<resultMap type="InventoryCheck" id="InventoryCheckResult">
<result property="id" column="id"/>
<result property="inventoryCheckNo" column="inventory_check_no"/>
<result property="inventoryCheckType" column="inventory_check_type"/>
<result property="inventoryCheckStatus" column="inventory_check_status"/>
<result property="inventoryCheckTotal" column="inventory_check_total"/>
<result property="checkStatus" column="check_status"/>
<result property="checkUserId" column="check_user_id"/>
<result property="checkTime" column="check_time"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="areaId" column="area_id"/>
<result property="rackId" column="rack_id"/>
<result property="attachment" column="attachment"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectInventoryCheckVo">
select id, inventory_check_no, inventory_check_type, inventory_check_status, inventory_check_total, check_status, check_user_id, check_time, warehouse_id, area_id, rack_id, attachment, remark, del_flag, create_by, create_time, update_by, update_time from wms_inventory_check
</sql>
<select id="selectByEntity" parameterType="InventoryCheck" resultMap="InventoryCheckResult">
<include refid="selectInventoryCheckVo"/>
<where>
<if test="inventoryCheckNo != null and inventoryCheckNo != ''"> and inventory_check_no = #{inventoryCheckNo}</if>
<if test="inventoryCheckType != null "> and inventory_check_type = #{inventoryCheckType}</if>
<if test="inventoryCheckStatus != null "> and inventory_check_status = #{inventoryCheckStatus}</if>
<if test="inventoryCheckTotal != null "> and inventory_check_total = #{inventoryCheckTotal}</if>
<if test="checkStatus != null "> and check_status = #{checkStatus}</if>
<if test="checkUserId != null "> and check_user_id = #{checkUserId}</if>
<if test="checkTime != null "> and check_time = #{checkTime}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="rackId != null "> and rack_id = #{rackId}</if>
<if test="attachment != null and attachment != ''"> and attachment = #{attachment}</if>
</where>
</select>
<update id="updateDelFlagByIds">
update wms_inventory_check set del_flag=1
<where>
id in <foreach collection="ids" open="(" item="it" close=")" separator=",">#{it}</foreach>
</where>
</update>
</mapper>

View File

@ -0,0 +1,46 @@
<?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="com.cyl.wms.mapper.ItemTypeMapper">
<resultMap type="ItemType" id="ItemTypeResult">
<result property="itemTypeId" column="item_type_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="typeName" column="type_name"/>
<result property="orderNum" column="order_num"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectItemTypeVo">
select item_type_id, parent_id, ancestors, type_name, order_num, status, del_flag, create_by, create_time, update_by, update_time from wms_item_type
</sql>
<select id="selectByEntity" parameterType="ItemType" resultMap="ItemTypeResult">
<include refid="selectItemTypeVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<update id="updateDelFlagByIds">
update wms_item_type set del_flag=1
<where>
id in <foreach collection="ids" open="(" item="it" close=")" separator=",">#{it}</foreach>
</where>
</update>
</mapper>