Browse Source

11月8日库存管理

XMLWAN 3 years ago
parent
commit
88570c2bcc

+ 4 - 0
controllers/stock_in_api_controller.go View File

@@ -690,6 +690,10 @@ func (c *StockManagerApiController) EditWarehouse() {
690 690
 				}
691 691
 
692 692
 				service.UpdateWarehouseInfoByGoodId(goodinfo, item.ID)
693
+				flowStock := models.VmStockFlow{
694
+					Count: item.WarehousingCount,
695
+				}
696
+				service.UpdatedStockFlowByGoodId(item.WarehousingId, item.GoodId, flowStock)
693 697
 				//改变库存
694 698
 				good, _ := service.GetLastInfoMationById(info.GoodId)
695 699
 				warhouseCount := strconv.FormatInt(total, 10)

+ 1 - 1
models/dialysis.go View File

@@ -862,7 +862,7 @@ type XtDialysisOrders struct {
862 862
 	FinishCreator  int64  `gorm:"column:finish_creator" json:"finish_creator" form:"finish_creator"`
863 863
 	FinishModifier int64  `gorm:"column:finish_modifier" json:"finish_modifier" form:"finish_modifier"`
864 864
 	SchedualType   int64  `gorm:"column:schedual_type" json:"schedual_type" form:"schedual_type"`
865
-	Number         int64  `gorm:"column:number" json:"number" form:"number"`
865
+	Number         string `gorm:"column:number" json:"number" form:"number"`
866 866
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
867 867
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
868 868
 	ModeId         int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`

+ 1 - 1
service/patient_service.go View File

@@ -947,7 +947,7 @@ func GetPatientDialysisRecord(orgID, patientID int64, page, limit, start, end, m
947 947
 		}).
948 948
 		Joins("JOIN xt_schedule as s ON s.patient_id=? and FROM_UNIXTIME(s.schedule_date, '%Y-%m-%d')=FROM_UNIXTIME(do.dialysis_date, '%Y-%m-%d')", patientID).
949 949
 		Joins("JOIN xt_device_zone as dz ON dz.org_id = ? and dz.id=s.partition_id", orgID).
950
-		Where("do.patient_id=? and do.user_org_id=? and do.stage = 2 and do.status=1", patientID, orgID).Group("s.schedule_date")
950
+		Where("do.patient_id=? and do.user_org_id=?  and do.status=1", patientID, orgID).Group("s.schedule_date")
951 951
 
952 952
 	if start != 0 {
953 953
 		db = db.Where("do.dialysis_date>=?", start)

+ 1 - 1
service/self_drug_service.go View File

@@ -903,7 +903,7 @@ func GetDrugDamageList(startime int64, endtime int64, orgId int64, keyword strin
903 903
 }
904 904
 
905 905
 func GetDrugDamageByOrgId(orgid int64) (list []*models.XtDrugInventory, err error) {
906
-	err = XTReadDB().Model(&list).Where("user_org_id = ? and inventory_type = 11 and status = 1", orgid).Find(&list).Error
906
+	err = XTReadDB().Model(&list).Where("user_org_id = ? and type = 4 and status = 1", orgid).Find(&list).Error
907 907
 	return list, err
908 908
 }
909 909
 

+ 7 - 1
service/stock_service.go View File

@@ -3835,7 +3835,7 @@ func GetCancelStockOrderPrintOne(idstr []string, orgid int64) (info []*models.Ca
3835 3835
 
3836 3836
 func GetCancelOutTotalCount(startime int64, endtime int64, orgid int64) (info []*models.VmCancelStockInfo, err error) {
3837 3837
 
3838
-	db := XTReadDB().Table("xt_cancel_stock_info as x").Where("x.status = 1")
3838
+	db := readDb2.Table("xt_cancel_stock_info as x").Where("x.status = 1")
3839 3839
 
3840 3840
 	if startime > 0 {
3841 3841
 		db = db.Where("x.ctime >=?", startime)
@@ -4987,3 +4987,9 @@ func UpdateWarehouseInfoByGoodIdOne(info models.WarehousingInfo, id int64) error
4987 4987
 	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark}).Error
4988 4988
 	return err
4989 4989
 }
4990
+
4991
+func UpdatedStockFlowByGoodId(warehousing_id int64, good_id int64, flow models.VmStockFlow) error {
4992
+
4993
+	err := XTWriteDB().Model(&flow).Where("warehousing_id = ? and good_id = ? and status = 1", warehousing_id, good_id).Updates(map[string]interface{}{"count": flow.Count}).Error
4994
+	return err
4995
+}