供应计划实际入库数量同步库存数量
This commit is contained in:
@@ -179,4 +179,7 @@ public interface GysJhMapper
|
||||
*/
|
||||
int decreaseRealQtyById(@Param("rollbackQty") BigDecimal rollbackQty,
|
||||
@Param("gysJhId") Long gysJhId);
|
||||
|
||||
|
||||
int syncGysJhQty(GysJh gysJh);
|
||||
}
|
||||
|
||||
@@ -206,10 +206,13 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
BigDecimal currentInQty = entry.getValue();
|
||||
|
||||
GysJh gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||
|
||||
if (gysJh == null) {
|
||||
throw new RuntimeException("供应计划不存在,ID:" + gysJhId);
|
||||
}
|
||||
|
||||
int rows = gysJhMapper.syncGysJhQty(gysJh);
|
||||
// 重新查(必须)
|
||||
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||
BigDecimal planQty = gysJh.getJhQty();
|
||||
if (planQty == null) {
|
||||
continue;
|
||||
|
||||
@@ -317,5 +317,18 @@
|
||||
WHERE id = #{gysJhId}
|
||||
AND IFNULL(real_qty, 0) >= #{rollbackQty}
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user