كيفية عمل منع للمستخدم من وضع تاريخ أكبر من التاريخ المسموح له به في تاريخ إنتهاء الصلاحية علي مستوي اللوط
Validate maximum expiration date for items lots
1. Validate Maximum Expiration Date For Items Lots
Purpose : Restrict Lot Expiration Date Within (Transaction Date + Constant Number)
Steps :
1- Apply Lot Expiration Control
- Master Item Form
2. You Can Define Different Number Of Days For Each Organization
3. Create Function On Data Base To Resolve Number Of Days For Each Item In Each Organization
CREATE OR REPLACE function APPS.GET_ITEM_SHELF_LIFE_DAYS(
P_ORG_ID in NUMBER,
P_ITEM_ID in NUMBER
) return VARCHAR is
X varchar2(3000);
begin
SELECT itemv.SHELF_LIFE_DAYS INTO X
-- ,itemv.INVENTORY_ITEM_ID,
-- itemv.SHELF_LIFE_CODE,
-- itemv.LOT_CONTROL_CODE
FROM MTL_SYSTEM_ITEMS_FVL itemv
WHERE itemv.ORGANIZATION_ID =P_ORG_ID
--AND (itemv.Segment1 =:pitem_code or :pitem_code is null)
AND itemv.INVENTORY_ITEM_ID = P_ITEM_ID
AND itemv.SHELF_LIFE_CODE = 4
AND itemv.LOT_CONTROL_CODE = 2;
return x;
exception when others then return null;
end;
/
4. Perform the following forms Personalization on Sales Order Form
1. Login to Oracle Apps with the specified user name and password
2. Navigate to Inventory Responsibility > Miscellaneous Transaction
3. Click Help > Diagnostics > Custom code > Click on the last selection:
'Personalize'
4. Under Conditions tab > Trigger Event = ' WHEN-NEW-ITEM-INSTANCE ', and
Trigger object = ' LOT_ENTRY.TRANSACTION_QUANTITY '
Condition =
1=1 AND :MTL_TRX_LINE.TRANSACTION_ACTION_ID IN (27)
AND :LOT_ENTRY.LOT_EXPIRATION_DATE>:MTL_TRX_LINE.TRANSACTION_DATE+((SELECT
GET_ITEM_SHELF_LIFE_DAYS(:MTL_TRX_LINE.ORGANIZATION_ID,:MTL_TRX_LINE.INVENTORY_ITE
M_ID) FROM DUAL))
6. Set the Context level to User and Value to
5. --Note: to simplify setup required, you can choose to set the condition context to responsibility.
This would allow you to assign a group of users to a responsibility, then the setup above would
only need completed once at the responsibility level. Otherwise this setup step would be required
for each user.
7. Click to Actions tab and define following actions -
Seq. Type Langua
ge
Message
Type
Message Text
10 Message All Show ='Maximum Expiration Date For This Lot Is :
'||':'||TO_CHAR(:MTL_TRX_LINE.TRANSACTION_DATE+((SEL
ECT
GET_ITEM_SHELF_LIFE_DAYS(:MTL_TRX_LINE.ORGANIZA
TION_ID,:MTL_TRX_LINE.INVENTORY_ITEM_ID) FROM
DUAL)))
8.Save the changes.
6. Seq. Type Language Builtin Type Argument
20 Builtin All DO_KEY CLEAR_RECORD
9.Close the Sales Order form and re-open it. Now test it.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Seq. Type Langua
ge
Message
Type
Message Text
10 Message All Show ='Maximum Expiration Date For This Lot Is :
'||':'||TO_CHAR(:HEADER.RECEIPT_DATE+ ((SELECT
GET_ITEM_SHELF_LIFE_DAYS(:RCV_TRANSACTION.TO_OR
GANIZATION_ID,:RCV_TRANSACTION.ITEM_ID) FROM
DUAL)))
1=1
AND :LOT_ENTRY.LOT_EXPIRATION_DATE>(:HEADER.RECEIPT_DATE+(SELECT
GET_ITEM_SHELF_LIFE_DAYS(:RCV_TRANSACTION.TO_ORGANIZATION_ID,:RCV_
TRANSACTION.ITEM_ID)FROM DUAL))
7. Seq. Type Langua
ge
Message
Type
Message Text
10 Message All Show ='Maximum Expiration Date For This Lot Is :
'||':'||TO_CHAR(:RCV_TRANSACTION.TRANSACTION_DATE_N
B+ ((SELECT
GET_ITEM_SHELF_LIFE_DAYS(:RCV_TRANSACTION.TO_OR
GANIZATION_ID,:RCV_TRANSACTION.ITEM_ID) FROM
DUAL)))
1=1
AND
:LOT_ENTRY.LOT_EXPIRATION_DATE>(:RCV_TRANSACTION.TRANSACTION_DAT
E_NB+(SELECT
GET_ITEM_SHELF_LIFE_DAYS(:RCV_TRANSACTION.TO_ORGANIZATION_ID,:RCV_
TRANSACTION.ITEM_ID)FROM DUAL))
Done هلل الحمد