- INC_ENDPOINT = "og/src/main/php/com/birchbox/og/cli/dotcom/DotcomCLI.php" (by post_inventory_increment)
- DEC_ENDPOINT = "_birchboxadmin/logistics/decrement_inventorycountCLI.php"(by post_inventory_decrement)
- tools server:
ohl_item_master - https://{tools-server}/api/ohl_item_master
rc-file-importer - https://{tools-server}/api/rc-file-importer - erp_integration: etl_pass.py
- DME:
./run.sh us (-s) -t CSH****
og_dotcom_inventory_incrementer_enabled is true.
etl_pass_enabled is true.
This is a php script. Code can be found here.
- If being passed file is a shipment file(CSH), DotcomCLI splits file by orderIncrementId then calls importShipmentTsv().
Then for each splitted shipment file, group items by tracking number.
if order is warehouse order(start with 'ws'/'WS'), callshipWarehouseOrderItems
. Otherwise, callshipMagentoOrderItems
. - Otherwise it calls importTSV()
In general, the script is a file parser. It pulls files from warehouse ftp server and parse them. Then update data accordingly. There are 4 types of files which the script is now dealing with:
Receipt(RC):
- Post RC to tools server (https://{tools-server}/api/rc-file-importer)
- Upload with dnrs list (don’t reconcile) (Note: 1-3 have been built in bbop)
- Find dnrs
- Create RC_tmp.csv
- post_inventory_increment(RC_tmp.csv)
php DotcomCLI.php RC_tmp.csv
Since this is not a ship file(CSH/FSH), it goes to importTSV() and then call importDailyReceiptTSV method
Parse tsv rows into DotcomDailyReceipt.thrift.
Get product id, item stock quantity increment
Get item stock old quantity from magento
Update new stock quantity - call_etl_pass():
/usr/bin/python etl_pass.py
in erp_integration
Shipment(SH):
-
Split ship file into three files(fz_file_name, bb_file_name, ss_file_name)
(Note: it checks if each line in file starting with ‘BB’ or ’bb’, ‘SS’ or ‘ss’ and rest are fz)- fz_file_name -> process_full_size()
Internally, it first calls post_inventory_increment()
Then load_gwpsselect ce.entity_id from catalog_product_entity ce join salesrule_coupon sc on sc.code = ce.sku order by ce.entity_id
find all the lines that do not matech with gwps and then append them into remove_gwp array
Finally it calls post_inventory_increment again with data = remove_gwppost_inventory_increment(file_name, data=remove_gwp)
- bb_file_name
-> call_dotcom_run (DME)./run.sh us -t CSH****
-> call_etl_pass() - ss_file_name
-> call_dotcom_run (DME and is_special = True)./run.sh us -s -t CSH****
-> call_etl_pass()
Note: in bbop, we have some imcompleted logic.
- fz_file_name -> process_full_size()
Adjustment(ADJ):
- Chane dir to /usr/local/birchbox/python/InventoryAdjuster
- Run
python inventoryadjuster.py -n {file_path}
code here
inventoryadjuster.py is here - Since we passed arg -n, it assumes file is 947
- Find dnrs list (don't reconcile) and filter out any product listed in dnrs.
- Check entries based on inventory status
If FROM/TO status is RH(receipt hold) ignore
If FROM is AV(Available) and TO is not AV, delta *= -1(subtract quantity from AV inventory) - Put filtered data entries into two array(inc_data and dec_data). (Note: when we append entry into array, actually delta would be reversed to positive.)
- Write inc_data into tmp csv and post_inventory_increment
- Write dec_data into tmp csv and post_inventory_decrement
- call_etl_pass()
Birchbox_Item_Master(BBX):
- Call post_item_master()
this actually post request to tools server endpoint
https://{tools-server}/api/ohl_item_master data: {'ohlfile':file}