Browse Source

Merge branch '20211122' of http://git.shengws.com/csx/XT_New into 20211122

csx 3 years ago
parent
commit
d3768bc896

+ 2 - 2
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2
-httpport = 9531
3
-runmode = prod
2
+httpport = 9529
3
+runmode = dev
4 4
 
5 5
 #
6 6
 copyrequestbody = true

+ 32 - 26
controllers/patient_api_controller.go View File

@@ -850,32 +850,36 @@ func (c *PatientApiController) UpdateDialysisSolution() {
850 850
 	timeLayout := "2006-01-02"
851 851
 	loc, _ := time.LoadLocation("Local")
852 852
 	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
853
-	prescription := models.DialysisPrescription{
854
-		Dialyzer:                   solution.Dialyzer,
855
-		Anticoagulant:              solution.Anticoagulant,
856
-		AnticoagulantShouji:        solution.AnticoagulantShouji,
857
-		AnticoagulantWeichi:        solution.AnticoagulantWeichi,
858
-		AnticoagulantZongliang:     solution.AnticoagulantZongliang,
859
-		ModeId:                     solution.ModeId,
860
-		DialysisDurationHour:       solution.DialysisDurationHour,
861
-		Kalium:                     solution.Kalium,
862
-		Sodium:                     solution.Sodium,
863
-		Calcium:                    solution.Calcium,
864
-		TargetUltrafiltration:      solution.TargetUltrafiltration,
865
-		DialyzerPerfusionApparatus: solution.DialyzerPerfusionApparatus,
866
-		BloodAccess:                solution.BloodAccess,
867
-		DialysateFlow:              solution.DialysateFlow,
868
-		DialysateTemperature:       solution.DialysateTemperature,
869
-		DialysisIrrigation:         solution.DialysisIrrigation,
870
-		DialysisDialyszers:         solution.DialysisDialyszers,
871
-		PlasmaSeparator:            solution.PlasmaSeparator,
872
-		BilirubinAdsorptionColumn:  solution.BilirubinAdsorptionColumn,
873
-		OxygenUptake:               solution.OxygenUptake,
874
-		OxygenFlow:                 solution.OxygenFlow,
875
-		OxygenTime:                 solution.OxygenTime,
876
-		MaxUltrafiltrationRate:     solution.MaxUltrafiltrationRate,
877
-	}
878
-	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
853
+
854
+	if adminUserInfo.CurrentOrgId == 9538 {
855
+		prescription := models.DialysisPrescription{
856
+			Dialyzer:                   solution.Dialyzer,
857
+			Anticoagulant:              solution.Anticoagulant,
858
+			AnticoagulantShouji:        solution.AnticoagulantShouji,
859
+			AnticoagulantWeichi:        solution.AnticoagulantWeichi,
860
+			AnticoagulantZongliang:     solution.AnticoagulantZongliang,
861
+			ModeId:                     solution.ModeId,
862
+			DialysisDurationHour:       solution.DialysisDurationHour,
863
+			Kalium:                     solution.Kalium,
864
+			Sodium:                     solution.Sodium,
865
+			Calcium:                    solution.Calcium,
866
+			TargetUltrafiltration:      solution.TargetUltrafiltration,
867
+			DialyzerPerfusionApparatus: solution.DialyzerPerfusionApparatus,
868
+			BloodAccess:                solution.BloodAccess,
869
+			DialysateFlow:              solution.DialysateFlow,
870
+			DialysateTemperature:       solution.DialysateTemperature,
871
+			DialysisIrrigation:         solution.DialysisIrrigation,
872
+			DialysisDialyszers:         solution.DialysisDialyszers,
873
+			PlasmaSeparator:            solution.PlasmaSeparator,
874
+			BilirubinAdsorptionColumn:  solution.BilirubinAdsorptionColumn,
875
+			OxygenUptake:               solution.OxygenUptake,
876
+			OxygenFlow:                 solution.OxygenFlow,
877
+			OxygenTime:                 solution.OxygenTime,
878
+			MaxUltrafiltrationRate:     solution.MaxUltrafiltrationRate,
879
+		}
880
+		service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
881
+	}
882
+
879 883
 	if err != nil {
880 884
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisSolutionUpdate)
881 885
 		return
@@ -1419,11 +1423,13 @@ func (c *PatientApiController) CreateGroupAdvice() {
1419 1423
 
1420 1424
 	list, err := service.CreateMGroupAdvice(adminUserInfo.CurrentOrgId, advices, groupNo)
1421 1425
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":doctor_advices"
1426
+	//fmt.Println("key23323323232323223233223232323",key)
1422 1427
 	redis := service.RedisClient()
1423 1428
 	defer redis.Close()
1424 1429
 	redis.Set(key, "", time.Second)
1425 1430
 	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
1426 1431
 	redis.Set(keyOne, "", time.Second)
1432
+	//fmt.Println("keyOne23322322323232323233232332",keyOne)
1427 1433
 	if err != nil {
1428 1434
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
1429 1435
 		return

+ 60 - 7
controllers/supply_order_api_contorller.go View File

@@ -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
 					}

+ 3 - 0
models/supply.models.go View File

@@ -37,6 +37,7 @@ type SpBaseDrug struct {
37 37
 	LastPrice         float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
38 38
 	DrugWarehouseInfo []*SpDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
39 39
 	DrugStatus        string                 `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
40
+	MinPrice          float64                `gorm:"column:min_price" json:"min_price" form:"min_price"`
40 41
 }
41 42
 
42 43
 func (SpBaseDrug) TableName() string {
@@ -56,6 +57,7 @@ type SpGoodInformation struct {
56 57
 	GoodStatus        string             `gorm:"column:good_status" json:"good_status" form:"good_status"`
57 58
 	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
58 59
 	Number            string             `gorm:"column:number" json:"number" form:"number"`
60
+	RetailPrice       float64            `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
59 61
 }
60 62
 
61 63
 func (SpGoodInformation) TableName() string {
@@ -221,6 +223,7 @@ type SpSupplierWarehousingOutOrder struct {
221 223
 	ManufacturerId          int64   `gorm:"column:manufacturer_id" json:"manufacturer_id" form:"manufacturer_id"`
222 224
 	SupplyLicenseNumber     string  `gorm:"column:supply_license_number" json:"supply_license_number" form:"supply_license_number"`
223 225
 	GoodNumber              string  `gorm:"column:good_number" json:"good_number" form:"good_number"`
226
+	MinPrice                float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
224 227
 }
225 228
 
226 229
 func (SpSupplierWarehousingOutOrder) TableName() string {

+ 43 - 40
service/stock_service.go View File

@@ -871,21 +871,22 @@ func GetWarehoureOrderOutByGoodId(good_id []int64, startime int64, endtime int64
871 871
 }
872 872
 
873 873
 type VMDrugWarehouse struct {
874
-	ID               int64                `gorm:"column:id" json:"id" form:"id"`
875
-	WarehousingOrder string               `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
876
-	OperationTime    int64                `gorm:"column:operation_time" json:"operation_time" form:"operation_time"`
877
-	OrgId            int64                `gorm:"column:org_id" json:"org_id" form:"org_id"`
878
-	Creater          int64                `gorm:"column:creater" json:"creater" form:"creater"`
879
-	Ctime            int64                `gorm:"column:ctime" json:"ctime" form:"ctime"`
880
-	Modifier         int64                `gorm:"column:modifier" json:"modifier" form:"modifier"`
881
-	Mtime            int64                `gorm:"column:mtime" json:"mtime" form:"mtime"`
882
-	Status           int64                `gorm:"column:status" json:"status" form:"status"`
883
-	WarehousingTime  int64                `gorm:"column:warehousing_time" json:"warehousing_time" form:"warehousing_time"`
884
-	Dealer           int64                `gorm:"column:dealer" json:"dealer" form:"dealer"`
885
-	Manufacturer     int64                `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
886
-	Type             int64                `gorm:"column:type" json:"type" form:"type"`
887
-	Manufacturers    *models.Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
888
-	Dealers          *models.Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
874
+	ID                int64                `gorm:"column:id" json:"id" form:"id"`
875
+	WarehousingOrder  string               `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
876
+	OperationTime     int64                `gorm:"column:operation_time" json:"operation_time" form:"operation_time"`
877
+	OrgId             int64                `gorm:"column:org_id" json:"org_id" form:"org_id"`
878
+	Creater           int64                `gorm:"column:creater" json:"creater" form:"creater"`
879
+	Ctime             int64                `gorm:"column:ctime" json:"ctime" form:"ctime"`
880
+	Modifier          int64                `gorm:"column:modifier" json:"modifier" form:"modifier"`
881
+	Mtime             int64                `gorm:"column:mtime" json:"mtime" form:"mtime"`
882
+	Status            int64                `gorm:"column:status" json:"status" form:"status"`
883
+	WarehousingTime   int64                `gorm:"column:warehousing_time" json:"warehousing_time" form:"warehousing_time"`
884
+	Dealer            int64                `gorm:"column:dealer" json:"dealer" form:"dealer"`
885
+	Manufacturer      int64                `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
886
+	Type              int64                `gorm:"column:type" json:"type" form:"type"`
887
+	Manufacturers     *models.Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
888
+	Dealers           *models.Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
889
+	SupplyWarehouseId int64                `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
889 890
 }
890 891
 
891 892
 func (VMDrugWarehouse) TableName() string {
@@ -893,31 +894,33 @@ func (VMDrugWarehouse) TableName() string {
893 894
 }
894 895
 
895 896
 type VMDrugWarehouseInfo struct {
896
-	ID               int64   `gorm:"column:id" json:"id" form:"id"`
897
-	WarehousingId    int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
898
-	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
899
-	Number           string  `gorm:"column:number" json:"number" form:"number"`
900
-	ProductDate      int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
901
-	ExpiryDate       int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
902
-	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
903
-	Price            float64 `gorm:"column:price" json:"price" form:"price"`
904
-	TotalPrice       float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
905
-	Dealer           int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
906
-	Manufacturer     int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
907
-	Remark           string  `gorm:"column:remark" json:"remark" form:"remark"`
908
-	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
909
-	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
910
-	Status           int64   `gorm:"column:status" json:"status" form:"status"`
911
-	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
912
-	IsReturn         int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
913
-	WarehousingOrder string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
914
-	Type             int64   `gorm:"column:type" json:"type" form:"type"`
915
-	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
916
-	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
917
-	BatchNumber      string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
918
-	MaxUnit          string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
919
-	MinUnit          string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
920
-	Drug             *Drug   `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
897
+	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
898
+	WarehousingId             int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
899
+	DrugId                    int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
900
+	Number                    string  `gorm:"column:number" json:"number" form:"number"`
901
+	ProductDate               int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
902
+	ExpiryDate                int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
903
+	WarehousingCount          int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
904
+	Price                     float64 `gorm:"column:price" json:"price" form:"price"`
905
+	TotalPrice                float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
906
+	Dealer                    int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
907
+	Manufacturer              int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
908
+	Remark                    string  `gorm:"column:remark" json:"remark" form:"remark"`
909
+	Ctime                     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
910
+	Mtime                     int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
911
+	Status                    int64   `gorm:"column:status" json:"status" form:"status"`
912
+	OrgId                     int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
913
+	IsReturn                  int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
914
+	WarehousingOrder          string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
915
+	Type                      int64   `gorm:"column:type" json:"type" form:"type"`
916
+	RetailPrice               float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
917
+	RetailTotalPrice          float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
918
+	BatchNumber               string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
919
+	MaxUnit                   string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
920
+	MinUnit                   string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
921
+	Drug                      *Drug   `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
922
+	SupplyWarehouseId         int64   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
923
+	SupplyWarehouseDetailInfo int64   `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
921 924
 }
922 925
 
923 926
 func (VMDrugWarehouseInfo) TableName() string {

+ 23 - 3
service/supply_service.go View File

@@ -524,13 +524,13 @@ func GetGoodOrderDetail(id int64, orgid int64) (models.SpSupplierWarehouseOut, e
524 524
 
525 525
 func UpdateGoodWarehouseOut(id int64, out models.SpSupplierWarehouseOut) error {
526 526
 
527
-	err := XTWriteDB().Model(&out).Where("id=? and status = 1", id).Updates(map[string]interface{}{"arrearage": out.Arrearage, "payment": out.Payment, "rate_of_concession": out.RateOfConcession, "discount_amount": out.DiscountAmount, "document_date": out.DocumentDate, "return_remake": out.ReturnRemake}).Error
527
+	err := XTWriteDB().Model(&out).Where("id=? and status = 1", id).Updates(map[string]interface{}{"arrearage": out.Arrearage, "payment": out.Payment, "rate_of_concession": out.RateOfConcession, "discount_amount": out.DiscountAmount, "document_date": out.DocumentDate, "return_remake": out.ReturnRemake, "supplier_id": out.SupplierId}).Error
528 528
 	return err
529 529
 }
530 530
 
531 531
 func UpdateGoodWarehouseOutOrder(order *models.SpSupplierWarehousingOutOrder) error {
532 532
 
533
-	err := XTWriteDB().Model(&order).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{"project_id": order.ProjectId, "is_source": order.IsSource, "count": order.Count, "price": order.Count, "remark": order.Remark, "supply_batch_number": order.SupplyBatchNumber, "supply_product_date": order.SupplyProductDate, "supply_expiry_date": order.SupplyExpiryDate, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplySpecificationName, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit, "manufacturer_id": order.ManufacturerId, "supply_license_number": order.SupplyLicenseNumber, "warehousing_id": order.WarehousingId, "warehouse_info_id": order.WarehouseInfoId}).Error
533
+	err := XTWriteDB().Model(&order).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{"project_id": order.ProjectId, "is_source": order.IsSource, "count": order.Count, "price": order.Count, "remark": order.Remark, "supply_batch_number": order.SupplyBatchNumber, "supply_product_date": order.SupplyProductDate, "supply_expiry_date": order.SupplyExpiryDate, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplyTotal, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit, "manufacturer_id": order.ManufacturerId, "supply_license_number": order.SupplyLicenseNumber, "warehousing_id": order.WarehousingId, "warehouse_info_id": order.WarehouseInfoId, "min_price": order.MinPrice}).Error
534 534
 	return err
535 535
 }
536 536
 
@@ -767,7 +767,7 @@ func UpdateGoodSupplyWarehousingInfo(id int64, orgid int64) error {
767 767
 
768 768
 func UpdateGoodSupplyFlow(id int64, orgid int64) error {
769 769
 
770
-	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("supply_warehouse_id = ? and user_org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
770
+	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
771 771
 	return err
772 772
 }
773 773
 
@@ -993,3 +993,23 @@ func DeleteDrugWarehouseOutNight(goodid int64, supply_warehouse_id int64) error
993 993
 
994 994
 	return err
995 995
 }
996
+
997
+func GetGoodIsSource(warehousing_id int64, project_id int64, orgid int64) (*models.SupplierWarehousingInfoOrder, error) {
998
+	info := models.SupplierWarehousingInfoOrder{}
999
+	var err error
1000
+	err = XTReadDB().Model(&info).Where("warehousing_id = ? and project_id = ? and user_org_id = ? and status = 1", warehousing_id, project_id, orgid).Find(&info).Error
1001
+	if err == gorm.ErrRecordNotFound {
1002
+		return nil, err
1003
+	}
1004
+	if err != nil {
1005
+		return nil, err
1006
+	}
1007
+	return &info, nil
1008
+}
1009
+
1010
+func ModfySupplyWarehouseOut(warehousing_id int64, orgid int64) error {
1011
+
1012
+	out := models.SpSupplierWarehouseOut{}
1013
+	err := XTWriteDB().Model(&out).Where("warehousing_id = ? and user_org_id =? and status = 1", warehousing_id, orgid).Updates(map[string]interface{}{"warehousing_id": 0, "number": ""}).Error
1014
+	return err
1015
+}