Blame | Last modification | View Log | RSS feed
-- Haryana Gurugram is a NEW GST registration: seller 21 NSSPL-HR-GGN, GSTIN 06AACCN9802G2ZI (created 2026-10-01).-- Three physical billing warehouses under it, replacing the Delhi-GSTIN ones:-- 7720 DL-NSSPL/Delhi-HR -> HR-NSSPL/GGN (NSHRGGN) internal store HRGN1710-- 7573 DL-NSSPL/Delhi -> HR-NSSPL/DL (NSHRDL) internal store HRGN1713-- 9514 NSSPL-DL/Noida -> HR-NSSPL/UPW (NSHRUPW) internal store HRGN1714-- 7681 HR-NSSPL / seller 16 (06AACCN9802G1ZJ, Faridabad) stay untouched: their past invoices, CNs and returns-- resolve sellerwarehouse by (7681, seller 16).-- Region rows are OURS/BAD vendor 40 like 7573/7720/7681 - never GOOD/vendor 1 (Hotspot), which lookups mistake for a-- supplier child. Per-supplier G/B/THIRD_PARTY children, internal suppliers, brand mapping, warehouse_provider, internal-- store moves and the ProfitMandiConstants maps follow separately.START TRANSACTION;-- new GST address; city must be the last comma segment (WarehouseAddressMaster.getCustomAddress)INSERT INTO transaction.warehouseaddressmaster (address, pin, state_id, created, contact_number, contact_person)VALUES ('Ground Floor, Plot No. 466, Udyog Vihar Phase 5, Gurugram', '122016', 3, NOW(), '9718617332', 'Shivam Gupta');SET @addr = LAST_INSERT_ID();SET @loc = 'Ground Floor, Plot No. 466, Udyog Vihar Phase 5, Gurugram';SET @gstin = '06AACCN9802G2ZI';SET @seller = 21;-- HR-NSSPL/GGNINSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/GGN', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);SET @w = LAST_INSERT_ID();UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)VALUES (@seller, @w, 0, 0, 'NSHRGGN', 0, 0, NOW(), 1, 0, 0, 0);INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/GGN/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);-- HR-NSSPL/DLINSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/DL', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);SET @w = LAST_INSERT_ID();UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)VALUES (@seller, @w, 0, 0, 'NSHRDL', 0, 0, NOW(), 1, 0, 0, 0);INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/DL/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);-- HR-NSSPL/UPWINSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/UPW', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);SET @w = LAST_INSERT_ID();UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)VALUES (@seller, @w, 0, 0, 'NSHRUPW', 0, 0, NOW(), 1, 0, 0, 0);INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,transferDelayInHours, isAvailabilityMonitored, state_id, source)VALUES ('HR-NSSPL/UPW/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);COMMIT;-- verifySELECT w.id, w.displayName, w.inventoryType, w.vendor_id, w.billingWarehouseId, w.state_id,sw.prefix, sw.seller_id, m.address_id, a.address, a.pinFROM inventory.warehouse wLEFT JOIN transaction.sellerwarehouse sw ON sw.warehouse_id = w.idLEFT JOIN transaction.warehouseaddressmapping m ON m.warehouse_id = w.idLEFT JOIN transaction.warehouseaddressmaster a ON a.id = m.address_idWHERE w.displayName IN ('HR-NSSPL/GGN', 'HR-NSSPL/DL', 'HR-NSSPL/UPW')OR w.displayName LIKE 'HR-NSSPL/%/Dummy/G'ORDER BY w.id;