Subversion Repositories SmartDukaan

Rev

Rev 28300 | Rev 28499 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28300 Rev 28493
Line 18... Line 18...
18
import org.springframework.ui.Model;
18
import org.springframework.ui.Model;
19
import org.springframework.web.bind.annotation.RequestMapping;
19
import org.springframework.web.bind.annotation.RequestMapping;
20
import org.springframework.web.bind.annotation.RequestMethod;
20
import org.springframework.web.bind.annotation.RequestMethod;
21
import org.springframework.web.bind.annotation.RequestParam;
21
import org.springframework.web.bind.annotation.RequestParam;
22
 
22
 
-
 
23
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
23
import com.spice.profitmandi.dao.repository.transaction.SellerRepository;
24
import com.spice.profitmandi.dao.repository.transaction.SellerRepository;
24
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
25
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
25
import com.spice.profitmandi.dao.repository.transaction.WareHouseAddressMappingRepository;
26
import com.spice.profitmandi.dao.repository.transaction.WareHouseAddressMappingRepository;
26
import com.spice.profitmandi.dao.repository.transaction.WareHouseAddressMasterRepository;
27
import com.spice.profitmandi.dao.repository.transaction.WareHouseAddressMasterRepository;
27
import com.spice.profitmandi.web.util.MVCResponseSender;
28
import com.spice.profitmandi.web.util.MVCResponseSender;
28
import com.spice.profitmandi.dao.entity.inventory.State;
29
import com.spice.profitmandi.dao.entity.inventory.State;
-
 
30
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
29
import com.spice.profitmandi.dao.entity.transaction.*;
31
import com.spice.profitmandi.dao.entity.transaction.*;
-
 
32
import com.spice.profitmandi.dao.enumuration.inventory.InventoryType;
-
 
33
import com.spice.profitmandi.dao.enumuration.inventory.WarehouseType;
30
 
34
 
31
@Controller
35
@Controller
32
@Transactional(rollbackFor = Throwable.class)
36
@Transactional(rollbackFor = Throwable.class)
33
public class SellerController {
37
public class SellerController {
34
 
38
 
35
	@Autowired
39
	@Autowired
36
	private SellerRepository sellerRepository;
40
	private SellerRepository sellerRepository;
37
 
41
 
38
	@Autowired
42
	@Autowired
-
 
43
	WarehouseRepository warehouseRepository;
-
 
44
 
-
 
45
	@Autowired
39
	WareHouseAddressMasterRepository wareHouseAddressMasterRepository;
46
	WareHouseAddressMasterRepository wareHouseAddressMasterRepository;
40
 
47
 
41
	@Autowired
48
	@Autowired
42
	private SellerWarehouseRepository sellerWarehouseRepository;
49
	private SellerWarehouseRepository sellerWarehouseRepository;
43
 
50
 
Line 52... Line 59...
52
	@RequestMapping(value = "/createNewWarehouse", method = RequestMethod.POST)
59
	@RequestMapping(value = "/createNewWarehouse", method = RequestMethod.POST)
53
	public String getViewOurSales(HttpServletRequest request,
60
	public String getViewOurSales(HttpServletRequest request,
54
			@RequestParam(name = "address", required = true, defaultValue = "0") int address,
61
			@RequestParam(name = "address", required = true, defaultValue = "0") int address,
55
			@RequestParam(name = "prefix", required = true, defaultValue = "0") String prefix,
62
			@RequestParam(name = "prefix", required = true, defaultValue = "0") String prefix,
56
			@RequestParam(name = "sellerId", required = true, defaultValue = "0") int sellerId,
63
			@RequestParam(name = "sellerId", required = true, defaultValue = "0") int sellerId,
-
 
64
			@RequestParam(name = "warehouseName", required = true, defaultValue = "0") String warehouseName,
57
			@RequestParam(name = "warehouseId", required = true, defaultValue = "0") int warehouseId, Model model)
65
			@RequestParam(name = "pinCode", required = true, defaultValue = "0") String pinCode, Model model)
58
 
66
 
59
			throws Exception {
67
			throws Exception {
60
 
68
 
-
 
69
		Seller seller = sellerRepository.sellerSelectById(sellerId);
-
 
70
	
-
 
71
 
-
 
72
		Warehouse warehouse = new Warehouse();
-
 
73
		warehouse.setDisplayName(warehouseName);
-
 
74
		warehouse.setLocation(seller.getAddress());
-
 
75
		warehouse.setGstin(seller.getGstin());
-
 
76
		warehouse.setStateId(seller.getStateId());
-
 
77
		warehouse.setStatus(3);
-
 
78
		warehouse.setAddedOn(LocalDateTime.now());
-
 
79
		warehouse.setLastCheckedOn(LocalDateTime.now());
-
 
80
		warehouse.setTinNumber(null);
-
 
81
    	warehouse.setPincode(pinCode);
-
 
82
		warehouse.setLogisticsLocation(0);
-
 
83
		warehouse.setVendor(1);
-
 
84
		warehouse.setBillingType(1);
-
 
85
		warehouse.setInventoryType(InventoryType.GOOD);
-
 
86
		warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
-
 
87
		warehouse.setIsAvailabilityMonitored(1);
-
 
88
		warehouse.setSource(0);
-
 
89
		warehouseRepository.persist(warehouse);
-
 
90
 
61
		LOGGER.info("warehouseId" + warehouseId);
91
		LOGGER.info("warehouseId" + warehouse.getId());
-
 
92
		
62
		SellerWarehouse sellerWarehouse = new SellerWarehouse();
93
		SellerWarehouse sellerWarehouse = new SellerWarehouse();
63
		sellerWarehouse.setActive(true);
94
		sellerWarehouse.setActive(true);
64
		sellerWarehouse.setWarehouseId(warehouseId);
95
		sellerWarehouse.setWarehouseId(warehouse.getId());
65
		sellerWarehouse.setChallanSequence(0);
96
		sellerWarehouse.setChallanSequence(0);
66
		sellerWarehouse.setCreateTimestamp(LocalDateTime.now());
97
		sellerWarehouse.setCreateTimestamp(LocalDateTime.now());
67
		sellerWarehouse.setInvoiceSequence(0);
98
		sellerWarehouse.setInvoiceSequence(0);
68
		sellerWarehouse.setPrefix(prefix);
99
		sellerWarehouse.setPrefix(prefix);
69
		sellerWarehouse.setOrderType(0);
100
		sellerWarehouse.setOrderType(0);
Line 72... Line 103...
72
 
103
 
73
		WarehouseAddressMapping warehouseAddressMapping = new WarehouseAddressMapping();
104
		WarehouseAddressMapping warehouseAddressMapping = new WarehouseAddressMapping();
74
		warehouseAddressMapping.setAddressId(address);
105
		warehouseAddressMapping.setAddressId(address);
75
		warehouseAddressMapping.setCreated(LocalDateTime.now());
106
		warehouseAddressMapping.setCreated(LocalDateTime.now());
76
		warehouseAddressMapping.setUpdated(null);
107
		warehouseAddressMapping.setUpdated(null);
77
		warehouseAddressMapping.setWarehouseId(warehouseId);
108
		warehouseAddressMapping.setWarehouseId(warehouse.getId());
78
		warehouseAddressMapping.setAddressId(address);
109
		warehouseAddressMapping.setAddressId(address);
79
		wareHouseAddressMappingRepository.persist(warehouseAddressMapping);
110
		wareHouseAddressMappingRepository.persist(warehouseAddressMapping);
80
 
111
 
-
 
112
		
81
		return "seller";
113
		return "seller";
82
 
114
 
83
	}
115
	}
84
 
116
 
85
	@RequestMapping(value = "/createNewSeller", method = RequestMethod.POST)
117
	@RequestMapping(value = "/createNewSeller", method = RequestMethod.POST)