Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
4365eb8f50

+ 4 - 0
controllers/manager_center_api_controller.go View File

1497
 	default_count_unit := c.GetString("default_count_unit")
1497
 	default_count_unit := c.GetString("default_count_unit")
1498
 	is_user, _ := c.GetInt64("is_user")
1498
 	is_user, _ := c.GetInt64("is_user")
1499
 	number := c.GetString("number")
1499
 	number := c.GetString("number")
1500
+	is_warehouse, _ := c.GetInt64("is_warehouse")
1500
 	adminUserInfo := c.GetAdminUserInfo()
1501
 	adminUserInfo := c.GetAdminUserInfo()
1501
 
1502
 
1502
 	totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
1503
 	totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
1559
 		ProvincesCode:               provinces_code,
1560
 		ProvincesCode:               provinces_code,
1560
 		IsUser:                      is_user,
1561
 		IsUser:                      is_user,
1561
 		Number:                      number,
1562
 		Number:                      number,
1563
+		IsWarehouse:                 is_warehouse,
1562
 	}
1564
 	}
1563
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1565
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1564
 	if err == nil {
1566
 	if err == nil {
1626
 	register_number := c.GetString("register_number")
1628
 	register_number := c.GetString("register_number")
1627
 	is_user, _ := c.GetInt64("is_user")
1629
 	is_user, _ := c.GetInt64("is_user")
1628
 	number := c.GetString("number")
1630
 	number := c.GetString("number")
1631
+	is_warehouse, _ := c.GetInt64("is_warehouse")
1629
 	adminUserInfo := c.GetAdminUserInfo()
1632
 	adminUserInfo := c.GetAdminUserInfo()
1630
 
1633
 
1631
 	goodInfo := models.GoodInfo{
1634
 	goodInfo := models.GoodInfo{
1680
 		RegisterNumber:              register_number,
1683
 		RegisterNumber:              register_number,
1681
 		IsUser:                      is_user,
1684
 		IsUser:                      is_user,
1682
 		Number:                      number,
1685
 		Number:                      number,
1686
+		IsWarehouse:                 is_warehouse,
1683
 	}
1687
 	}
1684
 
1688
 
1685
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)
1689
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)

+ 1 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

4752
 			})
4752
 			})
4753
 			return
4753
 			return
4754
 		}
4754
 		}
4755
+
4755
 	}
4756
 	}
4756
 
4757
 
4757
 	//出库逻辑
4758
 	//出库逻辑

+ 1 - 0
models/good_models.go View File

85
 	GoodSotckInfo               []*GoodSotckInfo     `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_stock_in"`
85
 	GoodSotckInfo               []*GoodSotckInfo     `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_stock_in"`
86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
87
 	Number                      string               `gorm:"column:number" json:"number" form:"number"`
87
 	Number                      string               `gorm:"column:number" json:"number" form:"number"`
88
+	IsWarehouse                 int64                `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
88
 }
89
 }
89
 
90
 
90
 func (GoodInfo) TableName() string {
91
 func (GoodInfo) TableName() string {

+ 1 - 1
service/mobile_dialysis_service.go View File

3433
 
3433
 
3434
 func GetHisPrescriptionProject(org_id int64, patient_id int64, record_date int64) (project []*models.HisPrescriptionProject, err error) {
3434
 func GetHisPrescriptionProject(org_id int64, patient_id int64, record_date int64) (project []*models.HisPrescriptionProject, err error) {
3435
 	err = readDb.Model(&models.HisPrescriptionProject{}).Preload("GoodInfo", func(db *gorm.DB) *gorm.DB {
3435
 	err = readDb.Model(&models.HisPrescriptionProject{}).Preload("GoodInfo", func(db *gorm.DB) *gorm.DB {
3436
-		return db.Preload("GoodsType", "status = 1").Where("status = 1 and is_user = 2")
3436
+		return db.Preload("GoodsType", "status = 1").Where("status = 1 and is_warehouse = 1")
3437
 	}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND type = 3", org_id, record_date, patient_id).Find(&project).Error
3437
 	}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND type = 3", org_id, record_date, patient_id).Find(&project).Error
3438
 
3438
 
3439
 	return
3439
 	return

+ 2 - 2
service/stock_service.go View File

196
 }
196
 }
197
 
197
 
198
 func AddSigleGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
198
 func AddSigleGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
199
-	fmt.Println("goodino232323232323232323", goodInfo.IsUse)
200
 	err := writeDb.Create(&goodInfo).Error
199
 	err := writeDb.Create(&goodInfo).Error
201
 	return err, goodInfo
200
 	return err, goodInfo
202
 
201
 
251
 		"provinces_code":                 goodInfo.ProvincesCode,
250
 		"provinces_code":                 goodInfo.ProvincesCode,
252
 		"is_user":                        goodInfo.IsUser,
251
 		"is_user":                        goodInfo.IsUser,
253
 		"number":                         goodInfo.Number,
252
 		"number":                         goodInfo.Number,
253
+		"is_warehouse":                   goodInfo.IsWarehouse,
254
 	}).Error
254
 	}).Error
255
 
255
 
256
 	writeDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND org_id = ?", goodInfo.ID, goodInfo.OrgId).Updates(map[string]interface{}{"good_type_id": goodInfo.GoodTypeId})
256
 	writeDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND org_id = ?", goodInfo.ID, goodInfo.OrgId).Updates(map[string]interface{}{"good_type_id": goodInfo.GoodTypeId})
364
 }
364
 }
365
 
365
 
366
 func FindAllGoodInfo(org_id int64) (goodInfo []*models.GoodInfo, err error) {
366
 func FindAllGoodInfo(org_id int64) (goodInfo []*models.GoodInfo, err error) {
367
-	err = XTReadDB().Model(&models.GoodInfo{}).Where("org_id = ? AND status = 1 and is_user = 2", org_id).Find(&goodInfo).Error
367
+	err = XTReadDB().Model(&models.GoodInfo{}).Where("org_id = ? AND status = 1 and is_warehouse = 1", org_id).Find(&goodInfo).Error
368
 	return goodInfo, err
368
 	return goodInfo, err
369
 }
369
 }
370
 
370