计算并更新中心库存计划入脚本

UPDATE eo_virtual_inv_item eovi,
(
	SELECT
		SUM( wad.QTY_ASN_EA ) QTY_ASN_EA,
		wad.sku_code,
		wad.LOT_ATT04,
		wad.LOT_ATT05,
		wad.OWNER_CODE 
	FROM
		wm_asn_detail wad
		LEFT JOIN wm_asn_header wah ON wad.ASN_NO = wah.ASN_NO 
	WHERE
		1 = 1 
		AND wad.REC_STATUS = 0 
		AND wah.REC_STATUS = 0 
		AND wah.CREATE_TIME > '2023-06-02' 
		AND wah.`STATUS` NOT IN ( '99' ) 
		AND wah.OWNER_CODE = 'jr000427' 
	GROUP BY
		wad.sku_code,
		wad.LOT_ATT04,
		wad.LOT_ATT05,
		wad.OWNER_CODE 
	) wadd 
	SET eovi.P_IN_QTY = eovi.P_IN_QTY + wadd.QTY_ASN_EA 
	where eovi.EOVI_SKU_CODE = wadd.sku_code 
	AND eovi.EOVI_LOTATT04 = wadd.LOT_ATT04 
	AND eovi.COLORS = wadd.LOT_ATT05 
	AND wadd.OWNER_CODE = eovi.EOVI_OWNER_CODE

你可能感兴趣的:(数学建模)