Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
37822 amit 1
-- Haryana Gurugram is a NEW GST registration: seller 21 NSSPL-HR-GGN, GSTIN 06AACCN9802G2ZI (created 2026-10-01).
2
-- Three physical billing warehouses under it, replacing the Delhi-GSTIN ones:
3
--   7720 DL-NSSPL/Delhi-HR -> HR-NSSPL/GGN  (NSHRGGN)  internal store HRGN1710
4
--   7573 DL-NSSPL/Delhi    -> HR-NSSPL/DL   (NSHRDL)   internal store HRGN1713
5
--   9514 NSSPL-DL/Noida    -> HR-NSSPL/UPW  (NSHRUPW)  internal store HRGN1714
6
-- 7681 HR-NSSPL / seller 16 (06AACCN9802G1ZJ, Faridabad) stay untouched: their past invoices, CNs and returns
7
-- resolve sellerwarehouse by (7681, seller 16).
8
-- Region rows are OURS/BAD vendor 40 like 7573/7720/7681 - never GOOD/vendor 1 (Hotspot), which lookups mistake for a
9
-- supplier child. Per-supplier G/B/THIRD_PARTY children, internal suppliers, brand mapping, warehouse_provider, internal
10
-- store moves and the ProfitMandiConstants maps follow separately.
11
 
12
START TRANSACTION;
13
 
14
-- new GST address; city must be the last comma segment (WarehouseAddressMaster.getCustomAddress)
15
INSERT INTO transaction.warehouseaddressmaster (address, pin, state_id, created, contact_number, contact_person)
16
VALUES ('Ground Floor, Plot No. 466, Udyog Vihar Phase 5, Gurugram', '122016', 3, NOW(), '9718617332', 'Shivam Gupta');
17
SET @addr = LAST_INSERT_ID();
18
 
19
SET @loc = 'Ground Floor, Plot No. 466, Udyog Vihar Phase 5, Gurugram';
20
SET @gstin = '06AACCN9802G2ZI';
21
SET @seller = 21;
22
 
23
-- HR-NSSPL/GGN
24
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
25
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
26
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
27
VALUES ('HR-NSSPL/GGN', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);
28
SET @w = LAST_INSERT_ID();
29
UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;
30
INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,
31
  created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)
32
VALUES (@seller, @w, 0, 0, 'NSHRGGN', 0, 0, NOW(), 1, 0, 0, 0);
33
INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);
34
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
35
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
36
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
37
VALUES ('HR-NSSPL/GGN/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);
38
 
39
-- HR-NSSPL/DL
40
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
41
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
42
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
43
VALUES ('HR-NSSPL/DL', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);
44
SET @w = LAST_INSERT_ID();
45
UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;
46
INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,
47
  created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)
48
VALUES (@seller, @w, 0, 0, 'NSHRDL', 0, 0, NOW(), 1, 0, 0, 0);
49
INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);
50
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
51
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
52
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
53
VALUES ('HR-NSSPL/DL/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);
54
 
55
-- HR-NSSPL/UPW
56
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
57
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
58
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
59
VALUES ('HR-NSSPL/UPW', @loc, 3, NOW(), NOW(), NULL, @gstin, '122016', 3, 40, 0, 'BAD', 'OURS', 0, 0, 0, 0, 3, 0);
60
SET @w = LAST_INSERT_ID();
61
UPDATE inventory.warehouse SET billingWarehouseId = @w, shippingWarehouseId = @w WHERE id = @w;
62
INSERT INTO transaction.sellerwarehouse (seller_id, warehouse_id, orderType, id, prefix, challan_id, cn_sequence,
63
  created_on, is_active, dn_sequence, refurb_sequence, fofo_dn_sequence)
64
VALUES (@seller, @w, 0, 0, 'NSHRUPW', 0, 0, NOW(), 1, 0, 0, 0);
65
INSERT INTO transaction.warehouseaddressmapping (warehouse_id, address_id, created, updated) VALUES (@w, @addr, NOW(), NULL);
66
INSERT INTO inventory.warehouse (displayName, location, status, addedOn, lastCheckedOn, tinNumber, gstin, pincode,
67
  logisticsLocation, vendor_id, billingType, inventoryType, warehouseType, shippingWarehouseId, billingWarehouseId,
68
  transferDelayInHours, isAvailabilityMonitored, state_id, source)
69
VALUES ('HR-NSSPL/UPW/Dummy/G', NULL, 3, NOW(), NOW(), NULL, NULL, '122016', 3, 40, 0, 'GOOD', 'OURS', @w, @w, 0, 0, 3, 0);
70
 
71
COMMIT;
72
 
73
-- verify
74
SELECT w.id, w.displayName, w.inventoryType, w.vendor_id, w.billingWarehouseId, w.state_id,
75
       sw.prefix, sw.seller_id, m.address_id, a.address, a.pin
76
  FROM inventory.warehouse w
77
  LEFT JOIN transaction.sellerwarehouse sw ON sw.warehouse_id = w.id
78
  LEFT JOIN transaction.warehouseaddressmapping m ON m.warehouse_id = w.id
79
  LEFT JOIN transaction.warehouseaddressmaster a ON a.id = m.address_id
80
 WHERE w.displayName IN ('HR-NSSPL/GGN', 'HR-NSSPL/DL', 'HR-NSSPL/UPW')
81
    OR w.displayName LIKE 'HR-NSSPL/%/Dummy/G'
82
 ORDER BY w.id;