-- 物料采购信息 基本单位 字段数据升级
UPDATE T_BD_MATERIALPURINFO A SET FBASEUNITID = (SELECT FBASEUNIT FROM T_BD_MATERIAL B WHERE A.FMASTERID = B.FID) WHERE A.FBASEUNITID = 0 AND EXISTS (SELECT FBASEUNIT FROM T_BD_MATERIAL B WHERE A.FMASTERID = B.FID);


-- 物料采购信息 基本数量升级 只处理采购单位与基本单位一致场景
UPDATE T_BD_MATERIALPURINFO SET FPACKINGBASEQTY = FPACKINGQTY , FMAXBILLBASEQTY = FMAXBILLQTY ,FMINBILLBASEQTY = FMINBILLQTY WHERE FPURCHASEUNITID = FBASEUNITID AND ((FPACKINGBASEQTY = 0  AND FPACKINGQTY  <> 0 ) OR (FMAXBILLQTY <> 0 AND FMAXBILLBASEQTY = 0 ) OR (FMINBILLQTY <> 0 AND FMINBILLBASEQTY = 0 )) ;

