update 创建采购的到货单时更新订单数量

This commit is contained in:
18110972313 2025-05-22 12:26:39 +08:00
parent 305d36b2e9
commit 1b7b8915f1
3 changed files with 18 additions and 0 deletions

View File

@ -152,4 +152,11 @@ public interface DeliveryDao {
@MapKey("storeCharge")
List<Map<String, Object>> getStoreChargeSort(@Param("siteName") String siteName,
@Param("documentName") String documentName);
/**
* 更新入库单数量
* @param receiveList
* @return
*/
int updateMaterialReceiveRequestDetailQty(@Param("receiveList") List<DeliveryRelationDto> receiveList);
}

View File

@ -50,6 +50,10 @@ public class DeliveryServiceImpl implements IDeliveryService {
if (deliveryDao.createRelation(res) <= 0) {
throw new GlobalException("添加到库单关系失败");
}
//更新采购订单行项的已入库数量
if (deliveryDao.updateMaterialReceiveRequestDetailQty(res) <= 0){
throw new GlobalException("更新采购单入库数量失败");
}
// 添加到库单
return deliveryDao.createDelivery(dto, DeliveryStateEnums.CREATE.getCode());
}

View File

@ -501,4 +501,11 @@
ORDER BY A.CHARGE
) TTT
</select>
<update id="updateMaterialReceiveRequestDetailQty">
<foreach item="item" index="index" collection="receiveList">
update MATERIALRECEIVEREQUESTDETAIL set RECEIVEDQUANTITY = #{item.deliveryNum} where RECEIVEREQUESTNAME = #{item.receiveRequestName} and RECEIVEREQUESTDETAILNAME = #{item.receiveRequestDetailName} and MATERIALSPECNAME = #{item.materialSpecName}
INTO MATERIALDELIVERYRECEIVE (RECEIVEREQUESTNAME, DELIVERYNAME, DELIVERYNUM, MATERIALSPECNAME, RECEIVEREQUESTDETAILNAME) VALUES (#{item.receiveRequestName}, #{item.deliveryName}, #{item.deliveryNum}, #{item.materialSpecName}, #{item.receiveRequestDetailName})
</foreach>
</update>
</mapper>