From 00f636a1659301a6a838edb8b929ac7ac332e72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yinjinlu-pc=5C=E5=B0=B9=E9=87=91=E8=B7=AF?= <411641505@qq.com> Date: Mon, 9 Oct 2023 15:03:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmStockTakingController.java | 165 ++++++++ .../WmStockTakingLineController.java | 59 +++ .../WmStockTakingResultController.java | 104 +++++ .../com/ktg/mes/wm/domain/WmPosition.java | 118 ++++++ .../com/ktg/mes/wm/domain/WmStockTaking.java | 237 +++++++++++ .../ktg/mes/wm/domain/WmStockTakingLine.java | 374 ++++++++++++++++++ .../mes/wm/domain/WmStockTakingResult.java | 232 +++++++++++ .../wm/mapper/WmStockTakingLineMapper.java | 63 +++ .../mes/wm/mapper/WmStockTakingMapper.java | 68 ++++ .../wm/mapper/WmStockTakingResultMapper.java | 83 ++++ .../wm/service/IWmStockTakingLineService.java | 63 +++ .../service/IWmStockTakingResultService.java | 79 ++++ .../mes/wm/service/IWmStockTakingService.java | 68 ++++ .../impl/WmStockTakingLineServiceImpl.java | 103 +++++ .../impl/WmStockTakingResultServiceImpl.java | 112 ++++++ .../impl/WmStockTakingServiceImpl.java | 114 ++++++ .../mapper/wm/WmStockTakingLineMapper.xml | 192 +++++++++ .../mapper/wm/WmStockTakingMapper.xml | 142 +++++++ .../mapper/wm/WmStockTakingResultMapper.xml | 206 ++++++++++ 19 files changed, 2582 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml create mode 100644 ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml create mode 100644 ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingController.java new file mode 100644 index 0000000..20c535f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingController.java @@ -0,0 +1,165 @@ +package com.ktg.mes.wm.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStockTaking; +import com.ktg.mes.wm.domain.WmStockTakingLine; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStockTakingLineService; +import com.ktg.mes.wm.service.IWmStockTakingResultService; +import com.ktg.mes.wm.service.IWmStockTakingService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/mes/wm/stocktaking") +public class WmStockTakingController extends BaseController { + + @Autowired + private IWmStockTakingService wmStockTakingService; + + @Autowired + private IWmStockTakingLineService wmStockTakingLineService; + + @Autowired + private IWmStockTakingResultService wmStockTakingResultService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + /** + * 查询库存盘点记录列表 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktaking:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTaking wmStockTaking) + { + startPage(); + List list = wmStockTakingService.selectWmStockTakingList(wmStockTaking); + return getDataTable(list); + } + + /** + * 获取库存盘点记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktaking:query')") + @GetMapping(value = "/{takingId}") + public AjaxResult getInfo(@PathVariable("takingId") Long takingId) + { + return AjaxResult.success(wmStockTakingService.selectWmStockTakingByTakingId(takingId)); + } + + /** + * 新增库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktaking:add')") + @Log(title = "库存盘点记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getTakingCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmStockTakingService.checkUnique(wmStockTaking))){ + return AjaxResult.error("单据编号已存在!"); + } + }else { + wmStockTaking.setTakingCode(autoCodeUtil.genSerialCode(UserConstants.STOCKTAKING_CODE,"")); + } + + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + + wmStockTakingService.insertWmStockTaking(wmStockTaking); + wmStockTaking.setCreateBy(getUsername()); + return AjaxResult.success(wmStockTaking); + } + + /** + * 修改库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktaking:edit')") + @Log(title = "库存盘点记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + return toAjax(wmStockTakingService.updateWmStockTaking(wmStockTaking)); + } + + /** + * 删除库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktaking:remove')") + @Log(title = "库存盘点记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{takingIds}") + public AjaxResult remove(@PathVariable Long[] takingIds) + { + for(Long takingId:takingIds){ + WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(taking.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + wmStockTakingLineService.deleteByTakingId(takingId); + wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId); + } + + return toAjax(wmStockTakingService.deleteWmStockTakingByTakingIds(takingIds)); + } + + /** + * 完成盘点,系统对比计算盘点结果 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "盘点单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{takingId}") + public AjaxResult execute(@PathVariable Long takingId){ + WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId); + + WmStockTakingLine param = new WmStockTakingLine(); + param.setTakingId(takingId); + List lines = wmStockTakingLineService.selectWmStockTakingLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("未检测到盘点的物资!"); + } + + //先删除历史记录 + wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId); + + if(UserConstants.WM_STOCK_TAKING_TYPE_OPEN.equals(taking.getTakingType())){ + //如果是明盘,则直接对比明细中的库存数量和盘点数量 + wmStockTakingResultService.calculateOpenWmStockTakingResult(takingId); + }else { + //如果是盲盘,则对比盘点明细中的盘点数量,和当前库存现有量的数量 + wmStockTakingResultService.calculateWmStockTakingResult(takingId); + } + + taking.setStatus(UserConstants.ORDER_STATUS_APPROVED); + wmStockTakingService.updateWmStockTaking(taking); + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java new file mode 100644 index 0000000..ce07cb8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java @@ -0,0 +1,59 @@ +package com.ktg.mes.wm.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmStockTakingLine; +import com.ktg.mes.wm.service.IWmStockTakingLineService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@RestController +@RequestMapping("/mes/wm/stocktakingline") +public class WmStockTakingLineController extends BaseController { + @Autowired + private IWmStockTakingLineService wmStockTakingLineService; + + /** + * 查询库存盘点明细列表 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingline:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTakingLine wmStockTakingLine) + { + startPage(); + List list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine); + return getDataTable(list); + } + + /** + * 导出库存盘点明细列表 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingline:export')") + @Log(title = "库存盘点明细", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStockTakingLine wmStockTakingLine) + { + List list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine); + ExcelUtil util = new ExcelUtil(WmStockTakingLine.class); + util.exportExcel(response, list, "库存盘点明细数据"); + } + + /** + * 获取库存盘点明细详细信息 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingline:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmStockTakingLineService.selectWmStockTakingLineByLineId(lineId)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java new file mode 100644 index 0000000..41a4c7e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmStockTakingResult; +import com.ktg.mes.wm.service.IWmStockTakingResultService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库存盘点结果Controller + * + * @author yinjinlu + * @date 2023-08-22 + */ +@RestController +@RequestMapping("/wm/stocktakingresult") +public class WmStockTakingResultController extends BaseController +{ + @Autowired + private IWmStockTakingResultService wmStockTakingResultService; + + /** + * 查询库存盘点结果列表 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTakingResult wmStockTakingResult) + { + startPage(); + List list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult); + return getDataTable(list); + } + + /** + * 导出库存盘点结果列表 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:export')") + @Log(title = "库存盘点结果", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStockTakingResult wmStockTakingResult) + { + List list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult); + ExcelUtil util = new ExcelUtil(WmStockTakingResult.class); + util.exportExcel(response, list, "库存盘点结果数据"); + } + + /** + * 获取库存盘点结果详细信息 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:query')") + @GetMapping(value = "/{resultId}") + public AjaxResult getInfo(@PathVariable("resultId") Long resultId) + { + return AjaxResult.success(wmStockTakingResultService.selectWmStockTakingResultByResultId(resultId)); + } + + /** + * 新增库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:add')") + @Log(title = "库存盘点结果", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.insertWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 修改库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:edit')") + @Log(title = "库存盘点结果", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.updateWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 删除库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('wm:stocktakingresult:remove')") + @Log(title = "库存盘点结果", businessType = BusinessType.DELETE) + @DeleteMapping("/{resultIds}") + public AjaxResult remove(@PathVariable Long[] resultIds) + { + return toAjax(wmStockTakingResultService.deleteWmStockTakingResultByResultIds(resultIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java new file mode 100644 index 0000000..4358b5e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java @@ -0,0 +1,118 @@ +package com.ktg.mes.wm.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +public class WmPosition extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 库区ID */ + private Long locationId; + + private String locationCode; + + private String locationName; + + private Long warehouseId; + + private String warehouseCode; + + private String warehouseName; + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + @Override + public String toString() { + return "WmPosition{" + + "areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java new file mode 100644 index 0000000..2b9f652 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java @@ -0,0 +1,237 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点记录对象 wm_stock_taking + * + * @author yinjinlu + * @date 2023-08-17 + */ +public class WmStockTaking extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 盘点单ID */ + private Long takingId; + + /** 盘点单编号 */ + @Excel(name = "盘点单编号") + private String takingCode; + + /** 盘点单名称 */ + @Excel(name = "盘点单名称") + private String takingName; + + /** 盘点日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "盘点日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date takingDate; + + /** 盘点人用户名 */ + @Excel(name = "盘点人用户名") + private String userName; + + /** 盘点人 */ + @Excel(name = "盘点人") + private String nickName; + + /** 盘点类型 */ + @Excel(name = "盘点类型") + private String takingType; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setTakingCode(String takingCode) + { + this.takingCode = takingCode; + } + + public String getTakingCode() + { + return takingCode; + } + public void setTakingName(String takingName) + { + this.takingName = takingName; + } + + public String getTakingName() + { + return takingName; + } + public void setTakingDate(Date takingDate) + { + this.takingDate = takingDate; + } + + public Date getTakingDate() + { + return takingDate; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setTakingType(String takingType) + { + this.takingType = takingType; + } + + public String getTakingType() + { + return takingType; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("takingId", getTakingId()) + .append("takingCode", getTakingCode()) + .append("takingName", getTakingName()) + .append("takingDate", getTakingDate()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("takingType", getTakingType()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java new file mode 100644 index 0000000..c2096af --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java @@ -0,0 +1,374 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点明细对象 wm_stock_taking_line + * + * @author yinjinlu + * @date 2023-08-17 + */ +public class WmStockTakingLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 报废单ID */ + @Excel(name = "报废单ID") + private Long takingId; + + /** 库存ID */ + @Excel(name = "库存ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String unitName; + + /** 数量 */ + @Excel(name = "数量") + private Long quantity; + + /** 盘点数量 */ + @Excel(name = "盘点数量") + private Long takingQuantity; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 盘点状态 */ + @Excel(name = "盘点状态") + private String takingStatus; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setUnitName(String unitName) + { + this.unitName = unitName; + } + + public String getUnitName() + { + return unitName; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setTakingQuantity(Long takingQuantity) + { + this.takingQuantity = takingQuantity; + } + + public Long getTakingQuantity() + { + return takingQuantity; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setTakingStatus(String takingStatus) + { + this.takingStatus = takingStatus; + } + + public String getTakingStatus() + { + return takingStatus; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("takingId", getTakingId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("unitName", getUnitName()) + .append("quantity", getQuantity()) + .append("takingQuantity", getTakingQuantity()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("takingStatus", getTakingStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java new file mode 100644 index 0000000..7ba140b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java @@ -0,0 +1,232 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点结果对象 wm_stock_taking_result + * + * @author yinjinlu + * @date 2023-08-22 + */ +public class WmStockTakingResult extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 结果ID */ + private Long resultId; + + /** 盘点单ID */ + @Excel(name = "盘点单ID") + private Long takingId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String unitName; + + /** 数量 */ + @Excel(name = "数量") + private Long quantity; + + /** 盘点数量 */ + @Excel(name = "盘点数量") + private Long takingQuantity; + + /** 盘点状态 */ + @Excel(name = "盘点状态") + private String takingStatus; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setResultId(Long resultId) { + this.resultId = resultId; + } + public Long getResultId() + { + return resultId; + } + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setUnitName(String unitName) + { + this.unitName = unitName; + } + + public String getUnitName() + { + return unitName; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setTakingQuantity(Long takingQuantity) + { + this.takingQuantity = takingQuantity; + } + + public Long getTakingQuantity() + { + return takingQuantity; + } + public void setTakingStatus(String takingStatus) + { + this.takingStatus = takingStatus; + } + + public String getTakingStatus() + { + return takingStatus; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("resultId", getResultId()) + .append("takingId", getTakingId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("unitName", getUnitName()) + .append("quantity", getQuantity()) + .append("takingQuantity", getTakingQuantity()) + .append("takingStatus", getTakingStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java new file mode 100644 index 0000000..536f9bf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingLine; + +/** + * 库存盘点明细Mapper接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface WmStockTakingLineMapper +{ + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId); + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细集合 + */ + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine); + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 删除库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineId(Long lineId); + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineIds(Long[] lineIds); + + public int deleteByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java new file mode 100644 index 0000000..00950a4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTaking; + +/** + * 库存盘点记录Mapper接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface WmStockTakingMapper +{ + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + public WmStockTaking selectWmStockTakingByTakingId(Long takingId); + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录集合 + */ + public List selectWmStockTakingList(WmStockTaking wmStockTaking); + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + public WmStockTaking checkUnique(WmStockTaking stockTaking); + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int insertWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int updateWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 删除库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + public int deleteWmStockTakingByTakingId(Long takingId); + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingByTakingIds(Long[] takingIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java new file mode 100644 index 0000000..2b66985 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingResult; + +/** + * 库存盘点结果Mapper接口 + * + * @author yinjinlu + * @date 2023-08-22 + */ +public interface WmStockTakingResultMapper +{ + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId); + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果集合 + */ + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult); + + + /** + * 针对明盘的盘点结果计算 + * @param takingId + * @return + */ + public void calculateOpenWmStockTakingResult(Long takingId); + + /** + * 根据当前盘点记录计算盘点结果 + * @param takingId + * @return + */ + public void calculateWmStockTakingResult(Long takingId); + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 删除库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultId(Long resultId); + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultIds(Long[] resultIds); + + /** + * 根据盘点单ID删除所有盘点结果 + * @param takingId + * @return + */ + public int deleteWmStockTakingResultByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java new file mode 100644 index 0000000..6c13826 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingLine; + +/** + * 库存盘点明细Service接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface IWmStockTakingLineService +{ + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId); + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细集合 + */ + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine); + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的库存盘点明细主键集合 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineIds(Long[] lineIds); + + /** + * 删除库存盘点明细信息 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineId(Long lineId); + + public int deleteByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java new file mode 100644 index 0000000..2c48e46 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java @@ -0,0 +1,79 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingResult; + +/** + * 库存盘点结果Service接口 + * + * @author yinjinlu + * @date 2023-08-22 + */ +public interface IWmStockTakingResultService +{ + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId); + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果集合 + */ + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult); + + + /** + * 针对明盘的盘点结果计算 + * @param takingId + * @return + */ + public void calculateOpenWmStockTakingResult(Long takingId); + + + /** + * 根据当前盘点记录计算盘点结果 + * @param takingId + * @return + */ + public void calculateWmStockTakingResult(Long takingId); + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的库存盘点结果主键集合 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultIds(Long[] resultIds); + + /** + * 删除库存盘点结果信息 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultId(Long resultId); + + public int deleteWmStockTakingResultByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java new file mode 100644 index 0000000..170622c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTaking; + +/** + * 库存盘点记录Service接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface IWmStockTakingService +{ + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + public WmStockTaking selectWmStockTakingByTakingId(Long takingId); + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录集合 + */ + public List selectWmStockTakingList(WmStockTaking wmStockTaking); + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + public String checkUnique(WmStockTaking stockTaking); + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int insertWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int updateWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的库存盘点记录主键集合 + * @return 结果 + */ + public int deleteWmStockTakingByTakingIds(Long[] takingIds); + + /** + * 删除库存盘点记录信息 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + public int deleteWmStockTakingByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java new file mode 100644 index 0000000..7cff9e0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java @@ -0,0 +1,103 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingLineMapper; +import com.ktg.mes.wm.domain.WmStockTakingLine; +import com.ktg.mes.wm.service.IWmStockTakingLineService; + +/** + * 库存盘点明细Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-17 + */ +@Service +public class WmStockTakingLineServiceImpl implements IWmStockTakingLineService +{ + @Autowired + private WmStockTakingLineMapper wmStockTakingLineMapper; + + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + @Override + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId) + { + return wmStockTakingLineMapper.selectWmStockTakingLineByLineId(lineId); + } + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细 + */ + @Override + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine) + { + return wmStockTakingLineMapper.selectWmStockTakingLineList(wmStockTakingLine); + } + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + @Override + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine) + { + wmStockTakingLine.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingLineMapper.insertWmStockTakingLine(wmStockTakingLine); + } + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + @Override + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine) + { + wmStockTakingLine.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingLineMapper.updateWmStockTakingLine(wmStockTakingLine); + } + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的库存盘点明细主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingLineByLineIds(Long[] lineIds) + { + return wmStockTakingLineMapper.deleteWmStockTakingLineByLineIds(lineIds); + } + + /** + * 删除库存盘点明细信息 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingLineByLineId(Long lineId) + { + return wmStockTakingLineMapper.deleteWmStockTakingLineByLineId(lineId); + } + + @Override + public int deleteByTakingId(Long takingId) { + return wmStockTakingLineMapper.deleteByTakingId(takingId); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java new file mode 100644 index 0000000..3580792 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java @@ -0,0 +1,112 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingResultMapper; +import com.ktg.mes.wm.domain.WmStockTakingResult; +import com.ktg.mes.wm.service.IWmStockTakingResultService; + +/** + * 库存盘点结果Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-22 + */ +@Service +public class WmStockTakingResultServiceImpl implements IWmStockTakingResultService +{ + @Autowired + private WmStockTakingResultMapper wmStockTakingResultMapper; + + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + @Override + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId) + { + return wmStockTakingResultMapper.selectWmStockTakingResultByResultId(resultId); + } + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果 + */ + @Override + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult) + { + return wmStockTakingResultMapper.selectWmStockTakingResultList(wmStockTakingResult); + } + + @Override + public void calculateOpenWmStockTakingResult(Long takingId) { + wmStockTakingResultMapper.calculateOpenWmStockTakingResult(takingId); + } + + @Override + public void calculateWmStockTakingResult(Long takingId) { + wmStockTakingResultMapper.calculateWmStockTakingResult(takingId); + } + + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + @Override + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult) + { + wmStockTakingResult.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingResultMapper.insertWmStockTakingResult(wmStockTakingResult); + } + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + @Override + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult) + { + wmStockTakingResult.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingResultMapper.updateWmStockTakingResult(wmStockTakingResult); + } + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的库存盘点结果主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingResultByResultIds(Long[] resultIds) + { + return wmStockTakingResultMapper.deleteWmStockTakingResultByResultIds(resultIds); + } + + /** + * 删除库存盘点结果信息 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingResultByResultId(Long resultId) + { + return wmStockTakingResultMapper.deleteWmStockTakingResultByResultId(resultId); + } + + @Override + public int deleteWmStockTakingResultByTakingId(Long takingId) { + return wmStockTakingResultMapper.deleteWmStockTakingResultByTakingId(takingId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java new file mode 100644 index 0000000..34a2420 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingMapper; +import com.ktg.mes.wm.domain.WmStockTaking; +import com.ktg.mes.wm.service.IWmStockTakingService; + +/** + * 库存盘点记录Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-17 + */ +@Service +public class WmStockTakingServiceImpl implements IWmStockTakingService +{ + @Autowired + private WmStockTakingMapper wmStockTakingMapper; + + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + @Override + public WmStockTaking selectWmStockTakingByTakingId(Long takingId) + { + return wmStockTakingMapper.selectWmStockTakingByTakingId(takingId); + } + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录 + */ + @Override + public List selectWmStockTakingList(WmStockTaking wmStockTaking) + { + return wmStockTakingMapper.selectWmStockTakingList(wmStockTaking); + } + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + @Override + public String checkUnique(WmStockTaking stockTaking){ + WmStockTaking taking = wmStockTakingMapper.checkUnique(stockTaking); + Long takingId = stockTaking.getTakingId() == null ? -1L: stockTaking.getTakingId(); + if(StringUtils.isNotNull(taking) && taking.getTakingId().longValue() != takingId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + @Override + public int insertWmStockTaking(WmStockTaking wmStockTaking) + { + wmStockTaking.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingMapper.insertWmStockTaking(wmStockTaking); + } + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + @Override + public int updateWmStockTaking(WmStockTaking wmStockTaking) + { + wmStockTaking.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingMapper.updateWmStockTaking(wmStockTaking); + } + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的库存盘点记录主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingByTakingIds(Long[] takingIds) + { + return wmStockTakingMapper.deleteWmStockTakingByTakingIds(takingIds); + } + + /** + * 删除库存盘点记录信息 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingByTakingId(Long takingId) + { + return wmStockTakingMapper.deleteWmStockTakingByTakingId(takingId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml new file mode 100644 index 0000000..ddb689c --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, taking_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, unit_name, quantity, taking_quantity, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, taking_status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking_line + + + + + + + + insert into wm_stock_taking_line + + taking_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + unit_name, + quantity, + taking_quantity, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + taking_status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{unitName}, + #{quantity}, + #{takingQuantity}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{takingStatus}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking_line + + taking_id = #{takingId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + unit_name = #{unitName}, + quantity = #{quantity}, + taking_quantity = #{takingQuantity}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + taking_status = #{takingStatus}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_stock_taking_line where line_id = #{lineId} + + + + delete from wm_stock_taking_line where line_id in + + #{lineId} + + + + + delete from wm_stock_taking_line where taking_id = #{takingId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml new file mode 100644 index 0000000..b2ddf40 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select taking_id, taking_code, taking_name, taking_date, user_name, nick_name, taking_type, warehouse_id, warehouse_code, warehouse_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking + + + + + + + + + + insert into wm_stock_taking + + taking_code, + taking_name, + taking_date, + user_name, + nick_name, + taking_type, + warehouse_id, + warehouse_code, + warehouse_name, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingCode}, + #{takingName}, + #{takingDate}, + #{userName}, + #{nickName}, + #{takingType}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking + + taking_code = #{takingCode}, + taking_name = #{takingName}, + taking_date = #{takingDate}, + user_name = #{userName}, + nick_name = #{nickName}, + taking_type = #{takingType}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where taking_id = #{takingId} + + + + delete from wm_stock_taking where taking_id = #{takingId} + + + + delete from wm_stock_taking where taking_id in + + #{takingId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml new file mode 100644 index 0000000..d0280ed --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select result_id, taking_id, item_id, item_code, item_name, specification, unit_of_measure, unit_name, quantity, taking_quantity, taking_status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking_result + + + + + + + + insert into wm_stock_taking_result (taking_id,item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status) + select sl.taking_id,sl.item_id,sl.item_code,sl.item_name,sl.specification,taking_quantity,quantity, + case when IFNULL(taking_quantity,0) > IFNULL(quantity,0) then 'PROFIT' + when IFNULL(taking_quantity,0) < IFNULL(quantity,0) then 'LOSS' + else 'NORMAL' end as taking_status + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + + + + insert into wm_stock_taking_result (item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status) + select IFNULL(m.item_id,t.item_id) as item_id, IFNULL(m.item_code,t.item_code) as item_code,IFNULL(m.item_name,t.item_name) as item_name,IFNULL(m.specification,t.specification) as specification, + IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity, + case when IFNULL(t.taking_quantity,0) > IFNULL(m.onhand,0) then 'PROFIT' + when IFNULL(t.taking_quantity,0) < IFNULL(m.onhand,0) then 'LOSS' + else 'NORMAL' end as taking_status + from ( + select sl.item_id,sl.item_code,sl.item_name,sl.specification,sum(sl.taking_quantity) as taking_quantity + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + group by sl.item_id,sl.item_code,sl.item_name,sl.specification + ) t + left join ( + select ms.item_id,ms.item_code,ms.item_name,ms.specification,sum(ms.quantity_onhand) as onhand + from wm_material_stock ms + where (ms.warehouse_id,ms.location_id,ms.area_id) in ( + select warehouse_id,location_id,area_id + from wm_stock_taking + where taking_id = #{takingId} + ) + group by ms.item_id,ms.item_code,ms.item_name,ms.specification + ) m + on t.item_id = m.item_id + and t.item_code = m.item_code + where t.taking_quantity !=0 + + union + + select IFNULL(t.item_id,m.item_id) as item_id,IFNULL(t.item_code,m.item_code) as item_code,IFNULL(t.item_name,m.item_name) as item_name,IFNULL(t.specification,m.specification) as specification, + IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity, + case when IFNULL(t.taking_quantity,0) > IFNULL(m.onhand,0) then 'PROFIT' + when IFNULL(t.taking_quantity,0) < IFNULL(m.onhand,0) then 'LOSS' + else 'NORMAL' end as taking_status + from ( + select ms.item_id,ms.item_code,ms.item_name,ms.specification,sum(ms.quantity_onhand) as onhand + from wm_material_stock ms + where (ms.warehouse_id,ms.location_id,ms.area_id) in ( + select warehouse_id,location_id,area_id + from wm_stock_taking + where taking_id = #{takingId} + ) + group by ms.item_id,ms.item_code,ms.item_name,ms.specification + ) m + left join ( + select sl.item_id,sl.item_code,sl.item_name,sl.specification,sum(sl.taking_quantity) as taking_quantity + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + group by sl.item_id,sl.item_code,sl.item_name,sl.specification + ) t + on t.item_id = m.item_id + and t.item_code = m.item_code + where m.onhand !=0 + + + + insert into wm_stock_taking_result + + taking_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + unit_name, + quantity, + taking_quantity, + taking_status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{unitName}, + #{quantity}, + #{takingQuantity}, + #{takingStatus}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking_result + + taking_id = #{takingId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + unit_name = #{unitName}, + quantity = #{quantity}, + taking_quantity = #{takingQuantity}, + taking_status = #{takingStatus}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where result_id = #{resultId} + + + + delete from wm_stock_taking_result where result_id = #{resultId} + + + + delete from wm_stock_taking_result where result_id in + + #{resultId} + + + + + delete from wm_stock_taking_result where taking_id = #{takingId} + + \ No newline at end of file