diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ImsIntoInventoryController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ImsIntoInventoryController.java index a172083..8216c08 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ImsIntoInventoryController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ImsIntoInventoryController.java @@ -65,9 +65,6 @@ public class ImsIntoInventoryController extends BaseController @PostMapping("/warehouse/materials") public TableDataInfo selectDetailListByWarehouseIdAndMaterialId(@RequestBody ImsIntoInventoryQuery imsIntoInventoryQuery) { - if(Objects.isNull(imsIntoInventoryQuery.getMaterialId()) || Objects.isNull(imsIntoInventoryQuery.getWarehouseId())) { - throw new ServiceException("参数错误"); - } startPage(); List list = imsIntoInventoryService. selectDetailListByWarehouseIdAndMaterialId(imsIntoInventoryQuery); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsIntoInventory.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsIntoInventory.java index 1a82778..2ae014d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsIntoInventory.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsIntoInventory.java @@ -117,6 +117,24 @@ public class ImsIntoInventory extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endDateTime; + @ApiModelProperty(value = "供应商id") + private Long supplierId; + + @ApiModelProperty(value = "材料名称") + @Excel(name = "材料名称") + private String materialName; + + @ApiModelProperty(value = "货品编码") + @Excel(name = "货品编码") + private String materialCode; + + @ApiModelProperty(value = "条码") + @Excel(name = "条码") + private String barCode; + + @ApiModelProperty(value = "货品名称") + private List materialTypeIds; + /** 入库记录明细信息 */ private List imsIntoInventoryDetailList; diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsOutInventoryDetail.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsOutInventoryDetail.java index 343b9a8..647482b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsOutInventoryDetail.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/ImsOutInventoryDetail.java @@ -131,4 +131,8 @@ public class ImsOutInventoryDetail extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "到期时间(保质期)", width = 30, dateFormat = "yyyy-MM-dd") private LocalDate expireTime; + + @ApiModelProperty(value = "库存数量") + @Excel(name = "库存数量") + private BigDecimal materialNum; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryQuery.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryQuery.java index 1c8773c..7faf60c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryQuery.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryQuery.java @@ -3,6 +3,8 @@ package com.bonus.canteen.core.ims.domain.param; import java.math.BigDecimal; import java.util.List; import java.time.LocalDateTime; + +import com.bonus.common.core.annotation.Excel; import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serializable; import io.swagger.annotations.ApiModelProperty; @@ -93,4 +95,22 @@ public class ImsIntoInventoryQuery implements Serializable @ApiModelProperty(value = "原料id") private Long materialId; + + @ApiModelProperty(value = "供应商id") + private Long supplierId; + + @ApiModelProperty(value = "材料名称") + @Excel(name = "材料名称") + private String materialName; + + @ApiModelProperty(value = "货品编码") + @Excel(name = "货品编码") + private String materialCode; + + @ApiModelProperty(value = "条码") + @Excel(name = "条码") + private String barCode; + + @ApiModelProperty(value = "货品名称") + private List materialTypeIds; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryUpdate.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryUpdate.java index 3414346..dea8558 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryUpdate.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryUpdate.java @@ -12,7 +12,6 @@ import lombok.ToString; import javax.validation.Valid; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; -import java.io.Serializable; /** * 入库记录对象 ims_into_inventory @@ -94,6 +93,6 @@ public class ImsIntoInventoryUpdate implements Serializable /** 入库记录明细信息 */ @Valid - private List imsIntoInventoryDetailUpdateList; + private List imsIntoInventoryDetailAddList; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsOutInventoryUpdate.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsOutInventoryUpdate.java index f7a3ed2..3250e4c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsOutInventoryUpdate.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsOutInventoryUpdate.java @@ -10,9 +10,7 @@ import lombok.Data; import lombok.ToString; import javax.validation.Valid; -import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; -import java.io.Serializable; /** * 出库记录对象 ims_out_inventory @@ -90,6 +88,6 @@ public class ImsOutInventoryUpdate implements Serializable /** 出库记录明细信息 */ @Valid - private List imsOutInventoryDetailUpdateList; + private List imsOutInventoryDetailAddList; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/vo/ImsOutInventoryDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/vo/ImsOutInventoryDetailVO.java index 12421a7..fc6b7e7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/vo/ImsOutInventoryDetailVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/vo/ImsOutInventoryDetailVO.java @@ -129,4 +129,8 @@ public class ImsOutInventoryDetailVO extends BaseEntity @Excel(name = "到期时间(保质期)", width = 30, dateFormat = "yyyy-MM-dd") private LocalDate expireTime; + @ApiModelProperty(value = "库存数量") + @Excel(name = "库存数量") + private BigDecimal materialNum; + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ImsOutInventoryMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ImsOutInventoryMapper.java index 5ff20f5..d577c72 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ImsOutInventoryMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ImsOutInventoryMapper.java @@ -3,18 +3,18 @@ package com.bonus.canteen.core.ims.mapper; import java.util.List; import com.bonus.canteen.core.ims.domain.ImsOutInventory; import com.bonus.canteen.core.ims.domain.ImsOutInventoryDetail; +import org.apache.ibatis.annotations.Param; /** * 出库记录Mapper接口 - * + * * @author gaowdong * @date 2025-07-07 */ -public interface ImsOutInventoryMapper -{ +public interface ImsOutInventoryMapper { /** * 查询出库记录 - * + * * @param outId 出库记录主键 * @return 出库记录 */ @@ -22,7 +22,7 @@ public interface ImsOutInventoryMapper /** * 查询出库记录列表 - * + * * @param imsOutInventory 出库记录 * @return 出库记录集合 */ @@ -30,7 +30,7 @@ public interface ImsOutInventoryMapper /** * 新增出库记录 - * + * * @param imsOutInventory 出库记录 * @return 结果 */ @@ -38,7 +38,7 @@ public interface ImsOutInventoryMapper /** * 修改出库记录 - * + * * @param imsOutInventory 出库记录 * @return 结果 */ @@ -46,7 +46,7 @@ public interface ImsOutInventoryMapper /** * 删除出库记录 - * + * * @param outId 出库记录主键 * @return 结果 */ @@ -54,7 +54,7 @@ public interface ImsOutInventoryMapper /** * 批量删除出库记录 - * + * * @param outIds 需要删除的数据主键集合 * @return 结果 */ @@ -62,26 +62,30 @@ public interface ImsOutInventoryMapper /** * 批量删除出库记录明细 - * + * * @param outIds 需要删除的数据主键集合 * @return 结果 */ public int deleteImsOutInventoryDetailByOutIds(Long[] outIds); - + /** * 批量新增出库记录明细 - * + * * @param imsOutInventoryDetailList 出库记录明细列表 * @return 结果 */ public int batchImsOutInventoryDetail(List imsOutInventoryDetailList); - + /** * 通过出库记录主键删除出库记录明细信息 - * + * * @param outId 出库记录ID * @return 结果 */ public int deleteImsOutInventoryDetailByOutId(Long outId); + + public List selectImsOutInventoryDetailList(@Param("outId") Long outId); + + public List selectImsOutInventoryDetailListWithoutIntoId(@Param("outId") Long outId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java index c477f54..9e3bf90 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java @@ -1,7 +1,6 @@ package com.bonus.canteen.core.ims.service.impl; import java.math.BigDecimal; -import java.util.Collections; import java.util.List; import cn.hutool.core.collection.CollUtil; @@ -15,7 +14,6 @@ import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.security.utils.SecurityUtils; -import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -137,7 +135,7 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService imsIntoInventory.setUpdateBy(SecurityUtils.getUsername()); imsIntoInventory.setIntoCode(imsIntoInventoryVO.getIntoCode()); imsIntoInventoryMapper.deleteImsIntoInventoryDetailByIntoId(imsIntoInventory.getIntoId()); - insertImsIntoInventoryDetail(imsIntoInventoryUpdate.getImsIntoInventoryDetailUpdateList(), imsIntoInventory); + insertImsIntoInventoryDetail(imsIntoInventoryUpdate.getImsIntoInventoryDetailAddList(), imsIntoInventory); return imsIntoInventoryMapper.updateImsIntoInventory(imsIntoInventory); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsOutInventoryServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsOutInventoryServiceImpl.java index 941b1ba..83f63c4 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsOutInventoryServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsOutInventoryServiceImpl.java @@ -6,7 +6,6 @@ import java.util.List; import cn.hutool.core.collection.CollUtil; import com.bonus.canteen.core.ims.domain.*; import com.bonus.canteen.core.ims.domain.param.*; -import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryVO; import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryDetailVO; import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryVO; import com.bonus.canteen.core.ims.mapper.ImsIntoInventoryMapper; @@ -61,7 +60,13 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService if(Objects.nonNull(imsOutInventory)) { imsOutInventoryVO = new ImsOutInventoryVO(); BeanUtils.copyProperties(imsOutInventory, imsOutInventoryVO); - List imsOutInventoryDetails = imsOutInventory.getImsOutInventoryDetailList(); + List imsOutInventoryDetails; + if(imsOutInventory.getStatus() == 1) { + imsOutInventoryDetails = imsOutInventoryMapper.selectImsOutInventoryDetailListWithoutIntoId(outId); + }else{ + imsOutInventoryDetails = imsOutInventoryMapper.selectImsOutInventoryDetailList(outId); + } + if(CollUtil.isNotEmpty(imsOutInventoryDetails)) { List imsOutInventoryDetailVOList = new ArrayList<>(); for(ImsOutInventoryDetail detail : imsOutInventoryDetails) { @@ -144,8 +149,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService imsOutInventory.setUpdateBy(SecurityUtils.getUsername()); imsOutInventory.setOutCode(imsOutInventoryVO.getOutCode()); imsOutInventoryMapper.deleteImsOutInventoryDetailByOutId(imsOutInventory.getOutId()); - insertImsOutInventoryDetail(imsOutInventoryUpdate.getImsOutInventoryDetailUpdateList(), imsOutInventory); - return imsOutInventoryMapper.updateImsOutInventory(imsOutInventory); + return insertImsOutInventoryDetail(imsOutInventoryUpdate.getImsOutInventoryDetailAddList(), imsOutInventory); } /** @@ -181,7 +185,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService * * @param imsOutInventory 出库记录对象 */ - public void insertImsOutInventoryDetail(List imsOutInventoryDetailAddList, ImsOutInventory imsOutInventory) + public int insertImsOutInventoryDetail(List imsOutInventoryDetailAddList, ImsOutInventory imsOutInventory) { Long outId = imsOutInventory.getOutId(); if (StringUtils.isNotNull(imsOutInventoryDetailAddList)) @@ -295,17 +299,17 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService } } updateFetchMaterialOrderStatus(imsOutInventory); + }else { + list.add(imsOutInventoryDetail); } } if (list.size() > 0) { imsOutInventoryMapper.batchImsOutInventoryDetail(list); - ImsOutInventory imsOutInventoryUpdate = new ImsOutInventory(); - imsOutInventoryUpdate.setOutId(outId); - imsOutInventoryUpdate.setTotalAmount(totalPriceSum); - imsOutInventoryMapper.updateImsOutInventory(imsOutInventoryUpdate); + imsOutInventory.setTotalAmount(totalPriceSum); } } + return imsOutInventoryMapper.updateImsOutInventory(imsOutInventory); } private void updateFetchMaterialOrderStatus(ImsOutInventory imsOutInventory) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsIntoInventoryMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsIntoInventoryMapper.xml index 0f770fe..1231488 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsIntoInventoryMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsIntoInventoryMapper.xml @@ -189,14 +189,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join cook_material_type cmt on cm.material_type_id = cmt.material_type_id left join ims_unit iu on iiid.unit_id = iu.unit_id left join ims_warehouse_info iwi on iii.warehouse_id = iwi.warehouse_id - where iiid.material_id = #{materialId} - and iii.warehouse_id = #{warehouseId} + where iii.warehouse_id = #{warehouseId} and iii.status = '2' and iiid.inventory_num > 0 and iiid.del_flag = '0' + + and cmt.material_type_id in + + #{materialTypeId} + + + + and cm.material_name like CONCAT('%',#{materialName},'%') + + + and cm.material_code = #{materialCode} + + + and cm.bar_code = #{barCode} + + + and iiid.material_id = #{materialId} + and iii.into_code = #{intoCode} + + and iiid.supplier_id = #{supplierId} + and iii.into_date = ]]> #{startDateTime} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsInventoryMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsInventoryMapper.xml index 97cbf91..dcf8c00 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsInventoryMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsInventoryMapper.xml @@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ii.del_flag = '0' + and ii.inventory_id = #{inventoryId} and ba.area_id = #{areaId} and ii.warehouse_id = #{warehouseId} and ii.material_id = #{materialId} @@ -61,11 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{materialTypeId} - + and cm.material_name like CONCAT('%',#{materialName},'%') - - and cm.bar_code like CONCAT('%',#{barCode},'%') + + and cm.material_code = #{materialCode} + + + and cm.bar_code = #{barCode} and ii.create_time = ]]> #{startDateTime} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsOutInventoryMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsOutInventoryMapper.xml index 2a03a33..3742692 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsOutInventoryMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ImsOutInventoryMapper.xml @@ -30,9 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - + + + @@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -106,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by ioi.out_date desc - select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type, ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id, ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time, @@ -131,7 +132,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join cook_material cm on iiid.material_id = cm.material_id left join cook_material_type cmt on cm.material_type_id = cmt.material_type_id left join ims_unit iu on iiid.unit_id = iu.unit_id - where out_id = #{out_id} and ioid.del_flag = '0' + where out_id = #{outId} and ioid.del_flag = '0' + order by ioid.out_detail_id + + +