Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
0cdbcccbce
3 changed files with 60 additions and 0 deletions
  1. 12 0
      controllers/stock_in_api_controller.go
  2. 33 0
      models/stock_models.go
  3. 15 0
      service/stock_service.go

+ 12 - 0
controllers/stock_in_api_controller.go View File

@@ -85,6 +85,8 @@ func StockManagerApiRegistRouters() {
85 85
 	beego.Router("/api/stock/getstockoutlist", &StockManagerApiController{}, "Get:GetStockOutList")
86 86
 
87 87
 	beego.Router("/api/good/getstockdrugcount", &StockManagerApiController{}, "Get:GetStockDrugCount")
88
+
89
+	beego.Router("/api/good/getorderdetialbyorderid", &StockManagerApiController{}, "Get:GetOrderDetialByOrderId")
88 90
 }
89 91
 
90 92
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -3774,3 +3776,13 @@ func (this *StockManagerApiController) GetStockDrugCount() {
3774 3776
 		"autoCount": autoCount,
3775 3777
 	})
3776 3778
 }
3779
+
3780
+func (this *StockManagerApiController) GetOrderDetialByOrderId() {
3781
+
3782
+	id, _ := this.GetInt64("id")
3783
+	orgId := this.GetAdminUserInfo().CurrentOrgId
3784
+	list, _ := service.GetOrderDetialByOrderId(id, orgId)
3785
+	this.ServeSuccessJSON(map[string]interface{}{
3786
+		"list": list,
3787
+	})
3788
+}

+ 33 - 0
models/stock_models.go View File

@@ -357,4 +357,37 @@ type VmWarehouseOutInfo struct {
357 357
 type VmWarehouseInfo struct {
358 358
 	GoodId int64 `gorm:"column:good_id" json:"good_id"`
359 359
 	Count  int64 `gorm:"column:count" json:"count"`
360
+	OrgId  int64 `gorm:"column:org_id" json:"org_id"`
361
+}
362
+
363
+type WarehouseOutInfoOne struct {
364
+	ID                      int64   `gorm:"column:id" json:"id"`
365
+	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
366
+	WarehouseInfotId        int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
367
+	GoodId                  int64   `gorm:"column:good_id" json:"good_id"`
368
+	GoodTypeId              int64   `gorm:"column:good_type_id" json:"good_type_id"`
369
+	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
370
+	Count                   int64   `gorm:"column:count" json:"count"`
371
+	Price                   float64 `gorm:"column:price" json:"price"`
372
+	TotalPrice              float64 `gorm:"column:total_price" json:"total_price"`
373
+	ProductDate             int64   `gorm:"column:product_date" json:"product_date"`
374
+	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date"`
375
+	Mtime                   int64   `gorm:"column:mtime" json:"mtime"`
376
+	Ctime                   int64   `gorm:"column:ctime" json:"ctime"`
377
+	Status                  int64   `gorm:"column:status" json:"status"`
378
+	OrgId                   int64   `gorm:"column:org_id" json:"org_id"`
379
+	Remark                  string  `gorm:"column:remark" json:"remark"`
380
+	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel"`
381
+	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
382
+	Type                    int64   `gorm:"column:type" json:"type"`
383
+	Dealer                  int64   `gorm:"column:dealer" json:"dealer"`
384
+	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer"`
385
+	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys"`
386
+	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time"`
387
+	PatientId               int64   `gorm:"column:patient_id" json:"patient_id"`
388
+	GoodName                string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
389
+	SpecificationName       string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
390
+	MinNumber               int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
391
+	PackingPrice            float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
392
+	MinUnit                 string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
360 393
 }

+ 15 - 0
service/stock_service.go View File

@@ -2848,3 +2848,18 @@ func GetOutStockTotalCountFour(startime int64, endtime int64, orgid int64) (auto
2848 2848
 	return autoMatic, err
2849 2849
 
2850 2850
 }
2851
+
2852
+func GetOrderDetialByOrderId(id int64, orgid int64) (out []*models.WarehouseOutInfoOne, err error) {
2853
+
2854
+	db := XTReadDB().Table("xt_warehouse_out_info as x").Where("x.status = 1")
2855
+	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
2856
+	fmt.Println(table)
2857
+	if id > 0 {
2858
+		db = db.Where("x.warehouse_out_id = ?", id)
2859
+	}
2860
+	if orgid > 0 {
2861
+		db = db.Where("x.org_id = ?", orgid)
2862
+	}
2863
+	err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.good_id").Order("x.ctime desc").Scan(&out).Error
2864
+	return out, err
2865
+}