供应计划实际入库数量同步库存数量

This commit is contained in:
2026-04-03 09:32:41 +08:00
parent b6bb2e4a3a
commit f7b9f228c3
3 changed files with 21 additions and 2 deletions

View File

@@ -179,4 +179,7 @@ public interface GysJhMapper
*/ */
int decreaseRealQtyById(@Param("rollbackQty") BigDecimal rollbackQty, int decreaseRealQtyById(@Param("rollbackQty") BigDecimal rollbackQty,
@Param("gysJhId") Long gysJhId); @Param("gysJhId") Long gysJhId);
int syncGysJhQty(GysJh gysJh);
} }

View File

@@ -206,10 +206,13 @@ public class RkBillServiceImpl implements IRkBillService
BigDecimal currentInQty = entry.getValue(); BigDecimal currentInQty = entry.getValue();
GysJh gysJh = gysJhMapper.selectGysJhById(gysJhId); GysJh gysJh = gysJhMapper.selectGysJhById(gysJhId);
if (gysJh == null) { if (gysJh == null) {
throw new RuntimeException("供应计划不存在ID" + gysJhId); throw new RuntimeException("供应计划不存在ID" + gysJhId);
} }
int rows = gysJhMapper.syncGysJhQty(gysJh);
// 重新查(必须)
gysJh = gysJhMapper.selectGysJhById(gysJhId);
BigDecimal planQty = gysJh.getJhQty(); BigDecimal planQty = gysJh.getJhQty();
if (planQty == null) { if (planQty == null) {
continue; continue;

View File

@@ -317,5 +317,18 @@
WHERE id = #{gysJhId} WHERE id = #{gysJhId}
AND IFNULL(real_qty, 0) >= #{rollbackQty} AND IFNULL(real_qty, 0) >= #{rollbackQty}
</update> </update>
<update id="syncGysJhQty" parameterType="GysJh">
UPDATE gys_jh gj
JOIN rk_info ri
ON gj.sap_no = ri.sap_no
AND gj.wl_no = ri.wl_no
AND gj.xm_no = ri.xm_no
SET
gj.real_qty = ri.real_qty
WHERE (gj.is_delete = '0' OR gj.is_delete IS NULL)
AND (ri.is_delete = '0' OR ri.is_delete IS NULL)
AND ri.sap_no = #{sapNo}
AND ri.wl_no = #{wlNo}
AND ri.xm_no = #{xmNo}
</update>
</mapper> </mapper>