From 54bae26845383fac91d84f7ca0d7dd9b574438cc Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 7 Jun 2024 16:57:34 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9EmaterialSelect.html=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AFWareho?= =?UTF-8?q?useMaterialVO=20=E5=AE=9E=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WarehouseInventoryCheckController.java | 33 ++- .../domain/VO/WarehouseMaterialVO.java | 30 +++ .../domain/WarehouseInventoryCheck.java | 14 ++ .../IWarehouseInventoryCheckService.java | 7 + .../WarehouseInventoryCheckServiceImpl.java | 62 +++++- .../warehouse/inventoryCheck/add.html | 189 +++++++++++++++++- .../inventoryCheck/inventoryCheck.html | 18 -- .../inventoryCheck/materialSelect.html | 53 +++++ 8 files changed, 373 insertions(+), 33 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseMaterialVO.java create mode 100644 ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/materialSelect.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java index 684f538a..2e182fa2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java @@ -1,15 +1,13 @@ package com.ruoyi.warehouse.controller; import java.util.List; + +import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.warehouse.domain.WarehouseInventoryCheck; @@ -84,7 +82,7 @@ public class WarehouseInventoryCheckController extends BaseController @Log(title = "仓库库存盘点", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(WarehouseInventoryCheck warehouseInventoryCheck) + public AjaxResult addSave(@RequestBody WarehouseInventoryCheck warehouseInventoryCheck) { return toAjax(warehouseInventoryCheckService.insertWarehouseInventoryCheck(warehouseInventoryCheck)); } @@ -113,4 +111,27 @@ public class WarehouseInventoryCheckController extends BaseController } + + /** + * 物料信息弹出页面 + */ + @GetMapping("/materialSelect") + public String materialSelect() + { + return prefix + "/materialSelect"; + } + + + /** + * 查找与库存查询有关的物料信息 + * */ + @ResponseBody + @PostMapping("/getAllMaterialInfo") + public TableDataInfo getAllMaterialInfo(){ + startPage(); + List list = warehouseInventoryCheckService.selectAllMaterialInfo(); + return getDataTable(list); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseMaterialVO.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseMaterialVO.java new file mode 100644 index 00000000..92d12b9b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseMaterialVO.java @@ -0,0 +1,30 @@ +package com.ruoyi.warehouse.domain.VO; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + +@Data +public class WarehouseMaterialVO extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 料号 */ + @Excel(name = "料号") + private String materialNo; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料单位 */ + @Excel(name = "物料单位") + private String materialUnit; + + /** 物料描述 */ + @Excel(name = "物料描述") + private String materialDescribe; + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java index 922fe115..978e5f6d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java @@ -1,6 +1,8 @@ package com.ruoyi.warehouse.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -57,6 +59,8 @@ public class WarehouseInventoryCheck extends BaseEntity @Excel(name = "数量合计") private Integer numTotal; + private List inventoryCheckDetails; + public void setInventoryCheckId(Long inventoryCheckId) { this.inventoryCheckId = inventoryCheckId; @@ -148,6 +152,15 @@ public class WarehouseInventoryCheck extends BaseEntity return numTotal; } + + public List getInventoryCheckDetails() { + return inventoryCheckDetails; + } + + public void setInventoryCheckDetails(List inventoryCheckDetails) { + this.inventoryCheckDetails = inventoryCheckDetails; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -166,6 +179,7 @@ public class WarehouseInventoryCheck extends BaseEntity .append("createBy", getCreateBy()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("inventoryCheckDetails",getInventoryCheckDetails()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java index 178ce8fa..577b2497 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java @@ -2,6 +2,7 @@ package com.ruoyi.warehouse.service; import java.util.List; import com.ruoyi.warehouse.domain.WarehouseInventoryCheck; +import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO; /** * 仓库库存盘点Service接口 @@ -43,4 +44,10 @@ public interface IWarehouseInventoryCheckService */ public int updateWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck); + + /** + * 查找与库存查询有关的物料信息 + * */ + public List selectAllMaterialInfo(); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java index 642fea59..13214bc9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java @@ -2,6 +2,8 @@ package com.ruoyi.warehouse.service.impl; import java.text.DecimalFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -9,12 +11,18 @@ import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.erp.domain.ErpMaterialVo; +import com.ruoyi.erp.mapper.ErpMaterialMapper; +import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO; +import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail; +import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckDetailMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckMapper; import com.ruoyi.warehouse.domain.WarehouseInventoryCheck; import com.ruoyi.warehouse.service.IWarehouseInventoryCheckService; -import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 仓库库存盘点Service业务层处理 @@ -22,12 +30,19 @@ import com.ruoyi.common.core.text.Convert; * @author 刘晓旭 * @date 2024-06-07 */ +@Slf4j @Service public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCheckService { @Autowired private WarehouseInventoryCheckMapper warehouseInventoryCheckMapper; + @Autowired + private ErpMaterialMapper erpMaterialMapper; + + @Autowired + private WarehouseInventoryCheckDetailMapper inventoryCheckDetailMapper; + /** * 查询仓库库存盘点 * @@ -58,20 +73,42 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh * @param warehouseInventoryCheck 仓库库存盘点 * @return 结果 */ + @Transactional @Override public int insertWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck) { + String loginName = ShiroUtils.getLoginName(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String prefix = "KCPD" + simpleDateFormat.format(new Date()).replace("-", ""); String maxCode = warehouseInventoryCheckMapper.findMaxRoundCode(prefix); String newCode = generateCode(prefix,maxCode); - warehouseInventoryCheck.setInventoryCheckCode(newCode); warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate()); - String loginName = ShiroUtils.getLoginName(); warehouseInventoryCheck.setCreateBy(loginName); + List inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails(); + + if (StringUtils.isEmpty(inventoryCheckDetails)){ + log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails); + } + + for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) { + WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail(); + inventoryCheckDetail.setInventoryCheckCode(newCode); + inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo()); + inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName()); + inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe()); + inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit()); + inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum()); + inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum()); + inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark()); + inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress()); + inventoryCheckDetail.setCreateBy(loginName); + inventoryCheckDetail.setCreateTime(new Date()); + inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail); + } + return warehouseInventoryCheckMapper.insertWarehouseInventoryCheck(warehouseInventoryCheck); } @@ -90,6 +127,25 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck); } + /** + * 查找与库存查询有关的物料信息 + * */ + @Override + public List selectAllMaterialInfo() { + + List warehouseMaterialVOs = new ArrayList<>(); + List erpMaterialVos = erpMaterialMapper.selectAllErpMaterialList(); + for (ErpMaterialVo erpMaterialVo : erpMaterialVos) { + WarehouseMaterialVO warehouseMaterialVO = new WarehouseMaterialVO(); + warehouseMaterialVO.setMaterialNo(erpMaterialVo.getMaterialNo()); + warehouseMaterialVO.setMaterialName(erpMaterialVo.getMaterialName()); + warehouseMaterialVO.setMaterialDescribe(erpMaterialVo.getDescribe()); + warehouseMaterialVO.setMaterialUnit(erpMaterialVo.getUnit()); + warehouseMaterialVOs.add(warehouseMaterialVO); + } + return warehouseMaterialVOs; + } + /** *库存盘点单号生成规则 diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html b/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html index bdde0e9f..0cbad494 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html @@ -41,26 +41,203 @@ + + +
+
+
+ 选择物料 + + 选择物料 + +
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html b/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html index 505b0630..81a5be0e 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html @@ -49,12 +49,6 @@ 添加 - - 修改 - - - 删除 - 导出 @@ -67,9 +61,6 @@ + + \ No newline at end of file