From 91bf52413fded1d71f3c6d0e359d3c5c2bbd8900 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期六, 06 九月 2025 17:49:31 +0800 Subject: [PATCH] art: 热处理外协入库、小内圈外协入库、物料调拨 --- src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java | 19 +++- src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java | 5 + src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java | 1 src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java | 71 ++++++++++++++++- src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java | 8 ++ src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java | 6 src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java | 7 + src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java | 9 ++ src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java | 23 ++++- src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java | 1 src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java | 4 + src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java | 16 --- src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java | 39 +++++++-- src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java | 10 ++ src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java | 3 15 files changed, 177 insertions(+), 45 deletions(-) diff --git a/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java b/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java index 424f699..72c38c5 100644 --- a/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java +++ b/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java @@ -26,4 +26,11 @@ * @return */ List<LineSideWarehouse> queryByProductionType(String productionType); + + /** + * 绾胯竟搴撶紪鐮� + * @param warehouseCode + * @return + */ + LineSideWarehouse queryByWarehouseCode(String warehouseCode); } diff --git a/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java b/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java index 05dbe9e..91ba088 100644 --- a/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java +++ b/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.base.entity.LineSideWarehouse; import org.jeecg.modules.base.mapper.LineSideWarehouseMapper; import org.jeecg.modules.base.service.ILineSideWarehouseService; @@ -39,4 +40,13 @@ String[] types = productionType.split(","); return this.getBaseMapper().queryByProductionType(types); } + + @Override + public LineSideWarehouse queryByWarehouseCode(String warehouseCode) { + LambdaQueryWrapper<LineSideWarehouse> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LineSideWarehouse::getWarehouseCode, warehouseCode); + wrapper.eq(LineSideWarehouse::getDelFlag, CommonConstant.DEL_FLAG_0); + wrapper.eq(LineSideWarehouse::getWarehouseStatus, CommonConstant.STATUS_1); + return this.getBaseMapper().selectOne(wrapper); + } } diff --git a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java index 5eac9ed..00d0f04 100644 --- a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java +++ b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java @@ -8,6 +8,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.constant.CommonConstant; @@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -167,8 +170,12 @@ @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-鏍规嵁鐗╂枡绫诲瀷鏌ヨ", notes = "绾胯竟搴撶墿鏂欎俊鎭�-鏍规嵁鐗╂枡绫诲瀷鏌ヨ") @GetMapping(value = "/queryByMaterialCategory") public Result<List<LswMaterial>> queryByMaterialCategory(@RequestParam("materialCategory") String materialCategory) { + if (StringUtils.isBlank(materialCategory)) { + return Result.ok(Collections.emptyList()); + } + String[] split = materialCategory.split(","); LambdaQueryWrapper<LswMaterial> queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(LswMaterial::getMaterialCategory, materialCategory); + queryWrapper.in(LswMaterial::getMaterialCategory, Arrays.asList(split)); queryWrapper.eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0); queryWrapper.eq(LswMaterial::getMaterialStatus, CommonConstant.STATUS_1); queryWrapper.orderByAsc(LswMaterial::getMaterialNumber); diff --git a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java index 109e761..26cf4b4 100644 --- a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java +++ b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java @@ -6,11 +6,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.modules.lsw.entity.LswMaterial; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.lsw.entity.LswMaterialInbound; import org.jeecg.modules.lsw.service.ILswMaterialInboundService; import org.springframework.beans.factory.annotation.Autowired; @@ -66,11 +67,21 @@ */ @AutoLog(value = "鐗╂枡鍏ュ簱鍗�-娣诲姞") @ApiOperation(value="鐗╂枡鍏ュ簱鍗�-娣诲姞", notes="鐗╂枡鍏ュ簱鍗�-娣诲姞") - //@RequiresPermissions("org.jeecg.modules:lsw_material_inbound:add") @PostMapping(value = "/add") public Result<String> add(@RequestBody LswMaterialInbound lswMaterialInbound) { - lswMaterialInboundService.save(lswMaterialInbound); - return Result.OK("娣诲姞鎴愬姛锛�"); + if(lswMaterialInbound == null){ + return Result.error("鍏ュ簱淇℃伅涓嶈兘涓虹┖锛�"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(sysUser == null){ + return Result.error("鐢ㄦ埛淇℃伅鑾峰彇澶辫触锛�"); + } + lswMaterialInbound.setReceiver(sysUser.getUsername()); + boolean b = lswMaterialInboundService.inboundMaterial(lswMaterialInbound); + if(!b) { + return Result.error("鍏ュ簱澶辫触锛�"); + } + return Result.OK("鍏ュ簱鎴愬姛锛�"); } /** diff --git a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java index fa2e9ae..57edc9a 100644 --- a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java +++ b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java @@ -97,6 +97,7 @@ /**鎺ユ敹浜�*/ @Excel(name = "鎺ユ敹浜�", width = 15) @ApiModelProperty(value = "鎺ユ敹浜�") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String receiver; /**鎺ユ敹鏃堕棿*/ @Excel(name = "鎺ユ敹鏃堕棿", width = 20, format = "yyyy-MM-dd HH:mm:ss") diff --git a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java index 2e7e017..1dac62c 100644 --- a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java +++ b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java @@ -1,7 +1,6 @@ package org.jeecg.modules.lsw.entity; 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.fasterxml.jackson.annotation.JsonFormat; @@ -9,12 +8,10 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.jeecg.common.aspect.annotation.Dict; -import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; -import javax.persistence.Table; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -43,14 +40,6 @@ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "鍒涘缓鏃ユ湡") private Date createTime; - /**鏇存柊浜�*/ - @ApiModelProperty(value = "鏇存柊浜�") - private String updateBy; - /**鏇存柊鏃ユ湡*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "鏇存柊鏃ユ湡") - private Date updateTime; /**鐗╂枡ID*/ @ApiModelProperty(value = "鐗╂枡ID") private String materialId; @@ -80,16 +69,17 @@ /**鐑鐞嗘爣璇�*/ @Excel(name = "鐑鐞嗘爣璇�", width = 15) @ApiModelProperty(value = "鐑鐞嗘爣璇�") - private String heatTreatmentFlag = CommonConstant.STATUS_0; + private String heatTreatmentFlag; public LswMaterialInventory(){} - public LswMaterialInventory(LswMaterialInbound inbound, String materialId, String inventoryCategory) { + public LswMaterialInventory(LswMaterialInbound inbound, String materialId, String inventoryCategory, String heatTreatmentFlag) { this.warehouseId = inbound.getWarehouseId(); this.quantity = inbound.getQuantity(); this.batchNumber = inbound.getBatchNumber(); this.inventoryStatus = MaterialInventoryStatusEnum.NORMAL.name(); this.inventoryCategory = inventoryCategory; this.materialId = materialId; + this.heatTreatmentFlag = heatTreatmentFlag; } } diff --git a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java index 9130b9c..d0cb8f2 100644 --- a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java +++ b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java @@ -96,4 +96,9 @@ @Excel(name = "鍑哄簱鏁伴噺", width = 15) @ApiModelProperty(value = "鍑哄簱鏁伴噺") private BigDecimal quantity; + /**鍑哄簱绫诲瀷*/ + @Excel(name = "鍑哄簱绫诲瀷", width = 15) + @ApiModelProperty(value = "鍑哄簱绫诲瀷") + @Dict(dicCode = "material_outbound_category") + private String outboundCategory; } diff --git a/src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java b/src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java index 1433420..80c1bba 100644 --- a/src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java +++ b/src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java @@ -5,6 +5,7 @@ PRODUCTION_INBOUND,//鐢熶骇涓嬬嚎 HEAT_TREATMENT_INBOUND,//鐑鐞� SMALL_INNER_RING,//灏忓唴鍦� - MATERIAL_INNER_TRANSFER //鍐呴儴璋冩嫧 + MATERIAL_INNER_TRANSFER, //鍐呴儴璋冩嫧 + PRODUCTION_UNLOADING, //涓嬫枡 ; } diff --git a/src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java b/src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java index 8e59d15..b012957 100644 --- a/src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java +++ b/src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java @@ -3,5 +3,6 @@ public enum MaterialInventoryCategoryEnum { INBOUND, //鍏ュ簱 UNLOADING, //涓嬫枡 + TRANSFER, //璋冩嫧 ; } diff --git a/src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java b/src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java new file mode 100644 index 0000000..344a9b3 --- /dev/null +++ b/src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.lsw.enums; + +public enum MaterialOutboundCategory { + MATERIAL_LOADING, //涓婃枡 + WAREHOUSE_TRANSFER, //绉诲簱 + MATERIAL_INNER_TRANSFER, //鍐呴儴璋冩嫧 + ; +} diff --git a/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java b/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java index 0dd1bf4..26c436b 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java +++ b/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java @@ -10,17 +10,26 @@ /** * @Description: 鐗╂枡搴撳瓨淇℃伅 * @Author: jeecg-boot - * @Date: 2025-06-30 + * @Date: 2025-06-30 * @Version: V1.0 */ public interface ILswMaterialInventoryService extends IService<LswMaterialInventory> { - /** 閫氳繃鐗╂枡缂栫爜鍜岀嚎杈瑰簱id鏌ヨ鐗╂枡搴撳瓨 */ + /** 閫氳繃鐗╂枡缂栫爜鍜岀嚎杈瑰簱id鏌ヨ鐗╂枡搴撳瓨 */ List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId); - /** - * 搴撳瓨缁熻 - * @param materialId 鐗╂枡ID - * @return - */ + /** + * 搴撳瓨缁熻 + * @param materialId 鐗╂枡ID + * @return + */ List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId); + + /** + * 鏌ヨ鏈嚭搴撲俊鎭� + * @param materialNumber + * @param batchNumber + * @param warehouseId + * @return + */ + LswMaterialInventory queryByMaterialNumberAndBatchNumber(String materialNumber, String batchNumber, String warehouseId); } diff --git a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java index 3c2899e..6f444f9 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java +++ b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java @@ -5,12 +5,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.modules.base.entity.LineSideWarehouse; +import org.jeecg.modules.base.service.ILineSideWarehouseService; import org.jeecg.modules.lsw.entity.LswMaterial; import org.jeecg.modules.lsw.entity.LswMaterialInbound; import org.jeecg.modules.lsw.entity.LswMaterialInventory; +import org.jeecg.modules.lsw.entity.LswMaterialOutbound; +import org.jeecg.modules.lsw.enums.MaterialInboundCategory; +import org.jeecg.modules.lsw.enums.MaterialInventoryCategoryEnum; +import org.jeecg.modules.lsw.enums.MaterialOutboundCategory; import org.jeecg.modules.lsw.mapper.LswMaterialInboundMapper; import org.jeecg.modules.lsw.service.ILswMaterialInboundService; import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; +import org.jeecg.modules.lsw.service.ILswMaterialOutboundService; import org.jeecg.modules.lsw.service.ILswMaterialService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,6 +41,10 @@ private ILswMaterialInventoryService inventoryService; @Autowired private ILswMaterialService materialService; + @Autowired + private ILineSideWarehouseService lineSideWarehouseService; + @Autowired + private ILswMaterialOutboundService materialOutboundService; @Override public IPage<Map<String, Object>> getlswMaterialInboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req) { @@ -60,20 +72,67 @@ || StringUtils.isBlank(materialInbound.getFactoryId()) || StringUtils.isBlank(materialInbound.getWarehouseId()) || materialInbound.getQuantity() == null - || materialInbound.getQuantity().intValue() > 0 - || StringUtils.isBlank(materialInbound.getBatchNumber())) { - return false; + || materialInbound.getQuantity().intValue() < 1 + || StringUtils.isBlank(materialInbound.getBatchNumber()) + || StringUtils.isBlank(materialInbound.getOriginalCode()) + || StringUtils.isBlank(materialInbound.getOriginalName()) + || StringUtils.isBlank(materialInbound.getInboundCategory())) { + throw new JeecgBootException("鍙傛暟閿欒锛�"); } LswMaterial material = materialService.queryByMaterialNumber(materialInbound.getMaterialNumber()); - if(material == null) { - return false; + if (material == null) { + throw new JeecgBootException("鐗╂枡缂栧彿涓嶅瓨鍦紒"); + } + LineSideWarehouse warehouse = lineSideWarehouseService.getById(materialInbound.getWarehouseId()); + if (warehouse == null) { + throw new JeecgBootException("绾胯竟搴撲笉瀛樺湪锛�"); + } + String heatTreatmentFlag = CommonConstant.STATUS_0; + if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.HEAT_TREATMENT_INBOUND.name())) { + heatTreatmentFlag = CommonConstant.STATUS_1; + } + //搴撳瓨绫诲瀷 + String inventoryCategory = MaterialInventoryCategoryEnum.INBOUND.name(); + if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.MATERIAL_INNER_TRANSFER.name())) { + inventoryCategory = MaterialInventoryCategoryEnum.TRANSFER.name(); + //鏌ヨ鏉ユ簮绾胯竟搴� + LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.queryByWarehouseCode(materialInbound.getOriginalCode()); + if (lineSideWarehouse == null) { + throw new JeecgBootException("鏈壘鍒版潵婧愮嚎杈瑰簱锛�"); + } + //璋冩嫧 鍑哄簱鍘熷搴撳瓨 + LswMaterialInventory originalInventory = inventoryService.queryByMaterialNumberAndBatchNumber(materialInbound.getMaterialNumber(), materialInbound.getBatchNumber(), lineSideWarehouse.getId()); + if (originalInventory == null) { + throw new JeecgBootException("鏈壘鍒版潵婧愮嚎杈瑰簱搴撳瓨锛�"); + } + if (materialInbound.getQuantity().compareTo(originalInventory.getQuantity()) != 0) { + throw new JeecgBootException("璋冩嫧鏁伴噺闇�瑕佺瓑浜庢潵婧愬簱瀛樻暟閲忥紒"); + } + //鍑哄簱淇℃伅 + LswMaterialOutbound outbound = new LswMaterialOutbound(); + outbound.setWarehouseId(lineSideWarehouse.getId()); + outbound.setFactoryId(lineSideWarehouse.getFactoryId()); + outbound.setOutboundStaff(materialInbound.getReceiver()); + outbound.setMaterialName(materialInbound.getMaterialName()); + outbound.setMaterialNumber(materialInbound.getMaterialNumber()); + outbound.setQuantity(originalInventory.getQuantity()); + outbound.setBatchNumber(originalInventory.getBatchNumber()); + outbound.setInventoryId(originalInventory.getId()); + outbound.setOutboundCategory(MaterialOutboundCategory.MATERIAL_INNER_TRANSFER.name()); + //璋冩嫧鍑哄簱 + boolean b = materialOutboundService.outboundMaterial(outbound); + if (!b) { + throw new JeecgBootException("璋冩嫧鍑哄簱澶辫触锛�"); + } + } else if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.PRODUCTION_UNLOADING.name())) { + inventoryCategory = MaterialInventoryCategoryEnum.UNLOADING.name(); } //淇濆瓨鍏ュ簱淇℃伅 materialInbound.setDelFlag(CommonConstant.DEL_FLAG_0); materialInbound.setReceiveTime(new Date()); super.save(materialInbound); //淇濆瓨搴撳瓨淇℃伅 - LswMaterialInventory lswMaterialInventory = new LswMaterialInventory(materialInbound, material.getId(), material.getMaterialCategory()); + LswMaterialInventory lswMaterialInventory = new LswMaterialInventory(materialInbound, material.getId(), inventoryCategory, heatTreatmentFlag); inventoryService.save(lswMaterialInventory); return true; } diff --git a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java index 127cfb7..11de910 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java +++ b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java @@ -1,36 +1,55 @@ package org.jeecg.modules.lsw.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.lsw.entity.LswMaterial; import org.jeecg.modules.lsw.entity.LswMaterialInventory; +import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum; import org.jeecg.modules.lsw.mapper.LswMaterialInventoryMapper; import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; +import org.jeecg.modules.lsw.service.ILswMaterialService; import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo; import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Collections; import java.util.List; /** * @Description: 鐗╂枡搴撳瓨淇℃伅 * @Author: jeecg-boot - * @Date: 2025-06-30 + * @Date: 2025-06-30 * @Version: V1.0 */ @Service public class LswMaterialInventoryServiceImpl extends ServiceImpl<LswMaterialInventoryMapper, LswMaterialInventory> implements ILswMaterialInventoryService { - - @Autowired - private LswMaterialInventoryMapper lswMaterialInventoryMapper; + + @Autowired + private LswMaterialInventoryMapper lswMaterialInventoryMapper; + @Autowired + private ILswMaterialService materialService; @Override public List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId) { - return lswMaterialInventoryMapper.selectLineSideMaterialInventoryByMaterialNumber(bomMaterialNumberList, factoryId); + return lswMaterialInventoryMapper.selectLineSideMaterialInventoryByMaterialNumber(bomMaterialNumberList, factoryId); } - @Override - public List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId) { - return lswMaterialInventoryMapper.statisticsInventory(materialId); - } + @Override + public List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId) { + return lswMaterialInventoryMapper.statisticsInventory(materialId); + } + + @Override + public LswMaterialInventory queryByMaterialNumberAndBatchNumber(String materialNumber, String batchNumber, String warehouseId) { + LswMaterial material = materialService.queryByMaterialNumber(materialNumber); + if (material == null) { + return null; + } + LambdaQueryWrapper<LswMaterialInventory> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(LswMaterialInventory::getWarehouseId, warehouseId); + queryWrapper.eq(LswMaterialInventory::getMaterialId, material.getId()); + queryWrapper.eq(LswMaterialInventory::getBatchNumber, batchNumber); + queryWrapper.eq(LswMaterialInventory::getInventoryStatus, MaterialInventoryStatusEnum.NORMAL.name()); + return lswMaterialInventoryMapper.selectOne(queryWrapper); + } } diff --git a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java index bf8c3db..362e04f 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java +++ b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java @@ -62,13 +62,13 @@ || StringUtils.isBlank(outbound.getFactoryId()) || StringUtils.isBlank(outbound.getWarehouseId()) || outbound.getQuantity() == null - || outbound.getQuantity().intValue() > 0 + || outbound.getQuantity().intValue() < 1 || StringUtils.isBlank(outbound.getBatchNumber()) - || StringUtils.isBlank(outbound.getInventoryId())) { + || StringUtils.isBlank(outbound.getInventoryId())) { return false; } LswMaterialInventory inventory = materialInventoryService.getById(outbound.getInventoryId()); - if(inventory == null) { + if (inventory == null) { return false; } //鏇存柊搴撳瓨鐘舵�� diff --git a/src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java b/src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java index d80623a..8ccba0d 100644 --- a/src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java +++ b/src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java @@ -11,6 +11,7 @@ import org.jeecg.modules.lsw.entity.LswMaterialInbound; import org.jeecg.modules.lsw.entity.LswMaterialInventory; import org.jeecg.modules.lsw.entity.LswMaterialOutbound; +import org.jeecg.modules.lsw.enums.MaterialInboundCategory; import org.jeecg.modules.lsw.service.ILswMaterialInboundService; import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; import org.jeecg.modules.lsw.service.ILswMaterialOutboundService; @@ -98,6 +99,8 @@ //娣诲姞鍏ュ簱淇℃伅 LswMaterialInbound inbound = new LswMaterialInbound(); + inbound.setOriginalCode(transferRequest.getOriginalWarehouseId()); + inbound.setOriginalName("WMS"); inbound.setWarehouseId(transferRequest.getTargetWarehouseId()); inbound.setReceiver("WMS"); inbound.setMaterialNumber(transferRequest.getMaterialNumber()); @@ -105,6 +108,7 @@ inbound.setBatchNumber(item.getTrackLot()); inbound.setQuantity(item.getQuantity()); inbound.setFactoryId(warehouse.getFactoryId()); + inbound.setInboundCategory(MaterialInboundCategory.MATERIAL_TRANSFER_REQUEST.name()); boolean b = materialInboundService.inboundMaterial(inbound); if (!b) { errorCount++; -- Gitblit v1.9.3