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); } 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); } } 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); 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("å ¥åºæåï¼"); } /** 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") 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; } } 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; } 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, //䏿 ; } src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java
@@ -3,5 +3,6 @@ public enum MaterialInventoryCategoryEnum { INBOUND, //å ¥åº UNLOADING, //䏿 TRANSFER, //è°æ¨ ; } 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, //å é¨è°æ¨ ; } 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); } 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; } 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); } } 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; } //æ´æ°åºåç¶æ 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++;