28169 1 gadu atpakaļ
vecāks
revīzija
e4b2043a57

+ 2 - 2
controllers/dialysis_api_controller.go Parādīt failu

2564
 			service.CreateDialysisFinish(finish)
2564
 			service.CreateDialysisFinish(finish)
2565
 		}
2565
 		}
2566
 
2566
 
2567
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 {
2567
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 {
2568
 			var dewater_amount float64
2568
 			var dewater_amount float64
2569
 			dewater_amount = 0
2569
 			dewater_amount = 0
2570
 			if dry_weight > 0 {
2570
 			if dry_weight > 0 {
2571
 				dewater_amount = weight_before - dry_weight - additional_weight
2571
 				dewater_amount = weight_before - dry_weight - additional_weight
2572
 
2572
 
2573
-				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 && adminUserInfo.CurrentOrgId != 10344 {
2573
+				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 && adminUserInfo.CurrentOrgId != 10344 && adminUserInfo.CurrentOrgId != 10622 {
2574
 					dewater_amount = dewater_amount * 1000
2574
 					dewater_amount = dewater_amount * 1000
2575
 				}
2575
 				}
2576
 
2576
 

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go Parādīt failu

1696
 				//fmt.Println("config+++++++++++", config.IsOpen)
1696
 				//fmt.Println("config+++++++++++", config.IsOpen)
1697
 				//fmt.Println("config+++++++++++", item.UserOrgId)
1697
 				//fmt.Println("config+++++++++++", item.UserOrgId)
1698
 				//
1698
 				//
1699
-				if config.IsOpen == 1 && item.UserOrgId == 10402 {
1700
-
1701
-					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1702
-					//更新字典里面的库存
1703
-					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1704
-					var sum_count int64
1705
-					for _, its := range stockInfo {
1706
-						if its.MaxUnit == medical.MaxUnit {
1707
-							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1708
-						}
1709
-						sum_count += its.StockMaxNumber + its.StockMinNumber
1710
-					}
1711
-					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1712
-					//剩余库存
1713
-					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1714
-				}
1699
+				//if config.IsOpen == 1 && item.UserOrgId == 10402 {
1700
+				//
1701
+				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1702
+				//	//更新字典里面的库存
1703
+				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1704
+				//	var sum_count int64
1705
+				//	for _, its := range stockInfo {
1706
+				//		if its.MaxUnit == medical.MaxUnit {
1707
+				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1708
+				//		}
1709
+				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1710
+				//	}
1711
+				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1712
+				//	//剩余库存
1713
+				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1714
+				//}
1715
 
1715
 
1716
 			}
1716
 			}
1717
 		}
1717
 		}

+ 7 - 7
controllers/sign_api_controller.go Parādīt failu

1232
 	//	service.ModifyPatient(item.PatientId, item.Count)
1232
 	//	service.ModifyPatient(item.PatientId, item.Count)
1233
 	//}
1233
 	//}
1234
 
1234
 
1235
-	list, _ := service.GetNewAllpatient(orgId)
1235
+	//list, _ := service.GetNewAllpatient(orgId)
1236
+	//
1237
+	//for _, item := range list {
1238
+	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1239
+	//}
1236
 
1240
 
1241
+	list, _ := service.GetAllDialysisOrder(10490)
1237
 	for _, item := range list {
1242
 	for _, item := range list {
1238
-		service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1243
+		service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1239
 	}
1244
 	}
1240
 
1245
 
1241
-	//list, _ := service.GetAllDialysisOrder(6963)
1242
-	//for _, item := range list {
1243
-	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1244
-	//}
1245
-
1246
 	//drugList, _ := service.GetAllBaseDrugList(10571)
1246
 	//drugList, _ := service.GetAllBaseDrugList(10571)
1247
 	//for _, item := range drugList {
1247
 	//for _, item := range drugList {
1248
 	//	//service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
1248
 	//	//service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)

+ 1 - 7
service/new_stock_service.go Parādīt failu

66
 
66
 
67
 func CreateGoodErrcode(errcode models.XtGoodErrcode) error {
67
 func CreateGoodErrcode(errcode models.XtGoodErrcode) error {
68
 
68
 
69
-	db := writeDb.Begin()
70
-	err := db.Create(&errcode).Error
71
-	if err != nil {
72
-		db.Rollback()
73
-		return err
74
-	}
75
-	db.Commit()
69
+	err := writeDb.Create(&errcode).Error
76
 	return err
70
 	return err
77
 }
71
 }
78
 
72
 

+ 8 - 11
service/new_warehouse_service.go Parādīt failu

580
 func UpdateDrugStockCount(drug_id int64, org_id int64, storehouse_id int64, flush_count int64) error {
580
 func UpdateDrugStockCount(drug_id int64, org_id int64, storehouse_id int64, flush_count int64) error {
581
 
581
 
582
 	drug := models.XtDrugStockCount{}
582
 	drug := models.XtDrugStockCount{}
583
-	ut := XTWriteDB().Begin()
584
-	err := ut.Model(&drug).Where("drug_id = ? and user_org_id = ? and storehouse_id = ? and status = 1", drug_id, org_id, storehouse_id).Update(map[string]interface{}{"flush_count": flush_count}).Error
585
-	if err != nil {
586
-		ut.Rollback()
587
-		return err
588
-	}
589
-	ut.Commit()
583
+
584
+	err := XTWriteDB().Model(&drug).Where("drug_id = ? and user_org_id = ? and storehouse_id = ? and status = 1", drug_id, org_id, storehouse_id).Update(map[string]interface{}{"flush_count": flush_count}).Error
585
+
590
 	return err
586
 	return err
591
 }
587
 }
592
 
588
 
3862
 		UpDateNewDrugWarehouseInfoByStock(&warehouse, tx)
3858
 		UpDateNewDrugWarehouseInfoByStock(&warehouse, tx)
3863
 
3859
 
3864
 		//更改字典里面的价格
3860
 		//更改字典里面的价格
3865
-		if advice.UserOrgId == 10265 || advice.UserOrgId == 10215 {
3866
-
3867
-			UpdateNewBasePrice(lastWarehouse.DrugId, lastWarehouse.RetailPrice, tx)
3868
-		}
3861
+		//if advice.UserOrgId == 10265 || advice.UserOrgId == 10215 {
3862
+		//
3863
+		//	UpdateNewBasePrice(lastWarehouse.DrugId, lastWarehouse.RetailPrice, tx)
3864
+		//}
3869
 		//
3865
 		//
3870
 		////查询剩余库存
3866
 		////查询剩余库存
3871
 		stockInfo, _ := GetNewDrugAllStockInfo(storeConfig.DrugStorehouseOut, orgID, advice.DrugId, tx)
3867
 		stockInfo, _ := GetNewDrugAllStockInfo(storeConfig.DrugStorehouseOut, orgID, advice.DrugId, tx)
4147
 			StorehouseId:            storeConfig.DrugStorehouseOut,
4143
 			StorehouseId:            storeConfig.DrugStorehouseOut,
4148
 			AdviceId:                advice.ID,
4144
 			AdviceId:                advice.ID,
4149
 		}
4145
 		}
4146
+
4150
 		AddNewSigleDrugAutoReduceRecordInfo(details, tx)
4147
 		AddNewSigleDrugAutoReduceRecordInfo(details, tx)
4151
 
4148
 
4152
 		return nil
4149
 		return nil

+ 2 - 2
service/sign_service.go Parādīt failu

2112
 
2112
 
2113
 func GetAllDialysisOrder(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2113
 func GetAllDialysisOrder(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2114
 
2114
 
2115
-	err = XTReadDB().Where("patient_id = ? and status =1", 6963).Find(&list).Error
2115
+	err = XTReadDB().Where("patient_id = ? and status =1", 21767).Find(&list).Error
2116
 
2116
 
2117
 	return list, err
2117
 	return list, err
2118
 }
2118
 }
2119
 
2119
 
2120
 func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) error {
2120
 func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) error {
2121
 
2121
 
2122
-	err := XTWriteDB().Model(&models.XtSchedule{}).Where("schedule_date =? and user_org_id =? and status=1 and patient_id =?", schedule_date, user_org_id, patient_id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type}).Error
2122
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("schedule_date =? and user_org_id =? and patient_id =?", schedule_date, user_org_id, patient_id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1}).Error
2123
 	return err
2123
 	return err
2124
 }
2124
 }
2125
 
2125
 

+ 43 - 103
service/stock_service.go Parādīt failu

1391
 func FindNewAllDrugCancelStockTotal(org_id int64, tx *gorm.DB) (total int64, err error) {
1391
 func FindNewAllDrugCancelStockTotal(org_id int64, tx *gorm.DB) (total int64, err error) {
1392
 
1392
 
1393
 	err = tx.Model(&models.DrugCancelStock{}).Where("org_id = ?", org_id).Count(&total).Error
1393
 	err = tx.Model(&models.DrugCancelStock{}).Where("org_id = ?", org_id).Count(&total).Error
1394
-	if err != nil {
1395
-		tx.Rollback()
1396
-		return total, err
1394
+	if err != gorm.ErrRecordNotFound {
1395
+		if err != nil {
1396
+			tx.Rollback()
1397
+			return total, err
1398
+		}
1397
 	}
1399
 	}
1400
+
1398
 	return total, err
1401
 	return total, err
1399
 }
1402
 }
1400
 
1403
 
8139
 }
8142
 }
8140
 
8143
 
8141
 func UpdateGoodInfoAddSumCount(goodid int64, sum_count int64, orgid int64, sum_in_count int64) error {
8144
 func UpdateGoodInfoAddSumCount(goodid int64, sum_count int64, orgid int64, sum_in_count int64) error {
8142
-	tx := XTWriteDB().Begin()
8143
-	err := tx.Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8144
-	if err != nil {
8145
-		tx.Rollback()
8146
-		return err
8147
-	}
8148
-	err = tx.Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
8149
-	if err != nil {
8150
-		tx.Rollback()
8151
-		return err
8152
-	}
8153
-	tx.Commit()
8145
+
8146
+	err := XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8147
+
8148
+	err = XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
8149
+
8154
 	return err
8150
 	return err
8155
 }
8151
 }
8156
 
8152
 
8185
 }
8181
 }
8186
 
8182
 
8187
 func CheckCancelStock(stock models.CancelStock, cancel_stock_id int64, orgid int64) error {
8183
 func CheckCancelStock(stock models.CancelStock, cancel_stock_id int64, orgid int64) error {
8188
-	ut := writeDb.Begin()
8189
-	err := ut.Model(&models.CancelStock{}).Where("id = ? and status = 1 and org_id = ?", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
8190
-	if err != nil {
8191
-		ut.Rollback()
8192
-		return err
8193
-	}
8194
-	err = ut.Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? and status = 1 and org_id = ?", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
8195
-	if err != nil {
8196
-		ut.Rollback()
8197
-		return err
8198
-	}
8199
-	ut.Commit()
8184
+
8185
+	err := XTWriteDB().Model(&models.CancelStock{}).Where("id = ? and status = 1 and org_id = ?", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
8186
+
8187
+	err = XTWriteDB().Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? and status = 1 and org_id = ?", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
8188
+
8200
 	return err
8189
 	return err
8201
 }
8190
 }
8202
 
8191
 
8207
 }
8196
 }
8208
 
8197
 
8209
 func UpdateCancelStockNumber(stock_count int64, warehouse_info_id int64, orgid int64) error {
8198
 func UpdateCancelStockNumber(stock_count int64, warehouse_info_id int64, orgid int64) error {
8210
-	ut := writeDb.Begin()
8211
-	err := ut.Model(&models.WarehousingInfo{}).Where("id = ? and org_id = ? and status = 1", warehouse_info_id, orgid).UpdateColumn("stock_count", gorm.Expr("stock_count + ?", stock_count)).Error
8212
-	if err != nil {
8213
-		ut.Rollback()
8214
-		return err
8215
-	}
8216
-	ut.Commit()
8199
+
8200
+	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and org_id = ? and status = 1", warehouse_info_id, orgid).UpdateColumn("stock_count", gorm.Expr("stock_count + ?", stock_count)).Error
8201
+
8217
 	return err
8202
 	return err
8218
 }
8203
 }
8219
 
8204
 
8220
 func UpdateGoodSumCount(sum_count int64, good_id int64, orgid int64) error {
8205
 func UpdateGoodSumCount(sum_count int64, good_id int64, orgid int64) error {
8221
-	ut := writeDb.Begin()
8222
-	err := ut.Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", good_id, orgid).UpdateColumn("sum_count", gorm.Expr("sum_count + ?", sum_count)).Error
8223
-	if err != nil {
8224
-		ut.Rollback()
8225
-		return err
8226
-	}
8227
-	ut.Commit()
8206
+
8207
+	err := XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", good_id, orgid).UpdateColumn("sum_count", gorm.Expr("sum_count + ?", sum_count)).Error
8208
+
8228
 	return err
8209
 	return err
8229
 }
8210
 }
8230
 
8211
 
8231
 func UpdateStockWarehouseInfo(cancel_stock_id int64, orgid int64, stock models.CancelStock) error {
8212
 func UpdateStockWarehouseInfo(cancel_stock_id int64, orgid int64, stock models.CancelStock) error {
8232
-	ut := writeDb.Begin()
8233
-	err := ut.Model(&models.CancelStock{}).Where("id = ? and org_id = ? and status = 1", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
8234
-	if err != nil {
8235
-		ut.Rollback()
8236
-		return err
8237
-	}
8238
-	err = ut.Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? and org_id = ? and status = 1", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
8239
-	if err != nil {
8240
-		ut.Rollback()
8241
-		return err
8242
-	}
8243
-	ut.Commit()
8213
+
8214
+	err := XTWriteDB().Model(&models.CancelStock{}).Where("id = ? and org_id = ? and status = 1", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
8215
+
8216
+	err = XTWriteDB().Model(&models.CancelStockInfo{}).Where("cancel_stock_id = ? and org_id = ? and status = 1", cancel_stock_id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
8217
+
8244
 	return err
8218
 	return err
8245
 }
8219
 }
8246
 
8220
 
8247
 func UpdateStockWarehouseInfoStockFlow(id int64, orgid int64, goodid int64) error {
8221
 func UpdateStockWarehouseInfoStockFlow(id int64, orgid int64, goodid int64) error {
8248
-	ut := writeDb.Begin()
8249
-	err = ut.Model(&models.VmStockFlow{}).Where("cancel_out_detail_id = ? and user_org_id = ? and status = 1 and good_id =?", id, orgid, goodid).Update(map[string]interface{}{"status": 0}).Error
8250
-	if err != nil {
8251
-		ut.Rollback()
8252
-		return err
8253
-	}
8254
-	ut.Commit()
8222
+
8223
+	err = XTWriteDB().Model(&models.VmStockFlow{}).Where("cancel_out_detail_id = ? and user_org_id = ? and status = 1 and good_id =?", id, orgid, goodid).Update(map[string]interface{}{"status": 0}).Error
8224
+
8255
 	return err
8225
 	return err
8256
 }
8226
 }
8257
 
8227
 
8258
 func UpdateStockNumberWarehouseInfo(warehouse_info_id int64, good_id int64, org_id int64, stock_count int64) error {
8228
 func UpdateStockNumberWarehouseInfo(warehouse_info_id int64, good_id int64, org_id int64, stock_count int64) error {
8259
-	ut := writeDb.Begin()
8229
+
8260
 	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and good_id = ? and org_id = ? and status = 1", warehouse_info_id, good_id, org_id).UpdateColumn("stock_count", gorm.Expr("stock_count - ?", stock_count)).Error
8230
 	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and good_id = ? and org_id = ? and status = 1", warehouse_info_id, good_id, org_id).UpdateColumn("stock_count", gorm.Expr("stock_count - ?", stock_count)).Error
8261
-	if err != nil {
8262
-		ut.Rollback()
8263
-		return err
8264
-	}
8231
+
8265
 	err = XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and status = 1 and org_id = ?", good_id, org_id).UpdateColumn("sum_count", gorm.Expr("sum_count - ?", stock_count)).Error
8232
 	err = XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and status = 1 and org_id = ?", good_id, org_id).UpdateColumn("sum_count", gorm.Expr("sum_count - ?", stock_count)).Error
8266
-	if err != nil {
8267
-		ut.Rollback()
8268
-		return err
8269
-	}
8270
-	ut.Commit()
8233
+
8271
 	return err
8234
 	return err
8272
 }
8235
 }
8273
 
8236
 
8311
 }
8274
 }
8312
 
8275
 
8313
 func UpdateBaseDrugSumInfo(sum_count int64, drugid int64, orgid int64, sum_in_count int64) error {
8276
 func UpdateBaseDrugSumInfo(sum_count int64, drugid int64, orgid int64, sum_in_count int64) error {
8314
-	ut := XTWriteDB().Begin()
8315
-	err := ut.Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8316
-	if err != nil {
8317
-		ut.Rollback()
8318
-		return err
8319
-	}
8320
-	err = ut.Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
8321
-	if err != nil {
8322
-		ut.Rollback()
8323
-		return err
8324
-	}
8325
-	ut.Commit()
8277
+
8278
+	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8279
+
8280
+	err = XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
8326
 	return err
8281
 	return err
8327
 }
8282
 }
8328
 
8283
 
8445
 }
8400
 }
8446
 
8401
 
8447
 func ModifyDrugMaxNumberWarehouseInfo(id int64, count int64, orgid int64) error {
8402
 func ModifyDrugMaxNumberWarehouseInfo(id int64, count int64, orgid int64) error {
8448
-	ut := XTWriteDB().Begin()
8449
-	err := ut.Model(&models.DrugWarehouseInfo{}).Where("id = ? and org_id = ? and status = 1", id, orgid).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
8450
-	if err != nil {
8451
-		ut.Rollback()
8452
-		return err
8453
-	}
8454
-	ut.Commit()
8403
+
8404
+	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and org_id = ? and status = 1", id, orgid).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
8405
+
8455
 	return err
8406
 	return err
8456
 
8407
 
8457
 }
8408
 }
8513
 
8464
 
8514
 func AddGoodSumInCount(storehouse_id int64, good_id int64, user_org_id int64, count int64) error {
8465
 func AddGoodSumInCount(storehouse_id int64, good_id int64, user_org_id int64, count int64) error {
8515
 
8466
 
8516
-	ut := XTWriteDB().Begin()
8467
+	err := XTWriteDB().Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_in_count", gorm.Expr("stock_in_count + ?", count)).Error
8517
 
8468
 
8518
-	err := ut.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_in_count", gorm.Expr("stock_in_count + ?", count)).Error
8519
-	if err != nil {
8520
-		ut.Rollback()
8521
-		return err
8522
-	}
8523
-	ut.Commit()
8524
 	return err
8469
 	return err
8525
 }
8470
 }
8526
 
8471
 
8538
 }
8483
 }
8539
 
8484
 
8540
 func UpdateGoodFlushCount(storehouse_id int64, good_id int64, user_org_id int64, flush_count int64) error {
8485
 func UpdateGoodFlushCount(storehouse_id int64, good_id int64, user_org_id int64, flush_count int64) error {
8541
-	ut := XTWriteDB().Begin()
8542
 
8486
 
8543
-	err := ut.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).Update(map[string]interface{}{"flush_count": flush_count}).Error
8544
-	if err != nil {
8545
-		ut.Rollback()
8546
-		return err
8547
-	}
8548
-	ut.Commit()
8487
+	err := XTWriteDB().Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).Update(map[string]interface{}{"flush_count": flush_count}).Error
8488
+
8549
 	return err
8489
 	return err
8550
 }
8490
 }
8551
 
8491