Compare commits

...

2 Commits

Author SHA1 Message Date
gaowdong 725195c76e Merge remote-tracking branch 'origin/master' 2025-07-09 17:34:29 +08:00
gaowdong e778663c81 库存管理 2025-07-09 17:34:15 +08:00
13 changed files with 42 additions and 17 deletions

View File

@ -104,7 +104,7 @@ public class ImsIntoInventory extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
@ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -105,7 +105,7 @@ public class ImsInventory extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
@ApiModelProperty(value = "货品编码")
@Excel(name = "货品编码")

View File

@ -103,7 +103,7 @@ public class ImsOutInventory extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
@ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -85,4 +85,7 @@ public class ImsIntoInventoryQuery implements Serializable
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
@ApiModelProperty(value = "区域id")
private Long areaId;
}

View File

@ -60,4 +60,7 @@ public class ImsInventoryQuery implements Serializable
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
@ApiModelProperty(value = "区域id")
private Long areaId;
}

View File

@ -85,4 +85,7 @@ public class ImsOutInventoryQuery implements Serializable
@ApiModelProperty(value = "领料人")
private String fetchUser;
@ApiModelProperty(value = "区域id")
private Long areaId;
}

View File

@ -101,7 +101,7 @@ public class ImsIntoInventoryVO extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
/** 入库记录明细信息 */
private List<ImsIntoInventoryDetailVO> imsIntoInventoryDetailVOList;

View File

@ -87,7 +87,7 @@ public class ImsInventoryVO extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
@ApiModelProperty(value = "材料名称")
@Excel(name = "材料名称")

View File

@ -96,7 +96,7 @@ public class ImsOutInventoryVO extends BaseEntity
@ApiModelProperty(value = "区域ID")
@Excel(name = "区域ID")
private String areaId;
private Long areaId;
@ApiModelProperty(value = "仓库名称")
@Excel(name = "仓库名称")

View File

@ -214,6 +214,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
}
ImsInventoryUpdate imsInventoryUpdate = new ImsInventoryUpdate();
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
int rows = imsInventoryService.updateImsInventory(imsInventoryUpdate);
if(rows < 1) {
throw new ServiceException("库存不足");
@ -231,22 +232,30 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
int updateRows = imsIntoInventoryMapper.
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), imsIntoInventoryDetail.getInventoryNum());
if(updateRows > 0) {
totalPrice += (imsIntoInventoryDetail.getInventoryNum()
long outTotalPrice = (imsIntoInventoryDetail.getInventoryNum()
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
imsOutInventoryDetail.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
imsOutInventoryDetail.setFetchNum(imsIntoInventoryDetail.getInventoryNum());
list.add(imsOutInventoryDetail);
totalPrice += outTotalPrice;
ImsOutInventoryDetail imsOutInventoryDetailForInsert = new ImsOutInventoryDetail();
BeanUtils.copyProperties(imsOutInventoryDetail, imsOutInventoryDetailForInsert);
imsOutInventoryDetailForInsert.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
imsOutInventoryDetailForInsert.setFetchNum(imsIntoInventoryDetail.getInventoryNum());
imsOutInventoryDetailForInsert.setTotalPrice(outTotalPrice);
list.add(imsOutInventoryDetailForInsert);
tempFetchLeftNum = tempFetchLeftNum.subtract(imsIntoInventoryDetail.getInventoryNum());
}
}else {
int updateRows = imsIntoInventoryMapper.
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), tempFetchLeftNum);
if(updateRows > 0) {
totalPrice += (tempFetchLeftNum
long outTotalPrice = (tempFetchLeftNum
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
imsOutInventoryDetail.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
imsOutInventoryDetail.setFetchNum(tempFetchLeftNum);
list.add(imsOutInventoryDetail);
totalPrice += outTotalPrice;
ImsOutInventoryDetail imsOutInventoryDetailForInsert = new ImsOutInventoryDetail();
BeanUtils.copyProperties(imsOutInventoryDetail, imsOutInventoryDetailForInsert);
imsOutInventoryDetailForInsert.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
imsOutInventoryDetailForInsert.setFetchNum(tempFetchLeftNum);
imsOutInventoryDetailForInsert.setTotalPrice(outTotalPrice);
list.add(imsOutInventoryDetailForInsert);
tempFetchLeftNum = tempFetchLeftNum.subtract(tempFetchLeftNum);
}
}
@ -254,7 +263,6 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
if(tempFetchLeftNum.compareTo(BigDecimal.ZERO) > 0) {
throw new ServiceException("出口失败,库存不足");
}
imsOutInventoryDetail.setTotalPrice(totalPrice);
totalPriceSum += totalPrice;
}
}

View File

@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="totalNum != null "> and iii.total_num = #{totalNum}</if>
<if test="intoType != null "> and iii.into_type = #{intoType}</if>
<if test="status != null "> and iii.status = #{status}</if>
<if test="areaId != null "> and ba.area_id = #{areaId}</if>
<if test="refundOutId != null and refundOutId != ''"> and iii.refund_out_id = #{refundOutId}</if>
<if test="relateDeliveryGoodsId != null and relateDeliveryGoodsId != ''"> and iii.relate_delivery_goods_id = #{relateDeliveryGoodsId}</if>
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
@ -104,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and iii.into_date <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
order by iii.into_date desc
</select>
<select id="selectImsIntoInventoryByIntoId" parameterType="Long" resultMap="ImsIntoInventoryImsIntoInventoryDetailResult">
@ -132,6 +134,7 @@ 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
where iiid.into_id = #{into_id} and iiid.del_flag = '0'
order by iiid.into_detail_id
</select>
<select id="selectImsIntoInventoryDetailListByInventoryId" resultMap="ImsIntoInventoryDetailResult">

View File

@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectImsInventoryVo"/>
<where>
ii.del_flag = '0'
<if test="areaId != null "> and ba.area_id = #{areaId}</if>
<if test="warehouseId != null "> and ii.warehouse_id = #{warehouseId}</if>
<if test="materialId != null "> and ii.material_id = #{materialId}</if>
<if test="unitId != null "> and ii.unit_id = #{unitId}</if>
@ -61,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ii.create_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
order by ii.create_time desc
</select>
<select id="selectImsInventoryByInventoryId" parameterType="Long" resultMap="ImsInventoryResult">
@ -118,8 +120,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inventoryStatus != null">inventory_status = #{inventoryStatus},</if>
<if test="inventoryStatus == null and fetchNum != null">
inventory_status = CASE
WHEN (material_num - #{fetchNum}) <![CDATA[ < ]]> min_num THEN 2
WHEN (material_num - #{fetchNum}) <![CDATA[ > ]]> max_num THEN 3
WHEN material_num <![CDATA[ < ]]> min_num THEN 2
WHEN material_num <![CDATA[ > ]]> max_num THEN 3
ELSE 1
END,
</if>

View File

@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planId != null and planId != ''"> and ioi.plan_id = #{planId}</if>
<if test="fetchMaterialId != null and fetchMaterialId != ''"> and ioi.fetch_material_id = #{fetchMaterialId}</if>
<if test="goodsAllocationId != null and goodsAllocationId != ''"> and ioi.goods_allocation_id = #{goodsAllocationId}</if>
<if test="areaId != null "> and ba.area_id = #{areaId}</if>
<if test="startDateTime != null">
and ioi.out_date <![CDATA[ >= ]]> #{startDateTime}
</if>
@ -102,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ioi.out_date <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
order by ioi.out_date desc
</select>
<select id="selectImsOutInventoryByOutId" parameterType="Long" resultMap="ImsOutInventoryImsOutInventoryDetailResult">
@ -130,6 +132,7 @@ 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
where out_id = #{out_id} and ioid.del_flag = '0'
order by ioid.out_detail_id
</select>
<insert id="insertImsOutInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsOutInventory" useGeneratedKeys="true" keyProperty="outId">