details: https://code.openbravo.com/erp/devel/pi/rev/3d244f13ed7a changeset: 32156:3d244f13ed7a user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Fri Feb 03 09:33:20 2017 +0100 summary: [w-is] Useful code extracted from initial project
Defined tables M_INVENTORYSTATUS and M_INVENTORYSTATUS_TRL at System level. details: https://code.openbravo.com/erp/devel/pi/rev/88a6f88c3aa9 changeset: 32157:88a6f88c3aa9 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Mar 10 12:25:20 2017 +0100 summary: [w-is] Adds ModuleScript to set the correct Inventory Status for each Client depending on the Client Information configuration. details: https://code.openbravo.com/erp/devel/pi/rev/8ae07a64dfb4 changeset: 32158:8ae07a64dfb4 user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu Feb 16 18:33:17 2017 +0100 summary: [w-is] Adapt flows to use Available and Nettable flags. * Created new function m_get_stock_param1 that has this flags as parameters * Modified m_get_stock and m_get_stock_param to call this function * Modified calls to m_get_stock_param to use new function instead details: https://code.openbravo.com/erp/devel/pi/rev/3c6461d46312 changeset: 32159:3c6461d46312 user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon Mar 13 09:37:06 2017 +0100 summary: [w-is] Modified M_GET_STOCK_PARARM1 to correctly retrieve Inventory Status from M_Locator table. details: https://code.openbravo.com/erp/devel/pi/rev/48fee800d139 changeset: 32160:48fee800d139 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Feb 17 10:27:33 2017 +0100 summary: [w-is] Fixed wrong parameter name in M_GET_STOCK_PARAM1 and also rearranged parameters in that function. details: https://code.openbravo.com/erp/devel/pi/rev/8de517c808a8 changeset: 32161:8de517c808a8 user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon Mar 13 18:22:11 2017 +0100 summary: [w-is] Fixes wrong check in Inventory Status. When the Client Info flag is not enabled, the Status must be one that does not have the OverIssue flag enabled. details: https://code.openbravo.com/erp/devel/pi/rev/8b159751dcb2 changeset: 32162:8b159751dcb2 user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 15 17:48:33 2017 +0100 summary: [w-is] Support for OverIssue flag. Instead of using allowNegativeStock flag present in AD_Client_Info table it looks into the overIssue flag of the Inventory Status of the Locator. details: https://code.openbravo.com/erp/devel/pi/rev/c4338943719f changeset: 32163:c4338943719f user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 15 17:52:06 2017 +0100 summary: [w-is] Fixes problems in Oracle related to M_GET_STOCK_PARAM * Removed M_GET_STOCK_PARAM1 function, instead, M_GET_STOCK_PARAM has optional parameters * Fixed calls to M_GET_STOCK_PARAM1 to call M_GET_STOCK_PARAM instead * Fixed problems in M_INVENTORYSTATUS_TRG in Oracle details: https://code.openbravo.com/erp/devel/pi/rev/a6a8e425fec8 changeset: 32164:a6a8e425fec8 user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu Mar 16 16:04:41 2017 +0100 summary: [w-is] Fixes several issues: * Fixes missing column in group by clause in M_INOUT_CREATE * Adds missing index in M_INVENTORYSTATUS_TRL * Adds lines before comment in M_INVENTORYSTATUS_TRG due to problems while exporting in Oracle * Fixes call to M_GET_STOCK in StockUtils. details: https://code.openbravo.com/erp/devel/pi/rev/9fac2602448a changeset: 32165:9fac2602448a user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon Mar 20 12:44:02 2017 +0100 summary: [w-is] Deactivates allowNegativeStock flag at Client Information Level. This functionality is now controlled through Inventory Status and OverIssue flag. details: https://code.openbravo.com/erp/devel/pi/rev/7e9e14212ff7 changeset: 32166:7e9e14212ff7 user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 22 09:15:35 2017 +0100 summary: [w-is] Adds button to change Status of Locator * Adds Hook to validate Inventory Status change * Adds Hook implementation to valide Inventory Status change with negative stock details: https://code.openbravo.com/erp/devel/pi/rev/f840f08b67ec changeset: 32167:f840f08b67ec user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 22 11:28:38 2017 +0100 summary: [w-is] Adds Inventory Status column in Manage Reservations PickAndEdit * Supports both filtering and sorting * Records are filtering by Inventory Status, only those ones with Available flag checked are shown. details: https://code.openbravo.com/erp/devel/pi/rev/a8253f3e8f4c changeset: 32168:a8253f3e8f4c user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 22 12:49:54 2017 +0100 summary: [w-is] Adds validation to check if there is Stock with reservations in the Locator that is going to change it's Inventory Status. If so, it shows a Warning to the user. details: https://code.openbravo.com/erp/devel/pi/rev/a4eb23f0c066 changeset: 32169:a4eb23f0c066 user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 22 18:30:27 2017 +0100 summary: [w-is] Adds missing Message entry details: https://code.openbravo.com/erp/devel/pi/rev/4bf8da1f0b7e changeset: 32170:4bf8da1f0b7e user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 05 13:54:30 2017 +0200 summary: [w-is] Adds Virtual Bin fields/columns in locator table. * Adds virtual bin flag and parent locator column * Adds indexes for columns that can be null * This allows to automate the creation of virtual bins for changing status details: https://code.openbravo.com/erp/devel/pi/rev/1ef59f4ba57b changeset: 32171:1ef59f4ba57b user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon Mar 27 16:40:50 2017 +0200 summary: [w-is] Changed Hook in Inventory Status validation to launch it a Storage Detail level * Before this hook was launched at Locator level * Adapted hoooks to support this change * Added Inventory Status to unicity constraint details: https://code.openbravo.com/erp/devel/pi/rev/811b8ff4d616 changeset: 32172:811b8ff4d616 user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon Mar 27 18:23:15 2017 +0200 summary: [w-is] Allows to modify the Inventory Status of a Storage Bin through the drop down list, but only when it is being created the first time, afterwards it must be changed from the change status button. details: https://code.openbravo.com/erp/devel/pi/rev/6f32780a5033 changeset: 32173:6f32780a5033 user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu Mar 30 17:55:49 2017 +0200 summary: [w-is] Adds unique index instead of unique constraint due to possible null values in parent_locator column details: https://code.openbravo.com/erp/devel/pi/rev/c3c5f2d88201 changeset: 32174:c3c5f2d88201 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Mar 31 12:29:22 2017 +0200 summary: [w-is] Fixes definition of unique index and adds new Inventory Status details: https://code.openbravo.com/erp/devel/pi/rev/d20f1945f704 changeset: 32175:d20f1945f704 user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Apr 05 16:36:37 2017 +0200 summary: [w-is] Fixes wrong definition of unique index details: https://code.openbravo.com/erp/devel/pi/rev/a1820873c79f changeset: 32176:a1820873c79f user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Apr 05 19:17:03 2017 +0200 summary: [w-is] Fixes done to Change Inventory Status button * Not shown for virtual bins * Not possible to change the status of a virtual bin details: https://code.openbravo.com/erp/devel/pi/rev/b3de24444d71 changeset: 32177:b3de24444d71 user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu Apr 06 17:49:11 2017 +0200 summary: [w-is] Allows to change Status from a negative Inventory Status to another negative Inventory Status details: https://code.openbravo.com/erp/devel/pi/rev/1f465ac8b90e changeset: 32178:1f465ac8b90e user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu Apr 06 17:49:45 2017 +0200 summary: [w-is] Adds method in reservation utils to retrieve the list of associated Reservation Stock from a Storage Detail details: https://code.openbravo.com/erp/devel/pi/rev/5178536e2865 changeset: 32179:5178536e2865 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Apr 07 10:18:01 2017 +0200 summary: [w-is] Fixes several problems * Inventory Status field in Reservations Pick And Edit is readonly * Sales Order Line is no longer an identifier of a reservation, because it should allow to have null values * Changed Inventory Status's names details: https://code.openbravo.com/erp/devel/pi/rev/e5361b455993 changeset: 32180:e5361b455993 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Apr 07 12:19:23 2017 +0200 summary: [w-is] Changed message for error while modifying Inventory Status due to an existing Reservation Stock details: https://code.openbravo.com/erp/devel/pi/rev/094c025e0735 changeset: 32181:094c025e0735 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Apr 07 13:27:39 2017 +0200 summary: [w-is] Do not allow to ship Stock when it belongs to a Storage Bin that has an Inventory Status defined as not available. details: https://code.openbravo.com/erp/devel/pi/rev/f9d55b3c01ca changeset: 32182:f9d55b3c01ca user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Apr 14 17:08:49 2017 +0200 summary: [w-is] Adds Inventory Status Utils class with methods from other classes grouped into the same class details: https://code.openbravo.com/erp/devel/pi/rev/f07f14ecf882 changeset: 32183:f07f14ecf882 user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu May 11 08:47:24 2017 +0200 summary: [w-is] Changes done in unqiue index for location in M_LOCATOR. * Created two partial indexes depending on the parent_id column details: https://code.openbravo.com/erp/devel/pi/rev/c2d66ac466cc changeset: 32184:c2d66ac466cc user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu May 18 13:33:00 2017 +0200 summary: [w-is] Add extra method in Inventory Status utils to manage Status change details: https://code.openbravo.com/erp/devel/pi/rev/eb1cea50809f changeset: 32185:eb1cea50809f user: David Miguelez <david.miguelez <at> openbravo.com> date: Thu May 18 13:34:03 2017 +0200 summary: [w-is] Adds automated tests for Inventory Status. * Adds Test Cases * Adds Test Cases in AllAntTasksTests Suite * Adds needed data in QA Testing Client details: https://code.openbravo.com/erp/devel/pi/rev/50528ff0264e changeset: 32186:50528ff0264e user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:14:42 2017 +0200 summary: [w-is] Adds missing class files for moduleScript details: https://code.openbravo.com/erp/devel/pi/rev/fffc6f86f4e5 changeset: 32187:fffc6f86f4e5 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:16:59 2017 +0200 summary: [w-is] Updates license years details: https://code.openbravo.com/erp/devel/pi/rev/5f80d71920b4 changeset: 32188:5f80d71920b4 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:18:00 2017 +0200 summary: [w-is] Updates definition of PL's to use optional parameters. Updates license years details: https://code.openbravo.com/erp/devel/pi/rev/364ff26e2291 changeset: 32189:364ff26e2291 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:18:24 2017 +0200 summary: [w-is] Extracts code into functions to improve redability in Inventory Status Utils details: https://code.openbravo.com/erp/devel/pi/rev/b23443ffc58a changeset: 32190:b23443ffc58a user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:18:49 2017 +0200 summary: [w-is] Updated Inventory Status Tests to create Reservations preference if it does not exist in the system details: https://code.openbravo.com/erp/devel/pi/rev/6e3acc76438a changeset: 32191:6e3acc76438a user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 12:32:16 2017 +0200 summary: [w-is] Adds missing save statemente in Inventory Status Tests while creating the Reservation Preference details: https://code.openbravo.com/erp/devel/pi/rev/7167bb1912a8 changeset: 32192:7167bb1912a8 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri May 19 13:58:47 2017 +0200 summary: [w-is] Fixes problem in m_inout_post Do only check the inventory status for outgoing transactions, not for incoming ones. details: https://code.openbravo.com/erp/devel/pi/rev/e2be773acc43 changeset: 32193:e2be773acc43 user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon May 22 12:16:25 2017 +0200 summary: [w-is] Fixes issue in M_Get_Stock_Param that was not correctly filtering data for MRP details: https://code.openbravo.com/erp/devel/pi/rev/61e19fd983fe changeset: 32194:61e19fd983fe user: David Miguelez <david.miguelez <at> openbravo.com> date: Mon May 22 18:20:11 2017 +0200 summary: [w-is] Fixes problem in Oracle in Automated Tests. Since value property of ad_prefernce table is defined as clob it is necessary to cast it to a char before comparing it details: https://code.openbravo.com/erp/devel/pi/rev/abbe8dd3d014 changeset: 32195:abbe8dd3d014 user: David Miguelez <david.miguelez <at> openbravo.com> date: Tue May 23 11:28:22 2017 +0200 summary: [w-is] Adds index to m_inventorystatus_id column in m_locator table details: https://code.openbravo.com/erp/devel/pi/rev/206e7c381606 changeset: 32196:206e7c381606 user: David Miguelez <david.miguelez <at> openbravo.com> date: Tue May 23 11:28:57 2017 +0200 summary: [w-is] Updated Modulescript * Removed unnecessary preference creation and check * Updated version of core up till which it must be executed details: https://code.openbravo.com/erp/devel/pi/rev/c35adfa1187a changeset: 32197:c35adfa1187a user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed May 24 10:24:12 2017 +0200 summary: Fixes Issue 36078. Adds M_Reservation, M_Reservation_Stock and M_Product_AUM tables in the Client dataset to export the information of the tables in the ant export.sample.data task diffstat: referencedata/sampledata/QA_Testing/M_RESERVATION.xml | 23 + referencedata/sampledata/QA_Testing/M_RESERVATION_STOCK.xml | 20 + src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml | 46 +- src-db/database/model/functions/MRP_RUN_INITIALIZE.xml | 4 +- src-db/database/model/functions/M_CHECK_STOCK.xml | 38 +- src-db/database/model/functions/M_GET_STOCK.xml | 16 +- src-db/database/model/functions/M_GET_STOCK_PARAM.xml | 56 +- src-db/database/model/functions/M_INOUT_CREATE.xml | 59 +- src-db/database/model/functions/M_INOUT_POST.xml | 20 + src-db/database/model/functions/M_MOVEMENT_POST.xml | 19 +- src-db/database/model/functions/M_PRODUCTION_RUN.xml | 61 +- src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml | 4 +- src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml | 4 +- src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE_PARAM.xml | 11 +- src-db/database/model/functions/M_UNIQUELOCATOR_RULE_PARAM.xml | 11 +- src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE_PARAM.xml | 11 +- src-db/database/model/tables/M_INVENTORYSTATUS.xml | 87 + src-db/database/model/tables/M_INVENTORYSTATUS_TRL.xml | 73 + src-db/database/model/tables/M_LOCATOR.xml | 58 +- src-db/database/model/triggers/M_INVENTORYSTATUS_TRG.xml | 68 + src-db/database/sourcedata/AD_AUXILIARINPUT.xml | 11 + src-db/database/sourcedata/AD_COLUMN.xml | 1236 +++++++++- src-db/database/sourcedata/AD_DATASET_TABLE.xml | 70 + src-db/database/sourcedata/AD_ELEMENT.xml | 100 +- src-db/database/sourcedata/AD_FIELD.xml | 672 +++++- src-db/database/sourcedata/AD_MENU.xml | 14 + src-db/database/sourcedata/AD_MESSAGE.xml | 84 + src-db/database/sourcedata/AD_REFERENCE.xml | 12 + src-db/database/sourcedata/AD_TAB.xml | 70 +- src-db/database/sourcedata/AD_TABLE.xml | 49 + src-db/database/sourcedata/AD_TREENODE.xml | 65 +- src-db/database/sourcedata/AD_WINDOW.xml | 17 + src-db/database/sourcedata/M_INVENTORYSTATUS.xml | 124 + src-db/database/sourcedata/OBUIAPP_PARAMETER.xml | 26 + src-db/database/sourcedata/OBUIAPP_PROCESS.xml | 20 + src-db/database/sourcedata/OBUISEL_SELECTOR.xml | 16 + src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml | 82 + src-test/src/org/openbravo/test/AllAntTaskTests.java | 4 + src-test/src/org/openbravo/test/inventoryStatus/InventoryStatusTest.java | 999 ++++++++ src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeInventoryStatus.class | 0 src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeInventoryStatusData.class | 0 src-util/modulescript/src/org/openbravo/modulescript/InitializeInventoryStatus.java | 51 + src-util/modulescript/src/org/openbravo/modulescript/InitializeInventoryStatus_data.xsql | 52 + src/org/openbravo/common/actionhandler/ChangeInventoryStatusActionHandler.java | 60 + src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java | 159 +- src/org/openbravo/common/hooks/InventoryStatusHookManager.java | 48 + src/org/openbravo/common/hooks/InventoryStatusValidationHook.java | 56 + src/org/openbravo/common/hooks/InventoryStatusValidationHookReservations.java | 44 + src/org/openbravo/common/hooks/InventoryStatusValidatorHookNegativeStock.java | 49 + src/org/openbravo/costing/CostingUtils.java | 44 +- src/org/openbravo/erpCommon/ad_actionButton/ProcessGoods.java | 7 +- src/org/openbravo/erpCommon/utility/InventoryStatusUtils.java | 129 + src/org/openbravo/materialmgmt/InventoryCountProcess.java | 13 +- src/org/openbravo/materialmgmt/ReservationUtils.java | 62 +- src/org/openbravo/materialmgmt/StockUtils.java | 23 +- src/org/openbravo/materialmgmt/StockUtils_data.xsql | 8 +- 56 files changed, 5003 insertions(+), 162 deletions(-) diffs (truncated from 7109 to 300 lines): diff -r 42059137939c -r c35adfa1187a referencedata/sampledata/QA_Testing/M_RESERVATION.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/referencedata/sampledata/QA_Testing/M_RESERVATION.xml Wed May 24 10:24:12 2017 +0200 @@ -0,0 +1,23 @@ +<?xml version='1.0' encoding='UTF-8'?> +<data> +<M_RESERVATION> + <M_RESERVATION_ID><![CDATA[82E3163AD14F4182B9F1292D5EACF7D4]]></M_RESERVATION_ID> + <AD_CLIENT_ID><![CDATA[4028E6C72959682B01295A070852010D]]></AD_CLIENT_ID> + <AD_ORG_ID><![CDATA[5EFF95EB540740A3B10510D9814EFAD5]]></AD_ORG_ID> + <ISACTIVE><![CDATA[Y]]></ISACTIVE> + <CREATED><![CDATA[2017-05-17 12:10:54.715]]></CREATED> + <CREATEDBY><![CDATA[100]]></CREATEDBY> + <UPDATED><![CDATA[2017-05-17 12:11:08.0]]></UPDATED> + <UPDATEDBY><![CDATA[100]]></UPDATEDBY> + <M_PRODUCT_ID><![CDATA[4028E6C72959682B01295ADC211E0237]]></M_PRODUCT_ID> + <QUANTITY><![CDATA[1]]></QUANTITY> + <C_UOM_ID><![CDATA[4028E6C72959682B01295ADC1A380221]]></C_UOM_ID> + <RESERVEDQTY><![CDATA[1]]></RESERVEDQTY> + <RELEASEDQTY><![CDATA[0]]></RELEASEDQTY> + <RES_STATUS><![CDATA[CO]]></RES_STATUS> + <RES_PROCESS><![CDATA[HO]]></RES_PROCESS> + <MANAGERESERVATION_PE><![CDATA[N]]></MANAGERESERVATION_PE> + <RESERVEDGOODMNT_PE><![CDATA[N]]></RESERVEDGOODMNT_PE> +</M_RESERVATION> + +</data> diff -r 42059137939c -r c35adfa1187a referencedata/sampledata/QA_Testing/M_RESERVATION_STOCK.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/referencedata/sampledata/QA_Testing/M_RESERVATION_STOCK.xml Wed May 24 10:24:12 2017 +0200 @@ -0,0 +1,20 @@ +<?xml version='1.0' encoding='UTF-8'?> +<data> +<M_RESERVATION_STOCK> + <M_RESERVATION_STOCK_ID><![CDATA[4B48280F5CB24729BC8C74613081A96F]]></M_RESERVATION_STOCK_ID> + <AD_CLIENT_ID><![CDATA[4028E6C72959682B01295A070852010D]]></AD_CLIENT_ID> + <AD_ORG_ID><![CDATA[5EFF95EB540740A3B10510D9814EFAD5]]></AD_ORG_ID> + <ISACTIVE><![CDATA[Y]]></ISACTIVE> + <CREATED><![CDATA[2017-05-17 12:11:04.795]]></CREATED> + <CREATEDBY><![CDATA[100]]></CREATEDBY> + <UPDATED><![CDATA[2017-05-17 12:11:04.795]]></UPDATED> + <UPDATEDBY><![CDATA[100]]></UPDATEDBY> + <M_RESERVATION_ID><![CDATA[82E3163AD14F4182B9F1292D5EACF7D4]]></M_RESERVATION_ID> + <QUANTITY><![CDATA[1]]></QUANTITY> + <ISALLOCATED><![CDATA[N]]></ISALLOCATED> + <M_LOCATOR_ID><![CDATA[4028E6C72959682B01295ECFE4E50273]]></M_LOCATOR_ID> + <M_ATTRIBUTESETINSTANCE_ID><![CDATA[0]]></M_ATTRIBUTESETINSTANCE_ID> + <RELEASEDQTY><![CDATA[0]]></RELEASEDQTY> +</M_RESERVATION_STOCK> + +</data> diff -r 42059137939c -r c35adfa1187a src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml --- a/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml Wed May 24 10:39:33 2017 +0200 +++ b/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml Wed May 24 10:24:12 2017 +0200 @@ -16,7 +16,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU -* All portions are Copyright (C) 2001-2016 Openbravo SLU +* All portions are Copyright (C) 2001-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************/ @@ -56,12 +56,13 @@ v_UseStdPrecisionInProduction CHAR(1); v_PlanLine NUMBER; v_CostCenterUse NUMBER; - v_allownegativestock CHAR(1); v_Calculated CHAR(1); v_ByDefault CHAR(1); v_PendingQty NUMBER; v_InsertQty NUMBER; v_AD_Pinstance_ID VARCHAR2(32); + v_NegStockLocator VARCHAR2(32); + v_NegStockWarehosue VARCHAR2(32); -- Toolset Types to process Cur_ToolsetProcess RECORD; -- WRPhase products created @@ -74,11 +75,13 @@ CURSOR Cur_Stock (v_AD_Pinstance_ID VARCHAR)IS SELECT T.M_PRODUCT_ID, T.C_UOM_ID, T.M_LOCATOR_ID, T.M_ATTRIBUTESETINSTANCE_ID, T.M_PRODUCT_UOM_ID, MS.QUANTITY AS Qty, MS.QTYORDER AS QtyOrder, - U.STDPRECISION, MS.PRIORITY + U.STDPRECISION, MS.PRIORITY, INVS.OVERISSUE FROM M_STOCK_PROPOSED MS LEFT JOIN M_STORAGE_DETAIL T ON MS.M_STORAGE_DETAIL_ID = T.M_STORAGE_DETAIL_ID LEFT JOIN M_PRODUCT_UOM PU ON T.M_PRODUCT_UOM_ID = PU.M_PRODUCT_UOM_ID LEFT JOIN C_UOM U ON PU.C_UOM_ID = U.C_UOM_ID + JOIN M_LOCATOR L ON L.M_LOCATOR_ID = T.M_LOCATOR_ID + JOIN M_INVENTORYSTATUS INVS ON INVS.M_INVENTORYSTATUS_ID = L.M_INVENTORYSTATUS_ID WHERE MS.AD_PINSTANCE_ID = v_AD_Pinstance_ID ORDER BY MS.PRIORITY; v_storage CUR_STOCK%ROWTYPE; @@ -108,10 +111,6 @@ DBMS_OUTPUT.PUT_LINE('--<<MA_ProductionRun_Standard>>') ; END IF; BEGIN --BODY - SELECT ad_clientinfo.allownegativestock - INTO v_allownegativestock - FROM ad_clientinfo - WHERE ad_clientinfo.ad_client_id = v_Client_ID; v_ResultStr:='Getting DoneQuantity and process_ID'; SELECT M_ProductionPlan.AD_Org_ID, M_ProductionPlan.MA_WRPhase_ID, @@ -296,6 +295,7 @@ -- Get StdPrecision for Uom of product to be used in Production Line SELECT StdPrecision, UseinProduction INTO v_StdPrecision, v_UseStdPrecisionInProduction FROM C_Uom WHERE C_Uom_ID = Cur_WRPUsed.C_Uom_ID; + IF (Cur_WRPUsed.IsStocked='Y') THEN v_QtyAcumulated:=0; IF (NOT Cur_Stock_ISOPEN) OR (v_Product_old<>Cur_WRPUsed.M_Product_ID OR v_UOM_old<>Cur_WRPUsed.C_UOM_ID) THEN @@ -326,7 +326,7 @@ END; --Review no warehouse as parameter - M_GET_STOCK_PARAM(v_AD_Pinstance_ID, v_Record_ID, v_DoneQuantity*Cur_WRPUsed.MovementQty, v_Product_old, null, null, null, v_PlanOrg_ID, null, v_User_ID, v_Client_ID, v_warehouse_rule_id, v_UOM_old, v_Product_UOM_old, '325', v_Production_ID, v_PlanLine, '800105', null, 'N', v_pinstance_result, v_pinstance_msg); + M_GET_STOCK_PARAM(v_AD_Pinstance_ID, v_Record_ID, v_DoneQuantity*Cur_WRPUsed.MovementQty, v_Product_old, null, null, null, v_PlanOrg_ID, null, v_User_ID, v_Client_ID, v_warehouse_rule_id, v_UOM_old, v_Product_UOM_old, '325', v_Production_ID, v_PlanLine, '800105', null, 'N', v_pinstance_result, v_pinstance_msg, 'Y', null, null); -- Check result BEGIN @@ -357,6 +357,9 @@ END IF; IF (NOT NEXT_PRODUCT) THEN LOOP + IF (v_storage.OVERISSUE = 'Y' AND v_NegStockLocator IS NULL) THEN + v_NegStockLocator:= v_storage.m_locator_id; + END IF; v_Qty:=LEAST(v_QtyStorage, v_DoneQuantity*Cur_WRPUsed.MovementQty - v_QtyAcumulated) ; v_QtyStorage:=v_QtyStorage - v_Qty; v_QtyAcumulated:=v_QtyAcumulated + v_Qty; @@ -430,7 +433,28 @@ END LOOP; END IF; --NEXT_PRODUCT IF (v_QtyAcumulated < v_DoneQuantity*Cur_WRPUsed.MovementQty) THEN - IF (v_allownegativestock = 'Y') THEN + IF (v_NegStockLocator IS NULL) THEN + -- Get Locator with negative Stock that belongs to the same Warehosue + SELECT m_warehouse_id + INTO v_NegStockWarehosue + FROM m_locator + WHERE m_locator_id = Cur_WRPUsed.m_locator_id; + + SELECT MIN(l.m_locator_id) + INTO v_NegStockLocator + FROM m_locator l + JOIN m_inventorystatus invs ON l.m_inventorystatus_id = invs.m_inventorystatus_id + WHERE l.m_warehouse_id = v_NegStockWarehosue + AND invs.overissue = 'Y' + AND l.isactive= 'Y' + AND priorityno = (SELECT MIN(priorityno) + FROM m_locator l + JOIN m_inventorystatus invs ON l.m_inventorystatus_id = invs.m_inventorystatus_id + WHERE l.m_warehouse_id = v_NegStockWarehosue + AND invs.overissue = 'Y' + AND l.isactive='Y'); + END IF; + IF (v_NegStockLocator IS NOT NULL) THEN IF (v_GlobalUse='Y') THEN SELECT count(*) INTO v_Count @@ -447,7 +471,7 @@ GET_UUID(), Cur_WRPUsed.M_Production_ID, Cur_WRPUsed.Client_ID, Cur_WRPUsed.Org_ID, 'Y', now(), v_User_ID, now(), v_User_ID, Cur_WRPUsed.M_Product_ID, Cur_WRPUsed.C_UOM_ID, 0, - Cur_WRPUsed.M_Locator_ID + v_NegStockLocator ); END IF; ELSE @@ -462,7 +486,7 @@ GET_UUID(), v_Record_ID, v_Line, Cur_WRPUsed.Client_ID, Cur_WRPUsed.Org_ID, 'Y', now(), v_User_ID, now(), v_User_ID, Cur_WRPUsed.M_Product_ID, CASE WHEN v_UseStdPrecisionInProduction = 'Y' THEN ROUND(( CASE v_NoQty WHEN 'Y' THEN 0 ELSE v_DoneQuantity*Cur_WRPUsed.MovementQty - v_QtyAcumulated END),v_StdPrecision) ELSE ( CASE v_NoQty WHEN 'Y' THEN 0 ELSE v_DoneQuantity*Cur_WRPUsed.MovementQty - v_QtyAcumulated END) END, - '-', Cur_WRPUsed.C_UOM_ID, Cur_WRPUsed.M_Locator_ID, Cur_WRPUsed.M_Product_UOM_ID, Cur_WRPUsed.QuantityOrder, + '-', Cur_WRPUsed.C_UOM_ID, v_NegStockLocator, Cur_WRPUsed.M_Product_UOM_ID, Cur_WRPUsed.QuantityOrder, Cur_WRPUsed.MA_WRPhaseProduct_ID ); END IF; diff -r 42059137939c -r c35adfa1187a src-db/database/model/functions/MRP_RUN_INITIALIZE.xml --- a/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml Wed May 24 10:39:33 2017 +0200 +++ b/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml Wed May 24 10:24:12 2017 +0200 @@ -52,7 +52,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU -* All portions are Copyright (C) 2001-2016 Openbravo SLU +* All portions are Copyright (C) 2001-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************/ @@ -180,7 +180,7 @@ BEGIN v_ad_pinstance_id := GET_UUID(); - M_GET_STOCK_PARAM(v_ad_pinstance_id, p_run, null, Cur_Product.M_Product_ID, null, null, null, p_org_id, null, p_user_id, p_client_id, null, null, null, '800219', p_Run, null, case when p_production = 'Y' then '800162' else '800164' end, null, 'N', v_pinstance_result, v_pinstance_msg); + M_GET_STOCK_PARAM(v_ad_pinstance_id, p_run, null, Cur_Product.M_Product_ID, null, null, null, p_org_id, null, p_user_id, p_client_id, null, null, null, '800219', p_Run, null, case when p_production = 'Y' then '800162' else '800164' end, null, 'N', v_pinstance_result, v_pinstance_msg, null, 'Y', null); -- Check result IF (v_pinstance_result = 0) THEN -- Error on m_get_stock diff -r 42059137939c -r c35adfa1187a src-db/database/model/functions/M_CHECK_STOCK.xml --- a/src-db/database/model/functions/M_CHECK_STOCK.xml Wed May 24 10:39:33 2017 +0200 +++ b/src-db/database/model/functions/M_CHECK_STOCK.xml Wed May 24 10:24:12 2017 +0200 @@ -28,37 +28,33 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU -* All portions are Copyright (C) 2001-2014 Openbravo SLU +* All portions are Copyright (C) 2001-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************/ v_ResultStr VARCHAR2(2000):=''; v_ExistsNegativeStock NUMBER; - v_AllowsNegativeStock CHAR:='N'; BEGIN v_ResultStr:='Checking stock'; p_Result:=1; - SELECT ALLOWNEGATIVESTOCK - INTO v_AllowsNegativeStock - FROM AD_CLIENTINFO - WHERE AD_CLIENT_ID=p_AD_Client_ID; - IF v_AllowsNegativeStock='N' THEN - SELECT count(1) - INTO v_ExistsNegativeStock - FROM DUAL - WHERE EXISTS - ( SELECT 1 - FROM M_STORAGE_DETAIL + SELECT count(1) + INTO v_ExistsNegativeStock + FROM DUAL + WHERE EXISTS + ( SELECT 1 + FROM M_STORAGE_DETAIL SD + JOIN M_LOCATOR L ON (L.M_LOCATOR_ID = SD.M_LOCATOR_ID) + JOIN M_INVENTORYSTATUS INVS ON (INVS.M_INVENTORYSTATUS_ID = L.M_INVENTORYSTATUS_ID) WHERE M_PRODUCT_ID=p_M_Product_ID - AND AD_CLIENT_ID=p_AD_Client_ID - AND AD_ORG_ID=p_AD_Org_ID - AND (QTYONHAND<0 OR COALESCE(QTYORDERONHAND,0)<0)); - IF(v_ExistsNegativeStock <> 0) THEN - p_Result:=0; - p_Message:='@NotEnoughStocked@'; - END IF; + AND SD.AD_CLIENT_ID=p_AD_Client_ID + AND SD.AD_ORG_ID=p_AD_Org_ID + AND (QTYONHAND<0 OR COALESCE(QTYORDERONHAND,0)<0) + AND INVS.OVERISSUE='N'); + IF(v_ExistsNegativeStock <> 0) THEN + p_Result:=0; + p_Message:='@NotEnoughStocked@'; END IF; - RETURN; +RETURN; EXCEPTION WHEN OTHERS THEN v_ResultStr:= '@ERROR=' || SQLERRM; diff -r 42059137939c -r c35adfa1187a src-db/database/model/functions/M_GET_STOCK.xml --- a/src-db/database/model/functions/M_GET_STOCK.xml Wed May 24 10:39:33 2017 +0200 +++ b/src-db/database/model/functions/M_GET_STOCK.xml Wed May 24 10:24:12 2017 +0200 @@ -19,7 +19,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU -* All portions are Copyright (C) 2011-2016 Openbravo SLU +* All portions are Copyright (C) 2011-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************/ @@ -51,6 +51,9 @@ v_LineNo NUMBER; v_ProcessID VARCHAR2(32) ; v_Reservation_ID VARCHAR2(32); + v_avail CHAR; + v_nett CHAR; + v_overissue CHAR; BEGIN -- Update AD_PInstance @@ -119,13 +122,22 @@ ELSIF (Cur_Parameter.ParameterName = 'M_Reservation_ID') THEN v_reservation_id:=Cur_Parameter.P_String; DBMS_OUTPUT.PUT_LINE(' M_Reservation_ID=' || v_reservation_id); + ELSIF (Cur_Parameter.ParameterName = 'Available') THEN + v_avail:=Cur_Parameter.P_String; + DBMS_OUTPUT.PUT_LINE(' v_avail=' || v_avail); + ELSIF (Cur_Parameter.ParameterName = 'Nettable') THEN + v_nett:=Cur_Parameter.P_String; + DBMS_OUTPUT.PUT_LINE(' v_nett=' || v_nett); + ELSIF (Cur_Parameter.ParameterName = 'OverIssue') THEN + v_overissue:=Cur_Parameter.P_String; + DBMS_OUTPUT.PUT_LINE(' v_overissue=' || v_overissue); ELSE DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ; END IF; END LOOP; -- Get Parameter DBMS_OUTPUT.PUT_LINE(' Record_ID=' || v_Record_ID) ; - M_GET_STOCK_PARAM(PInstance_ID, v_Record_ID, v_Quantity, v_ProductID, v_LocatorID, v_WarehouseID, v_PriorityWarehouseID, v_OrgID, v_AttributesetinstanceID, v_AD_User_ID, v_ClientID, v_warehouse_rule_id, v_UomID, v_ProductUomID, v_TableID, v_AuxID, v_LineNo, v_ProcessID, v_reservation_id, p_calledfromapp, v_result, v_Message); ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits