Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
e95d3cd38d

+ 4 - 1
controllers/manager_center_api_controller.go View File

@@ -1496,7 +1496,7 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1496 1496
 	min_unit := c.GetString("min_unit")
1497 1497
 	default_count_unit := c.GetString("default_count_unit")
1498 1498
 	is_user, _ := c.GetInt64("is_user")
1499
-	fmt.Println("is_user23232332323232233323223232323", is_user)
1499
+	number := c.GetString("number")
1500 1500
 	adminUserInfo := c.GetAdminUserInfo()
1501 1501
 
1502 1502
 	totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
@@ -1558,6 +1558,7 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1558 1558
 		RegisterNumber:              register_number,
1559 1559
 		ProvincesCode:               provinces_code,
1560 1560
 		IsUser:                      is_user,
1561
+		Number:                      number,
1561 1562
 	}
1562 1563
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1563 1564
 	if err == nil {
@@ -1624,6 +1625,7 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1624 1625
 	total, _ := c.GetFloat("total")
1625 1626
 	register_number := c.GetString("register_number")
1626 1627
 	is_user, _ := c.GetInt64("is_user")
1628
+	number := c.GetString("number")
1627 1629
 	adminUserInfo := c.GetAdminUserInfo()
1628 1630
 
1629 1631
 	goodInfo := models.GoodInfo{
@@ -1677,6 +1679,7 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1677 1679
 		Total:                       total,
1678 1680
 		RegisterNumber:              register_number,
1679 1681
 		IsUser:                      is_user,
1682
+		Number:                      number,
1680 1683
 	}
1681 1684
 
1682 1685
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)

+ 1 - 0
models/good_models.go View File

@@ -84,6 +84,7 @@ type GoodInfo struct {
84 84
 	RegisterNumber              string               `gorm:"column:register_number" json:"register_number" form:"register_number"`
85 85
 	GoodSotckInfo               []*GoodSotckInfo     `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_stock_in"`
86 86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
87
+	Number                      string               `gorm:"column:number" json:"number" form:"number"`
87 88
 }
88 89
 
89 90
 func (GoodInfo) TableName() string {

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

@@ -36,6 +36,7 @@ type SpBaseDrug struct {
36 36
 	Number            string                 `gorm:"column:number" json:"number" form:"number"`
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
+	DrugStatus        string                 `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
39 40
 }
40 41
 
41 42
 func (SpBaseDrug) TableName() string {
@@ -52,7 +53,9 @@ type SpGoodInformation struct {
52 53
 	GoodName          string             `gorm:"column:good_name" json:"good_name" form:"good_name"`
53 54
 	PackingUnit       string             `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
54 55
 	BuyPrice          float64            `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
56
+	GoodStatus        string             `gorm:"column:good_status" json:"good_status" form:"good_status"`
55 57
 	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
58
+	Number            string             `gorm:"column:number" json:"number" form:"number"`
56 59
 }
57 60
 
58 61
 func (SpGoodInformation) TableName() string {

+ 1 - 0
service/stock_service.go View File

@@ -250,6 +250,7 @@ func ModifyGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
250 250
 		"register_number":                goodInfo.RegisterNumber,
251 251
 		"provinces_code":                 goodInfo.ProvincesCode,
252 252
 		"is_user":                        goodInfo.IsUser,
253
+		"number":                         goodInfo.Number,
253 254
 	}).Error
254 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})

+ 5 - 5
service/supply_service.go View File

@@ -308,7 +308,7 @@ func SaveContacts(spcontacts models.SpSupplierContacts, tx *gorm.DB) error {
308 308
 
309 309
 func GetSupplyDrugList(orgid int64) (drug []*models.SpBaseDrug, err error) {
310 310
 
311
-	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1")
311
+	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1 AND find_in_set('停用',drug_status) = 0")
312 312
 
313 313
 	if orgid > 0 {
314 314
 		db = db.Where("x.org_id = ?", orgid)
@@ -320,7 +320,7 @@ func GetSupplyDrugList(orgid int64) (drug []*models.SpBaseDrug, err error) {
320 320
 
321 321
 func GetSupplyGoodList(orgid int64) (good []*models.SpGoodInformation, err error) {
322 322
 
323
-	db := XTReadDB().Table("xt_good_information as x").Where("x.status = 1")
323
+	db := XTReadDB().Table("xt_good_information as x").Where("x.status = 1 AND find_in_set('停用',good_status) = 0")
324 324
 
325 325
 	if orgid > 0 {
326 326
 		db = db.Where("x.org_id = ?", orgid)
@@ -382,7 +382,7 @@ func GetAllPurchaseOrderList(check_id int64, startime int64, endtime int64, keyw
382 382
 	if orgid > 0 {
383 383
 		db = db.Where("sgj_xt.xt_supplier_warehouse_info.user_org_id = ?", orgid)
384 384
 	}
385
-	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SupplierWarehousingInfoOrder", "status= 1 and user_org_id = ?", orgid).Preload("SpSupplierWarehouseOut", "status = 1 and user_org_id =?", orgid).Find(&info).Error
385
+	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SupplierWarehousingInfoOrder", "status= 1 and user_org_id = ?", orgid).Preload("SpSupplierWarehouseOut", "status = 1 and user_org_id =?", orgid).Order("ctime desc").Find(&info).Error
386 386
 	return info, total, err
387 387
 }
388 388
 
@@ -479,7 +479,7 @@ func GetAllGoodOderList(check_id int64, keyword string, page int64, limit int64,
479 479
 	if orgid > 0 {
480 480
 		db = db.Where("sgj_xt.xt_supplier_warehouse_out.user_org_id = ?", orgid)
481 481
 	}
482
-	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingOutOrder", "status= 1 and user_org_id = ?", orgid).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Find(&out).Error
482
+	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingOutOrder", "status= 1 and user_org_id = ?", orgid).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Order("ctime desc").Find(&out).Error
483 483
 	return out, total, err
484 484
 }
485 485
 
@@ -653,7 +653,7 @@ func GetAllGoodReturnOrderList(checkid int64, keyword string, page int64, limit
653 653
 	if orgid > 0 {
654 654
 		db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.user_org_id = ?", orgid)
655 655
 	}
656
-	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Find(&order).Error
656
+	err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Order("ctime desc").Find(&order).Error
657 657
 	return order, total, err
658 658
 }
659 659