EBS鍘嗗彶鏃堕棿搴撳瓨鎶ヨ〃

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EBS鍘嗗彶鏃堕棿搴撳瓨鎶ヨ〃相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/type' title='type'>type   bubuko   --   cas   weight   inventory   attribute   number   bin   

鍏徃闇€瑕佸仛鎴怑BS鐨勫巻鍙插簱瀛樻姤琛紝鏀惧湪閽夐拤渚涙煡璇€傚厛鎶婃渶缁堝仛鍑虹殑缁撴灉鍥惧睍绀轰笅锛?/span>

鎶€鏈垎浜浘鐗? src=

 

 

 

涓€銆佽В鍐虫€濊矾锛?/h1>

鐢变簬EBS娌℃湁鎻愪緵鍘嗗彶鏃堕棿搴撳瓨琛紝鎵€浠ユ€濊矾灏辨槸閫氳繃鐜版湁閲忓幓涓€姝ヤ竴姝ュ湴鍊掓帹锛岀畻鍑哄巻鍙叉椂闂村簱瀛樿〃銆?/span>

鐜版湁閲忓彲浠ラ噰鐢‥BS鑷甫鐨刧et_onhand_available_qty鍑芥暟銆?/span>

浠庝簨鍔¤〃INV.MTL_MATERIAL_TRANSACTIONS鐨勶紙TRANSACTION_DATE鎴栬€匬ROGRAM_UPDATE_DATE瀛楁鑾峰彇锛屽尯鍒◢鍚庤鏄庯級涓姞鍔犲噺鍑忥紝涓€姝ヤ竴姝ュ線鍥炴帹绠椼€?/span>

鎺ㄧ畻鐢ㄥ埌鐨勫嚱鏁颁负SUM()OVER(),浠ュ強LAG()OVER()鍑芥暟銆傚叿浣撶敤娉曡鑷鐧惧害銆?/span>

 

浜屻€佷唬鐮佸涓嬶細

CREATE OR REPLACE VIEW CUX.CUX_ONHAND_OLD_V
(
	ORGANIZATION_CODE
  , INVENTORY_ITEM_ID
  , SEGMENT1
  , ELEMENT_VALUE
  , SUBINVENTORY_CODE
  , TRANSACTION_DATE
  , TRANSACTION_QUANTITY
  , STOCK_IN
  , STOCK_OUT
  , TRANSACTION_UOM
  , ONHAND_QTY
  , CURRENT_QTY
)
AS
	WITH
		T
		AS
			(  SELECT SUBINVENTORY_CODE
					--, REVISION
					-- , TRANSFER_SUBINVENTORY
					--, SHIP_TO_LOCATION_ID
					--, COST_GROUP_ID
					--, TRANSFER_COST_GROUP_ID
					--, LPN_ID
					--, CONTENT_LPN_ID
					--, TRANSFER_LPN_ID
					--, TRANSFER_ORGANIZATION_ID
					--, OWNING_ORGANIZATION_ID
					--, PLANNING_TP_TYPE
					-- , OWNING_TP_TYPE
					--, PLANNING_ORGANIZATION_ID
					, TRUNC (TRANSACTION_DATE)
						  TRANSACTION_DATE
					, SUM (TRANSACTION_QUANTITY)
						  TRANSACTION_QUANTITY
					, SUM (
						  (case
							   when TO_NUMBER (TRANSACTION_QUANTITY) >= 0
							   then
								   TRANSACTION_QUANTITY
							   else
								   null
						   end))
						  stock_in
					, SUM (
						  (case
							   when TO_NUMBER (TRANSACTION_QUANTITY) < 0
							   then
								   -1 * TRANSACTION_QUANTITY
							   else
								   null
						   end))
						  stock_out
					, TRANSACTION_UOM
					--, PRIMARY_QUANTITY
					, APPS.cux_public_pkg.get_onhand_qty (
						  p_inventory_item_id	=> inventory_item_id
						, p_organization_id 	=> organization_id
						, p_subinv_code 		=> subinventory_code)
						  onhand_qty
					--, SECONDARY_TRANSACTION_QUANTITY
					--, SECONDARY_UOM_CODE
					--, SHIPMENT_NUMBER
					--, WAYBILL_AIRBILL
					--, FREIGHT_CODE
					--, NUMBER_OF_CONTAINERS
					--, TRANSACTION_REFERENCE
					--, COSTED_FLAG
					-- , OPM_COSTED_FLAG
					-- , PM_COST_COLLECTED
					--, PM_COST_COLLECTOR_GROUP_ID
					--, TRANSACTION_GROUP_ID
					--, VENDOR_LOT_NUMBER
					--  , SOURCE_CODE
					-- , SOURCE_LINE_ID
					-- , TRANSFER_TRANSACTION_ID
					--, PARENT_TRANSACTION_ID
					--, LOGICAL_TRANSACTION
					--, TRANSACTION_SET_ID
					-- , RCV_TRANSACTION_ID
					--  , MOVE_TRANSACTION_ID
					--, COMPLETION_TRANSACTION_ID
					--, OPERATION_SEQ_NUM
					--, SOURCE_PROJECT_ID
					--, SOURCE_TASK_ID
					--, PROJECT_ID
					--, TASK_ID
					--, TO_PROJECT_ID
					--, TO_TASK_ID
					--, EXPENDITURE_TYPE
					--, PA_EXPENDITURE_ORG_ID
					--, ERROR_CODE
					--, ERROR_EXPLANATION
					--, transaction_source_name
					--, XFR_OWNING_ORGANIZATION_ID
					--, TRANSFER_OWNING_TP_TYPE
					--, ATTRIBUTE_CATEGORY
					-- , ATTRIBUTE1
					-- , ATTRIBUTE2
					-- , ATTRIBUTE3
					-- , ATTRIBUTE4
					-- , ATTRIBUTE5
					-- , ATTRIBUTE6
					--  , ATTRIBUTE7
					-- , ATTRIBUTE8
					-- , ATTRIBUTE9
					-- , ATTRIBUTE10
					-- , ATTRIBUTE11
					--  , ATTRIBUTE12
					--  , ATTRIBUTE13
					--  , ATTRIBUTE14
					-- , ATTRIBUTE15
					--, LAST_UPDATED_BY
					--  , CREATION_DATE
					--, CREATED_BY
					--  , LAST_UPDATE_LOGIN
					-- , REQUEST_ID
					--, PROGRAM_APPLICATION_ID
					--, PROGRAM_ID
					--, PROGRAM_UPDATE_DATE
					-- , LAST_UPDATE_DATE
					, INVENTORY_ITEM_ID
					, ORGANIZATION_ID
				 --, LOCATOR_ID
				 -- , REASON_ID
				 -- , TRANSFER_LOCATOR_ID
				 -- , TRANSACTION_TYPE_ID
				 -- , TRANSACTION_ACTION_ID
				 --  , TRANSACTION_SOURCE_TYPE_ID
				 --  , TRANSACTION_SOURCE_ID
				 --, EMPLOYEE_CODE
				 --, DEPARTMENT_ID
				 --, MASTER_SCHEDULE_UPDATE_CODE
				 --, RECEIVING_DOCUMENT
				 --, PICK_STRATEGY_ID
				 --, PICK_RULE_ID
				 --, PUT_AWAY_STRATEGY_ID
				 --, PUT_AWAY_RULE_ID
				 --, ORIGINAL_TRANSACTION_TEMP_ID
				 FROM INV.MTL_MATERIAL_TRANSACTIONS
				WHERE	  TRANSACTION_ACTION_ID NOT IN (24, 30)
					  --  and (ORGANIZATION_ID = 86)
					  --  and (INVENTORY_ITEM_ID = 5683)
					  and (   LOGICAL_TRANSACTION = 2
						   OR LOGICAL_TRANSACTION IS NULL)
			 --  and (subinventory_code = 鈥?01鈥?
			 group by organization_id
					, inventory_item_id
					, subinventory_code
					, TRANSACTION_UOM
					, TRUNC (TRANSACTION_DATE)
			 ORDER BY TRUNC (TRANSACTION_DATE) DESC),
		T1
		AS
			(SELECT organization_id
				  , inventory_item_id
				  , SUBINVENTORY_CODE
				  , TRANSACTION_DATE
				  , TRANSACTION_QUANTITY
				  , STOCK_IN
				  , STOCK_OUT
				  , TRANSACTION_UOM
				  , ONHAND_QTY
				  , (  ONHAND_QTY
					 - SUM (TRANSACTION_QUANTITY)
						   over (partition by organization_id
											, subinventory_code
											, inventory_item_id
											, TRANSACTION_UOM
								 order by TRANSACTION_DATE desc))
						as current_temp_qty
			   FROM t)
	SELECT DECODE (organization_id,  85, 101,  86, 102,  organization_id)
			   organization_code
		 , inventory_item_id
		 , (SELECT SEGMENT1
			  FROM inv.mtl_system_items_b
			 where	   inventory_item_id = t1.inventory_item_id
				   and ORGANIZATION_ID = t1.organization_id)
			   SEGMENT1
		 , (SELECT ELEMENT_VALUE
			  FROM apps.MTL_DESCR_ELEMENT_VALUES_V
			 where	   inventory_item_id = t1.inventory_item_id
				   and ELEMENT_SEQUENCE = 20)
			   ELEMENT_VALUE
		 , SUBINVENTORY_CODE
		 , TRANSACTION_DATE
		 , TRANSACTION_QUANTITY
		 , stock_in
		 , stock_out
		 , TRANSACTION_UOM
		 , ONHAND_QTY
		 , LAG (current_temp_qty, 1, ONHAND_QTY)
			   over (partition by organization_id
								, subinventory_code
								, inventory_item_id
								, TRANSACTION_UOM
					 order by TRANSACTION_DATE desc)
			   current_qty
	  FROM t1;

銆€銆€

 

涓夈€侀獙璇侊細TRANSACTION_DATE銆丳ROGRAM_UPDATE_DATE鍖哄埆

閫氳繃鎶ヨ〃鈥滀簨鍔″巻鍙茶褰曟眹鎬烩€濆幓楠岃瘉鏌愪竴澶╃殑鍘嗗彶搴撳瓨銆傝繖閲岀殑楠岃瘉鏄互TRANSACTION锛緿ATE瀛楁鍘诲仛楠岃瘉鐨勩€?/span>

浣嗚繖鏍疯窇鍑烘潵鐨勭粨鏋滐紝鍦ㄦ煇涓€澶╂湁鍙兘鏄礋鏁扮殑銆傚洜涓烘湁浜涘簱瀛樺畠褰撳ぉ鍗″湪鎺ュ彛涓婏紝绗簩澶╋紝鐢氳嚦杩囦竴娈垫椂闂翠箣鍚庢墠浼氫粠鎺ュ彛涓婅窇杩囧幓銆?/span>

杩欏鑷翠簡搴撳瓨涓嶅噯纭紝鐢氳嚦搴撳瓨涓鸿礋鏁般€傛墍浠ユ垜鐨勫仛娉曟槸鍙朠ROGRAM锛縐PDATE锛緿ATE瀛楁銆?nbsp;

 

 

鎶€鏈垎浜浘鐗? src=

 

鍥涖€佷紭鍖栵細

鍐欏ソ鍚庣殑cux.cux_onhand_v瑙嗗浘锛屾墽琛屾椂闇€瑕?0澶氱锛屾湁鐐规參銆備絾杩樻槸灞炰簬鍙帴鍙楄寖鍥村唴銆?/span>

浣嗗湪鎵嬫満鎵ц鏃舵槸闇€瑕佷紶鏉′欢杩囧幓鏌ヨ鐨勶紝鏈€鍒濆啓鐨勪唬鐮佸涓嬶紙5绉掓墽琛屽畬姣曪級锛?/span>

SELECT onhand.ORGANIZATION_CODE as "缁勭粐浠g爜"
     , onhand.SEGMENT1 as "鏉愭枡鍚嶇О"
     , onhand.ELEMENT_VALUE as "瑙勬牸鍨嬪彿"
     , onhand.SUBINVENTORY_CODE as "搴?
     , onhand.PROGRAM_UPDATE_DATE as "鏃ユ湡"
     , onhand.STOCK_IN as "鏀跺叆鏁伴噺"
     , onhand.STOCK_OUT as "鍙戝嚭鏁伴噺"
     , onhand.TRANSACTION_UOM as "鍗曚綅"
     , onhand.CURRENT_QTY as "缁撳瓨鏁伴噺"
  FROM cux.cux_onhand_v onhand
 WHERE       onhand.segment1 = 鈥?/span>102005-000256鈥?/span>
       and onhand.ORGANIZATION_code = 102
       and onhand.SUBINVENTORY_CODE = 鈥?/span>101鈥?/span>

杩欐牱鐨勪唬鐮佹墜鏈烘墽琛岃姳浜?绉掓椂闂达紝鍙兘绠楁槸鍕夊己鎺ュ彈浜嗐€傚厛鐪嬩笅鎵ц璁″垝锛圕OST鎴愭湰鑺变簡5409锛?/span>

鎶€鏈垎浜浘鐗? src=

 

 浠庢墽琛岃鍒掑彲浠ョ湅鍑猴紝cost浠?82鐚涘鍒?022锛屾槸鍥犱负鎴戜滑鍦ㄨ闂甀NV.MTL_MATERIAL_TRANSACTIONS琛ㄦ椂娌℃湁鍋氳皳璇嶆帹杩涖€?/span>

杩欎篃鏄洜涓篶ux_onhand_v瑙嗗浘璁块棶鎱㈢殑鏈€涓昏鍘熷洜銆備唬鐮佹敼鎴愬涓嬶細

 

SELECT onhand.ORGANIZATION_CODE as "缁勭粐浠g爜"
   , onhand.SEGMENT1 as "鏉愭枡鍚嶇О"
   , onhand.ELEMENT_VALUE as "瑙勬牸鍨嬪彿"
   , onhand.SUBINVENTORY_CODE as "搴?
  , onhand.PROGRAM_UPDATE_DATE as "鏃ユ湡"
   , onhand.STOCK_IN as "鏀跺叆鏁伴噺"
   , onhand.STOCK_OUT as "鍙戝嚭鏁伴噺"
   , onhand.TRANSACTION_UOM as "鍗曚綅"
   , onhand.CURRENT_QTY as "缁撳瓨鏁伴噺"
  FROM cux.cux_onhand_v onhand
   , (SELECT inventory_item_id
      FROM inv.mtl_system_items_b
     WHERE     organization_id = 84
         AND segment1 = 鈥?02005-000256鈥?         AND ROWNUM = 1) b
 WHERE     onhand.inventory_item_id = b.inventory_item_id
     and onhand.ORGANIZATION_code = 102
     and onhand.SUBINVENTORY_CODE = 鈥?01鈥?

銆€銆€鎵ц璁″垝濡備笅鎵€绀猴細锛堝皢璋撹瘝inventory_item_id鎺ㄨ繘鍏TL_MATERIAL_TRANSACTIONS琛紝COST鎴愭湰浠?409绔嬪嵆涓嬮檷鍒?2锛?/span>

鎶€鏈垎浜浘鐗? src=

 

 

杩欐牱浼樺寲鍚庣殑浠g爜锛屾墽琛屾椂闂寸敱5绉掔珛鍗充笅闄嶄负1绉掞紝涔熷氨鏄锛屾墜鏈哄睍绀烘暟鎹墍鑺辩殑鏃堕棿涓?span style="color: #ff0000; font-family: 榛戜綋">鈥滅鏉€鈥?/span>銆?/span>

 

以上是关于EBS鍘嗗彶鏃堕棿搴撳瓨鎶ヨ〃的主要内容,如果未能解决你的问题,请参考以下文章

redis甯歌闂

Java鍘嗗彶[鍙蹭笂鏈€璇︾粏鐨勯槓杩颁簡Java鍙戝睍鐨勫巻鍙茶繃绋媇

浠庢簮鐮佸垎鏋?MyBatis缂撳瓨 宸ヤ綔鍘熺悊

MySql 鏃堕棿闂撮殧 涓?褰撳墠鏃堕棿5鍒嗛挓涔嬪墠

Ubuntu铏氭嫙鏈轰腑鏃堕棿涓巜indows鏃堕棿涓嶄竴鑷寸殑闂瑙e喅