Compare commits
2 Commits
7d4ad983f2
...
f0fdea424f
| Author | SHA1 | Date |
|---|---|---|
|
|
f0fdea424f | |
|
|
00d3be250d |
|
|
@ -89,4 +89,6 @@ public interface ImsIntoInventoryMapper {
|
||||||
public List<ImsIntoInventoryDetail> selectImsIntoInventoryDetailListByInventoryId(Long inventoryId);
|
public List<ImsIntoInventoryDetail> selectImsIntoInventoryDetailListByInventoryId(Long inventoryId);
|
||||||
|
|
||||||
public int updateIntoInventoryNum(@Param("intoDetailId") Long intoDetailId, @Param("fetchNum") BigDecimal fetchNum);
|
public int updateIntoInventoryNum(@Param("intoDetailId") Long intoDetailId, @Param("fetchNum") BigDecimal fetchNum);
|
||||||
|
|
||||||
|
public ImsIntoInventoryDetail selectImsIntoInventoryDetailListByIntoDetailId(@Param("intoDetailId") Long intoDetailId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
Long outId = imsOutInventory.getOutId();
|
Long outId = imsOutInventory.getOutId();
|
||||||
if (StringUtils.isNotNull(imsOutInventoryDetailAddList))
|
if (StringUtils.isNotNull(imsOutInventoryDetailAddList))
|
||||||
{
|
{
|
||||||
List<ImsOutInventoryDetail> list = new ArrayList<ImsOutInventoryDetail>();
|
List<ImsOutInventoryDetail> list = new ArrayList<>();
|
||||||
long totalPriceSum = 0L;
|
long totalPriceSum = 0L;
|
||||||
for (ImsOutInventoryDetailAdd imsOutInventoryDetailAdd : imsOutInventoryDetailAddList)
|
for (ImsOutInventoryDetailAdd imsOutInventoryDetailAdd : imsOutInventoryDetailAddList)
|
||||||
{
|
{
|
||||||
|
|
@ -215,6 +215,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
if(Objects.isNull(imsOutInventoryDetail.getFetchNum())) {
|
if(Objects.isNull(imsOutInventoryDetail.getFetchNum())) {
|
||||||
throw new ServiceException("出库数量不能为空");
|
throw new ServiceException("出库数量不能为空");
|
||||||
}
|
}
|
||||||
|
//出库
|
||||||
ImsInventory imsInventoryUpdate = new ImsInventory();
|
ImsInventory imsInventoryUpdate = new ImsInventory();
|
||||||
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
|
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
|
||||||
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
||||||
|
|
@ -267,6 +268,31 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
throw new ServiceException("出口失败,库存不足");
|
throw new ServiceException("出口失败,库存不足");
|
||||||
}
|
}
|
||||||
totalPriceSum += totalPrice;
|
totalPriceSum += totalPrice;
|
||||||
|
}else {
|
||||||
|
ImsIntoInventoryDetail imsIntoInventoryDetail = imsIntoInventoryMapper
|
||||||
|
.selectImsIntoInventoryDetailListByIntoDetailId(imsOutInventoryDetail.getIntoDetailId());
|
||||||
|
if(Objects.nonNull(imsIntoInventoryDetail)) {
|
||||||
|
if(Objects.isNull(imsOutInventoryDetail.getFetchNum())) {
|
||||||
|
throw new ServiceException("出库数量不能为空");
|
||||||
|
}
|
||||||
|
int updateRows = imsIntoInventoryMapper.
|
||||||
|
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), imsOutInventoryDetail.getFetchNum());
|
||||||
|
if(updateRows > 0) {
|
||||||
|
long outTotalPrice = (imsOutInventoryDetail.getFetchNum()
|
||||||
|
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
|
||||||
|
totalPriceSum += outTotalPrice;
|
||||||
|
ImsOutInventoryDetail imsOutInventoryDetailForInsert = new ImsOutInventoryDetail();
|
||||||
|
BeanUtils.copyProperties(imsOutInventoryDetail, imsOutInventoryDetailForInsert);
|
||||||
|
imsOutInventoryDetailForInsert.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
|
||||||
|
imsOutInventoryDetailForInsert.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
||||||
|
imsOutInventoryDetailForInsert.setTotalPrice(outTotalPrice);
|
||||||
|
list.add(imsOutInventoryDetailForInsert);
|
||||||
|
}else{
|
||||||
|
throw new ServiceException("出库失败");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
throw new ServiceException("出库失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateFetchMaterialOrderStatus(imsOutInventory);
|
updateFetchMaterialOrderStatus(imsOutInventory);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by iii.into_date
|
order by iii.into_date
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectImsIntoInventoryDetailListByIntoDetailId" resultMap="ImsIntoInventoryDetailResult">
|
||||||
|
select into_detail_id,
|
||||||
|
iiid.into_id,
|
||||||
|
iiid.into_code,
|
||||||
|
inventory_id,
|
||||||
|
material_id,
|
||||||
|
iiid.supplier_id,
|
||||||
|
unit_id,
|
||||||
|
size,
|
||||||
|
unit_price,
|
||||||
|
total_price,
|
||||||
|
delivery_num,
|
||||||
|
pur_num,
|
||||||
|
unqualified_num,
|
||||||
|
inventory_num,
|
||||||
|
product_date,
|
||||||
|
expire_time,
|
||||||
|
img_url,
|
||||||
|
if_fill_inventory,
|
||||||
|
relate_order_goods_detail_id,
|
||||||
|
relate_delivery_goods_detail_id,
|
||||||
|
iiid.del_flag,
|
||||||
|
iiid.create_by,
|
||||||
|
iiid.create_time,
|
||||||
|
iiid.update_by,
|
||||||
|
iiid.update_time
|
||||||
|
from ims_into_inventory_detail iiid
|
||||||
|
left join ims_into_inventory iii on iii.into_id = iiid.into_id
|
||||||
|
where iiid.into_detail_id = #{intoDetailId}
|
||||||
|
and iii.status = '2'
|
||||||
|
and iiid.inventory_num > 0
|
||||||
|
and iiid.del_flag = '0'
|
||||||
|
order by iii.into_date
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertImsIntoInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" useGeneratedKeys="true" keyProperty="intoId">
|
<insert id="insertImsIntoInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" useGeneratedKeys="true" keyProperty="intoId">
|
||||||
insert into ims_into_inventory
|
insert into ims_into_inventory
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue