|
@@ -306,7 +306,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
306
|
306
|
items := item.(map[string]interface{})
|
307
|
307
|
items["is_first"] = 1
|
308
|
308
|
//如果电话和联系人都为空,不保存联系人
|
309
|
|
- if items["phone"] == "" && items["name"] == "" {
|
|
309
|
+ if items["phone"] == "" && items["name"] == nil {
|
310
|
310
|
upsupply := models.SpSupplierName{
|
311
|
311
|
ID: supplierid,
|
312
|
312
|
SupplierCode: supplierCode,
|
|
@@ -325,6 +325,10 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
325
|
325
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
326
|
326
|
return
|
327
|
327
|
}
|
|
328
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
329
|
+ "list": "保存成功",
|
|
330
|
+ })
|
|
331
|
+ return
|
328
|
332
|
}
|
329
|
333
|
}
|
330
|
334
|
}
|
|
@@ -608,7 +612,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
608
|
612
|
items := item.(map[string]interface{})
|
609
|
613
|
items["is_first"] = 1
|
610
|
614
|
//如果电话和联系人都为空,不保存联系人
|
611
|
|
- if items["phone"] == "" && items["name"] == "" {
|
|
615
|
+ if items["phone"] == "" && items["name"] == nil {
|
612
|
616
|
supply := models.SpSupplierName{
|
613
|
617
|
SupplierCode: supplierCode,
|
614
|
618
|
SupplierName: supplierName,
|
|
@@ -629,6 +633,10 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
629
|
633
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
630
|
634
|
return
|
631
|
635
|
}
|
|
636
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
637
|
+ "list": "保存成功",
|
|
638
|
+ })
|
|
639
|
+ return
|
632
|
640
|
}
|
633
|
641
|
}
|
634
|
642
|
}
|
|
@@ -1407,6 +1415,15 @@ func (this *SupplyOrderApiController) AddGoodOrder() {
|
1407
|
1415
|
|
1408
|
1416
|
price_float, _ := strconv.ParseFloat(supply_price, 64)
|
1409
|
1417
|
|
|
1418
|
+ if items["min_price"] == nil || reflect.TypeOf(items["min_price"]).String() != "string" {
|
|
1419
|
+ utils.ErrorLog("min_price")
|
|
1420
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1421
|
+ return
|
|
1422
|
+ }
|
|
1423
|
+ min_price := items["min_price"].(string)
|
|
1424
|
+
|
|
1425
|
+ min_price_float, _ := strconv.ParseFloat(min_price, 64)
|
|
1426
|
+
|
1410
|
1427
|
if items["supply_total_price"] == nil || reflect.TypeOf(items["supply_total_price"]).String() != "string" {
|
1411
|
1428
|
utils.ErrorLog("supply_total_price")
|
1412
|
1429
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1548,6 +1565,7 @@ func (this *SupplyOrderApiController) AddGoodOrder() {
|
1548
|
1565
|
ManufacturerId: manufacturer_id,
|
1549
|
1566
|
GoodNumber: warehouseOut.GoodNumber,
|
1550
|
1567
|
SupplyManufacturer: supply_manufacturer,
|
|
1568
|
+ MinPrice: min_price_float,
|
1551
|
1569
|
}
|
1552
|
1570
|
warehousingOut = append(warehousingOut, &order)
|
1553
|
1571
|
}
|
|
@@ -1559,7 +1577,21 @@ func (this *SupplyOrderApiController) AddGoodOrder() {
|
1559
|
1577
|
if item.WarehouseInfoId == 0 {
|
1560
|
1578
|
item.Type = 2
|
1561
|
1579
|
}
|
1562
|
|
- err = service.CreateSupplyWarehousOutOrder(item)
|
|
1580
|
+ //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
|
1581
|
+ _, errcode := service.GetGoodIsSource(warehousing_id, item.ProjectId, orgId)
|
|
1582
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1583
|
+ item.WarehousingId = 0
|
|
1584
|
+ item.WarehouseInfoId = 0
|
|
1585
|
+ item.OrderNumber = ""
|
|
1586
|
+ item.Type = 2
|
|
1587
|
+ err = service.CreateSupplyWarehousOutOrder(item)
|
|
1588
|
+ //更新采购单
|
|
1589
|
+ service.ModfySupplyWarehouseOut(warehousing_id, orgId)
|
|
1590
|
+ }
|
|
1591
|
+ if errcode == nil {
|
|
1592
|
+ err = service.CreateSupplyWarehousOutOrder(item)
|
|
1593
|
+ }
|
|
1594
|
+
|
1563
|
1595
|
}
|
1564
|
1596
|
|
1565
|
1597
|
list, parseDateErr := service.GetSupplyWarehouseOutById(warehouseOut.ID, orgId)
|
|
@@ -1754,6 +1786,15 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1754
|
1786
|
|
1755
|
1787
|
supply_total_price_float, _ := strconv.ParseFloat(supply_total_price, 64)
|
1756
|
1788
|
|
|
1789
|
+ if items["min_price"] == nil || reflect.TypeOf(items["min_price"]).String() != "string" {
|
|
1790
|
+ utils.ErrorLog("min_price")
|
|
1791
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1792
|
+ return
|
|
1793
|
+ }
|
|
1794
|
+ min_price := items["min_price"].(string)
|
|
1795
|
+
|
|
1796
|
+ min_price_float, _ := strconv.ParseFloat(min_price, 64)
|
|
1797
|
+
|
1757
|
1798
|
if items["project_id"] == nil || reflect.TypeOf(items["project_id"]).String() != "float64" {
|
1758
|
1799
|
utils.ErrorLog("project_id")
|
1759
|
1800
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1902,6 +1943,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1902
|
1943
|
SupplyManufacturer: supply_manufacturer,
|
1903
|
1944
|
WarehouseInfoId: warehouse_info_id,
|
1904
|
1945
|
WarehousingId: warehousing_id,
|
|
1946
|
+ MinPrice: min_price_float,
|
1905
|
1947
|
}
|
1906
|
1948
|
updateWarehout = append(updateWarehout, &order)
|
1907
|
1949
|
}
|
|
@@ -1935,6 +1977,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1935
|
1977
|
ManufacturerId: manufacturer_id,
|
1936
|
1978
|
GoodNumber: good_number,
|
1937
|
1979
|
SupplyManufacturer: supply_manufacturer,
|
|
1980
|
+ MinPrice: min_price_float,
|
1938
|
1981
|
}
|
1939
|
1982
|
warehousingOut = append(warehousingOut, &order)
|
1940
|
1983
|
}
|
|
@@ -1951,6 +1994,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1951
|
1994
|
DocumentDate: startTime,
|
1952
|
1995
|
ReturnRemake: return_remake,
|
1953
|
1996
|
}
|
|
1997
|
+
|
1954
|
1998
|
//更改购货单据
|
1955
|
1999
|
service.UpdateGoodWarehouseOut(warehose_out_id, out)
|
1956
|
2000
|
|
|
@@ -1962,8 +2006,17 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1962
|
2006
|
err = service.CreateSupplyWarehousOutOrder(item)
|
1963
|
2007
|
}
|
1964
|
2008
|
for _, item := range updateWarehout {
|
1965
|
|
-
|
1966
|
|
- service.UpdateGoodWarehouseOutOrder(item)
|
|
2009
|
+ //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
|
2010
|
+ _, errcode := service.GetGoodIsSource(item.WarehousingId, item.ProjectId, orgId)
|
|
2011
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
2012
|
+ item.WarehousingId = 0
|
|
2013
|
+ item.WarehouseInfoId = 0
|
|
2014
|
+ item.Type = 2
|
|
2015
|
+ item.OrderNumber = ""
|
|
2016
|
+ service.UpdateGoodWarehouseOutOrder(item)
|
|
2017
|
+ //更新采购单
|
|
2018
|
+ service.ModfySupplyWarehouseOut(item.WarehousingId, orgId)
|
|
2019
|
+ }
|
1967
|
2020
|
}
|
1968
|
2021
|
if err == nil {
|
1969
|
2022
|
this.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -2171,7 +2224,7 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2171
|
2224
|
BatchNumber: item.SupplyBatchNumber,
|
2172
|
2225
|
MaxUnit: item.SupplyUnit,
|
2173
|
2226
|
MinUnit: item.SupplyUnit,
|
2174
|
|
- RetailPrice: medical.MinPrice,
|
|
2227
|
+ RetailPrice: item.MinPrice,
|
2175
|
2228
|
SupplyWarehouseId: id,
|
2176
|
2229
|
SupplyWarehouseDetailInfo: item.ID,
|
2177
|
2230
|
}
|
|
@@ -2271,7 +2324,7 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2271
|
2324
|
StockCount: item.Count,
|
2272
|
2325
|
Dealer: good.Dealer,
|
2273
|
2326
|
LicenseNumber: item.SupplyLicenseNumber,
|
2274
|
|
- PackingPrice: good.PackingPrice,
|
|
2327
|
+ PackingPrice: item.MinPrice,
|
2275
|
2328
|
SupplyWarehouseId: id,
|
2276
|
2329
|
SupplyWarehouseDetailInfo: item.ID,
|
2277
|
2330
|
}
|