소스 검색

11月8日库存管理

XMLWAN 3 년 전
부모
커밋
c67d36f33d
8개의 변경된 파일132개의 추가작업 그리고 113개의 파일을 삭제
  1. 1 1
      conf/app.conf
  2. 59 60
      controllers/base_api_controller.go
  3. 8 19
      controllers/drug_stock_api_contorller.go
  4. 4 2
      controllers/stock_in_api_controller.go
  5. 4 3
      models/drug.go
  6. 1 1
      models/patient_models.go
  7. 24 23
      models/stock_models.go
  8. 31 4
      service/stock_service.go

+ 1 - 1
conf/app.conf 파일 보기

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

+ 59 - 60
controllers/base_api_controller.go 파일 보기

@@ -2,7 +2,6 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
6 5
 	"XT_New/service"
7 6
 	"fmt"
8 7
 	"strconv"
@@ -70,36 +69,36 @@ type BaseAuthAPIController struct {
70 69
 func (this *BaseAuthAPIController) Prepare() {
71 70
 	this.BaseAPIController.Prepare()
72 71
 	if this.GetAdminUserInfo() == nil {
73
-		var userAdmin models.AdminUser
74
-		userAdmin.Id = 1448
75
-		userAdmin.Mobile = "13318599895"
76
-
77
-		userAdmin.Id = 597
78
-		userAdmin.Mobile = "19874122664"
79
-		userAdmin.IsSuperAdmin = false
80
-		userAdmin.Status = 1
81
-		userAdmin.CreateTime = 1530786071
82
-		userAdmin.ModifyTime = 1530786071
83
-		var subscibe models.ServeSubscibe
84
-		subscibe.ID = 1
85
-		subscibe.OrgId = 3877
86
-		subscibe.PeriodStart = 1538035409
87
-		subscibe.PeriodEnd = 1569571409
88
-		subscibe.State = 1
89
-		subscibe.Status = 1
90
-		subscibe.CreatedTime = 1538035409
91
-		subscibe.UpdatedTime = 1538035409
92
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
-		subscibes[4] = &subscibe
94
-		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 3877
96
-		adminUserInfo.CurrentAppId = 4
97
-		adminUserInfo.AdminUser = &userAdmin
98
-		adminUserInfo.Subscibes = subscibes
99
-		this.SetSession("admin_user_info", &adminUserInfo)
100
-
101
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
102
-		//this.StopRun()
72
+		//var userAdmin models.AdminUser
73
+		//userAdmin.Id = 1448
74
+		//userAdmin.Mobile = "13318599895"
75
+		//
76
+		//userAdmin.Id = 597
77
+		//userAdmin.Mobile = "19874122664"
78
+		//userAdmin.IsSuperAdmin = false
79
+		//userAdmin.Status = 1
80
+		//userAdmin.CreateTime = 1530786071
81
+		//userAdmin.ModifyTime = 1530786071
82
+		//var subscibe models.ServeSubscibe
83
+		//subscibe.ID = 1
84
+		//subscibe.OrgId = 3877
85
+		//subscibe.PeriodStart = 1538035409
86
+		//subscibe.PeriodEnd = 1569571409
87
+		//subscibe.State = 1
88
+		//subscibe.Status = 1
89
+		//subscibe.CreatedTime = 1538035409
90
+		//subscibe.UpdatedTime = 1538035409
91
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
+		//subscibes[4] = &subscibe
93
+		//var adminUserInfo service.AdminUserInfo
94
+		//adminUserInfo.CurrentOrgId = 3877
95
+		//adminUserInfo.CurrentAppId = 4
96
+		//adminUserInfo.AdminUser = &userAdmin
97
+		//adminUserInfo.Subscibes = subscibes
98
+		//this.SetSession("admin_user_info", &adminUserInfo)
99
+
100
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
+		this.StopRun()
103 102
 
104 103
 	}
105 104
 
@@ -316,35 +315,35 @@ type BaseServeAPIController struct {
316 315
 func (this *BaseServeAPIController) Prepare() {
317 316
 	this.BaseAPIController.Prepare()
318 317
 	if this.GetAdminUserInfo() == nil {
319
-		var userAdmin models.AdminUser
320
-		userAdmin.Id = 1448
321
-		userAdmin.Mobile = "13318599895"
322
-
323
-		userAdmin.Id = 597
324
-		userAdmin.Mobile = "19874122664"
325
-		userAdmin.IsSuperAdmin = false
326
-		userAdmin.Status = 1
327
-		userAdmin.CreateTime = 1530786071
328
-		userAdmin.ModifyTime = 1530786071
329
-		var subscibe models.ServeSubscibe
330
-		subscibe.ID = 1
331
-		subscibe.OrgId = 3877
332
-		subscibe.PeriodStart = 1538035409
333
-		subscibe.PeriodEnd = 1569571409
334
-		subscibe.State = 1
335
-		subscibe.Status = 1
336
-		subscibe.CreatedTime = 1538035409
337
-		subscibe.UpdatedTime = 1538035409
338
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
-		subscibes[4] = &subscibe
340
-		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 3877
342
-		adminUserInfo.CurrentAppId = 4
343
-		adminUserInfo.AdminUser = &userAdmin
344
-		adminUserInfo.Subscibes = subscibes
345
-		this.SetSession("admin_user_info", &adminUserInfo)
346
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
-		//this.StopRun()
318
+		//var userAdmin models.AdminUser
319
+		//userAdmin.Id = 1448
320
+		//userAdmin.Mobile = "13318599895"
321
+		//
322
+		//userAdmin.Id = 597
323
+		//userAdmin.Mobile = "19874122664"
324
+		//userAdmin.IsSuperAdmin = false
325
+		//userAdmin.Status = 1
326
+		//userAdmin.CreateTime = 1530786071
327
+		//userAdmin.ModifyTime = 1530786071
328
+		//var subscibe models.ServeSubscibe
329
+		//subscibe.ID = 1
330
+		//subscibe.OrgId = 3877
331
+		//subscibe.PeriodStart = 1538035409
332
+		//subscibe.PeriodEnd = 1569571409
333
+		//subscibe.State = 1
334
+		//subscibe.Status = 1
335
+		//subscibe.CreatedTime = 1538035409
336
+		//subscibe.UpdatedTime = 1538035409
337
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
+		//subscibes[4] = &subscibe
339
+		//var adminUserInfo service.AdminUserInfo
340
+		//adminUserInfo.CurrentOrgId = 3877
341
+		//adminUserInfo.CurrentAppId = 4
342
+		//adminUserInfo.AdminUser = &userAdmin
343
+		//adminUserInfo.Subscibes = subscibes
344
+		//this.SetSession("admin_user_info", &adminUserInfo)
345
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
+		this.StopRun()
348 347
 	}
349 348
 
350 349
 	//if adminUserInfo.AppRole != nil {

+ 8 - 19
controllers/drug_stock_api_contorller.go 파일 보기

@@ -2213,10 +2213,10 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2213 2213
 						dealer_id = item.ID
2214 2214
 					}
2215 2215
 				}
2216
-
2216
+				cancelInfo, _ := service.GetLastDrugCancelStockById(adminUserInfo.CurrentOrgId)
2217 2217
 				cancelStockInfo := &models.DrugCancelStockInfo{
2218
-					OrderNumber:      cancelStock.OrderNumber,
2219
-					CancelStockId:    cancelStock.ID,
2218
+					OrderNumber:      cancelInfo.OrderNumber,
2219
+					CancelStockId:    cancelInfo.ID,
2220 2220
 					DrugId:           drug_id,
2221 2221
 					Count:            count,
2222 2222
 					Status:           1,
@@ -2289,10 +2289,8 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2289 2289
 		if item.MaxUnit == medical.MinUnit {
2290 2290
 			total_number = item.Count
2291 2291
 		}
2292
-		fmt.Println("当前退库数量", total_number)
2293 2292
 		//查询当前药品退库的批次号的总入库数
2294 2293
 		infoWareInfo, _ := service.GetDrugWarehouseInfo(item.BatchNumberId)
2295
-		fmt.Println("hhh2h3h2hh3233", item.MaxUnit, medical.MaxUnit, infoWareInfo.StockMaxNumber, infoWareInfo.StockMinNumber)
2296 2294
 		var total_count int64
2297 2295
 		total_count = infoWareInfo.StockMaxNumber*medical.MinNumber + infoWareInfo.StockMinNumber
2298 2296
 		fmt.Println("当前批次总库存", total_count)
@@ -2326,8 +2324,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2326 2324
 		for _, item := range outInfo {
2327 2325
 			out_number += item.Count
2328 2326
 		}
2329
-		fmt.Println("当前退库数量", total_number)
2330
-		fmt.Println("出库数量23232232323222332", out_number)
2327
+
2331 2328
 		if out_number == 0 {
2332 2329
 			service.UpdateDrugCancel(item.CancelStockId)
2333 2330
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -2336,7 +2333,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2336 2333
 			return
2337 2334
 		}
2338 2335
 		//判断退库数量是否大于总入库数量
2339
-		if total_number > out_number {
2336
+		if total_number > total_count {
2340 2337
 			service.UpdateDrugCancel(item.CancelStockId)
2341 2338
 			c.ServeSuccessJSON(map[string]interface{}{
2342 2339
 				"msg": "2",
@@ -2346,7 +2343,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2346 2343
 
2347 2344
 		//判断总退库数量是否大于出库数量
2348 2345
 		fmt.Println("该批次总退库数量", can_number+total_number)
2349
-		fmt.Println("总出数量", out_number)
2346
+		fmt.Println("总出数量", out_number)
2350 2347
 		if can_number+total_number > out_number {
2351 2348
 			//清空退库单
2352 2349
 			service.UpdateDrugCancel(item.CancelStockId)
@@ -2355,7 +2352,8 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2355 2352
 			})
2356 2353
 			return
2357 2354
 		}
2358
-
2355
+		fmt.Println("当前退库数量", total_number)
2356
+		fmt.Println("总出口数量", out_number)
2359 2357
 		//正常退库
2360 2358
 		if total_number <= out_number {
2361 2359
 			//创建退库详情
@@ -2399,15 +2397,6 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2399 2397
 					"msg": "1",
2400 2398
 				})
2401 2399
 			}
2402
-			if errs != nil {
2403
-				utils.ErrorLog(errs.Error())
2404
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCancelStockFail)
2405
-				return
2406
-			}
2407
-
2408
-			c.ServeSuccessJSON(map[string]interface{}{
2409
-				"msg": "1",
2410
-			})
2411 2400
 		}
2412 2401
 	}
2413 2402
 }

+ 4 - 2
controllers/stock_in_api_controller.go 파일 보기

@@ -2092,7 +2092,9 @@ func (c *StockManagerApiController) CreateCancelStock() {
2092 2092
 	for _, item := range cancelStockInfos {
2093 2093
 
2094 2094
 		//统计该批次耗材的出库数量
2095
-		info, _ := service.GetWarehoureOrderInfoCount(item.GoodId, item.OrgId, item.WarehouseInfoId)
2095
+		//info, _ := service.GetWarehoureOrderInfoCount(item.GoodId, item.OrgId, item.WarehouseInfoId)
2096
+
2097
+		info, _ := service.GetWarehoureOrderStockOutFlow(item.GoodId, item.OrgId, item.WarehouseInfoId)
2096 2098
 		fmt.Println("2333223323322332233223322323", item.Count, info.Count)
2097 2099
 		if item.Count > info.Count {
2098 2100
 			service.UpdateCancelInfo(item.CancelStockId)
@@ -2489,7 +2491,7 @@ func (c *StockManagerApiController) EditCancelStock() {
2489 2491
 
2490 2492
 		for _, item := range cancelStockInfos {
2491 2493
 			//统计该耗材的出库数量
2492
-			info, _ := service.GetWarehoureOrderInfoCount(item.GoodId, item.OrgId, item.WarehouseInfoId)
2494
+			info, _ := service.GetWarehoureOrderStockOutFlow(item.GoodId, item.OrgId, item.WarehouseInfoId)
2493 2495
 			if item.Count > info.Count {
2494 2496
 				c.ServeSuccessJSON(map[string]interface{}{
2495 2497
 					"msg": "2",

+ 4 - 3
models/drug.go 파일 보기

@@ -65,9 +65,10 @@ type BaseDrugLib struct {
65 65
 	HospApprFlag                int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
66 66
 	LmtUsedFlag                 int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
67 67
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
68
-	DrugDay               string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
69
-	Total                 float64 `gorm:"column:total" json:"total" form:"total"`
70
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
68
+	DrugDay               string                 `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
69
+	Total                 float64                `gorm:"column:total" json:"total" form:"total"`
70
+	PrescribingNumberUnit string                 `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
71
+	DrugWarehouseInfo     []*XtDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
71 72
 }
72 73
 
73 74
 func (BaseDrugLib) TableName() string {

+ 1 - 1
models/patient_models.go 파일 보기

@@ -1262,7 +1262,7 @@ type XtAssessmentBeforeDislysis struct {
1262 1262
 	DuctusArantiiOther             string  `gorm:"column:ductus_arantii_other" json:"ductus_arantii_other" form:"ductus_arantii_other"`
1263 1263
 	PunctureNeedle                 string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
1264 1264
 	DialysisIntakesUnit            int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit" form:"dialysis_intakes_unit"`
1265
-	HumorExcessiveSymptom          int64   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom" form:"humor_excessive_symptom"`
1265
+	HumorExcessiveSymptom          string  `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom" form:"humor_excessive_symptom"`
1266 1266
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other" form:"last_post_dialysis_other"`
1267 1267
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other" form:"symptom_before_dialysis_other"`
1268 1268
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other" form:"dialysis_interphase_other"`

+ 24 - 23
models/stock_models.go 파일 보기

@@ -550,29 +550,30 @@ func (VmStockFlow) TableName() string {
550 550
 }
551 551
 
552 552
 type CancelStockInfo struct {
553
-	ID              int64       `gorm:"column:id" json:"id"`
554
-	GoodId          int64       `gorm:"column:good_id" json:"good_id"`
555
-	CancelStockId   int64       `gorm:"column:cancel_stock_id" json:"cancel_stock_id"`
556
-	GoodTypeId      int64       `gorm:"column:good_type_id" json:"good_type_id"`
557
-	Count           int64       `gorm:"column:count" json:"count"`
558
-	Price           float64     `gorm:"column:price" json:"price"`
559
-	Total           float64     `gorm:"column:total" json:"total"`
560
-	ProductDate     int64       `gorm:"column:product_date" json:"product_date"`
561
-	ExpiryDate      int64       `gorm:"column:expiry_date" json:"expiry_date"`
562
-	Ctime           int64       `gorm:"column:ctime" json:"ctime"`
563
-	Mtime           int64       `gorm:"column:mtime" json:"mtime"`
564
-	Status          int64       `gorm:"column:status" json:"status"`
565
-	OrgId           int64       `gorm:"column:org_id" json:"org_id"`
566
-	OrderNumber     string      `gorm:"column:order_number" json:"order_number"`
567
-	Type            int64       `gorm:"column:type" json:"type"`
568
-	CancelStock     CancelStock `ForeignKey:CancelStockId json:"CancelStock"`
569
-	Dealer          string      `gorm:"column:dealer" json:"dealer"`
570
-	Manufacturer    string      `gorm:"column:manufacturer" json:"manufacturer"`
571
-	Number          string      `gorm:"column:number" json:"number" form:"number"`
572
-	RegisterAccount string      `gorm:"column:register_account" json:"register_account" form:"register_account"`
573
-	Remark          string      `gorm:"column:remark" json:"remark" form:"remark"`
574
-	WarehouseInfoId int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
575
-	GoodInfo        GoodInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
553
+	ID              int64              `gorm:"column:id" json:"id"`
554
+	GoodId          int64              `gorm:"column:good_id" json:"good_id"`
555
+	CancelStockId   int64              `gorm:"column:cancel_stock_id" json:"cancel_stock_id"`
556
+	GoodTypeId      int64              `gorm:"column:good_type_id" json:"good_type_id"`
557
+	Count           int64              `gorm:"column:count" json:"count"`
558
+	Price           float64            `gorm:"column:price" json:"price"`
559
+	Total           float64            `gorm:"column:total" json:"total"`
560
+	ProductDate     int64              `gorm:"column:product_date" json:"product_date"`
561
+	ExpiryDate      int64              `gorm:"column:expiry_date" json:"expiry_date"`
562
+	Ctime           int64              `gorm:"column:ctime" json:"ctime"`
563
+	Mtime           int64              `gorm:"column:mtime" json:"mtime"`
564
+	Status          int64              `gorm:"column:status" json:"status"`
565
+	OrgId           int64              `gorm:"column:org_id" json:"org_id"`
566
+	OrderNumber     string             `gorm:"column:order_number" json:"order_number"`
567
+	Type            int64              `gorm:"column:type" json:"type"`
568
+	CancelStock     CancelStock        `ForeignKey:CancelStockId json:"CancelStock"`
569
+	Dealer          string             `gorm:"column:dealer" json:"dealer"`
570
+	Manufacturer    string             `gorm:"column:manufacturer" json:"manufacturer"`
571
+	Number          string             `gorm:"column:number" json:"number" form:"number"`
572
+	RegisterAccount string             `gorm:"column:register_account" json:"register_account" form:"register_account"`
573
+	Remark          string             `gorm:"column:remark" json:"remark" form:"remark"`
574
+	WarehouseInfoId int64              `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
575
+	GoodInfo        GoodInfo           `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
576
+	WarehousingInfo []*WarehousingInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:GoodId" json:"xt_warehouse_info"`
576 577
 }
577 578
 
578 579
 func (CancelStockInfo) TableName() string {

+ 31 - 4
service/stock_service.go 파일 보기

@@ -1157,7 +1157,7 @@ func FindReturnInfoById(id int64) (list []*models.SalesReturnInfo, err error) {
1157 1157
 }
1158 1158
 
1159 1159
 func FindCancelStockInfoById(id int64) (list []*models.CancelStockInfo, err error) {
1160
-	err = readDb.Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? AND status = 1", id).Preload("GoodInfo", "status = 1").Find(&list).Error
1160
+	err = readDb.Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? AND status = 1", id).Preload("WarehousingInfo", "status = 1").Preload("GoodInfo", "status = 1").Find(&list).Error
1161 1161
 	return list, err
1162 1162
 }
1163 1163
 
@@ -1550,6 +1550,12 @@ func GetLastCancelStockById(orgid int64) (models.CancelStock, error) {
1550 1550
 	return stock, err
1551 1551
 }
1552 1552
 
1553
+func GetLastDrugCancelStockById(orgid int64) (models.DrugCancelStock, error) {
1554
+	stock := models.DrugCancelStock{}
1555
+	err := XTReadDB().Where("org_id = ? and status = 1", orgid).Last(&stock).Error
1556
+	return stock, err
1557
+}
1558
+
1553 1559
 func AddSigleDrugCancelStock(cancelStock *models.DrugCancelStock) error {
1554 1560
 	err := writeDb.Create(&cancelStock).Error
1555 1561
 	return err
@@ -3189,9 +3195,13 @@ func GetSearchDrugList(keywords string, orgid int64) (drug []*models.BaseDrugLib
3189 3195
 	db := XTReadDB().Model(&drug).Where("org_id=? and status=1  and drug_status<>'停用'", orgid)
3190 3196
 	if len(keywords) > 0 {
3191 3197
 		likekey := "%" + keywords + "%"
3192
-		err = db.Where("(drug_name LIKE ?)", likekey).Find(&drug).Error
3198
+		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
3199
+			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0", orgid).Group("id")
3200
+		}).Find(&drug).Error
3193 3201
 	} else {
3194
-		err = db.Find(&drug).Error
3202
+		err = db.Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
3203
+			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0", orgid).Group("id")
3204
+		}).Find(&drug).Error
3195 3205
 	}
3196 3206
 	return
3197 3207
 }
@@ -3205,7 +3215,9 @@ func GetSearchGoodList(keywords string, orgid int64) (good []*models.GoodInfo, e
3205 3215
 			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0", orgid)
3206 3216
 		}).Find(&good).Error
3207 3217
 	} else {
3208
-		err = db.Find(&good).Error
3218
+		err = db.Preload("StWarehousingInfo", func(db *gorm.DB) *gorm.DB {
3219
+			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0", orgid)
3220
+		}).Find(&good).Error
3209 3221
 	}
3210 3222
 	return
3211 3223
 }
@@ -3880,6 +3892,21 @@ func GetWarehoureOrderInfoCount(goodid int64, orgid int64, id int64) (info model
3880 3892
 	return info, err
3881 3893
 }
3882 3894
 
3895
+func GetWarehoureOrderStockOutFlow(goodid int64, orgid int64, id int64) (info models.VmStockFlow, err error) {
3896
+	db := XTReadDB().Table("xt_stock_flow as x").Where("x.status =1 and x.consumable_type = 2 or x.consumable_type = 3")
3897
+	if goodid > 0 {
3898
+		db = db.Where("x.good_id = ?", goodid)
3899
+	}
3900
+	if orgid > 0 {
3901
+		db = db.Where("x.user_org_id = ?", orgid)
3902
+	}
3903
+	if id > 0 {
3904
+		db = db.Where("x.warehousing_id = ?", id)
3905
+	}
3906
+	err = db.Select("x.good_id,sum(x.count) as count").Scan(&info).Error
3907
+	return info, err
3908
+}
3909
+
3883 3910
 func UpdateCancelInfo(id int64) (models.CancelStock, error) {
3884 3911
 	stock := models.CancelStock{}
3885 3912
 	err := XTWriteDB().Model(&stock).Where("id=? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error