Bläddra i källkod

11月8日库存管理

XMLWAN 3 år sedan
förälder
incheckning
cad75774ed

+ 7 - 1
controllers/drug_stock_api_contorller.go Visa fil

@@ -2278,6 +2278,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2278 2278
 	}
2279 2279
 	//扣减库存逻辑
2280 2280
 	for _, item := range cancelStockInfos {
2281
+
2281 2282
 		var total_number int64
2282 2283
 		var out_number int64
2283 2284
 		var can_number int64
@@ -2292,7 +2293,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2292 2293
 		//查询当前药品退库的批次号的总入库数
2293 2294
 		infoWareInfo, _ := service.GetDrugWarehouseInfo(item.BatchNumberId)
2294 2295
 		var total_count int64
2295
-		total_count = infoWareInfo.StockMaxNumber*medical.MinNumber + infoWareInfo.StockMinNumber
2296
+		total_count = infoWareInfo.WarehousingCount * medical.MinNumber
2296 2297
 		fmt.Println("当前批次总库存", total_count)
2297 2298
 
2298 2299
 		//查询该批次的出库数量
@@ -2309,6 +2310,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2309 2310
 				item.Count = item.Count
2310 2311
 			}
2311 2312
 		}
2313
+
2312 2314
 		for _, item := range canInfo {
2313 2315
 			can_number += item.Count
2314 2316
 		}
@@ -2332,6 +2334,9 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2332 2334
 			})
2333 2335
 			return
2334 2336
 		}
2337
+
2338
+		fmt.Println("hhhh233323232322323", total_number, total_count)
2339
+
2335 2340
 		//判断退库数量是否大于总入库数量
2336 2341
 		if total_number > total_count {
2337 2342
 			service.UpdateDrugCancel(item.CancelStockId)
@@ -2344,6 +2349,7 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
2344 2349
 		//判断总退库数量是否大于出库数量
2345 2350
 		fmt.Println("该批次总退库数量", can_number+total_number)
2346 2351
 		fmt.Println("总出库数量", out_number)
2352
+		fmt.Println("当前退库数量", total_number)
2347 2353
 		if can_number+total_number > out_number {
2348 2354
 			//清空退库单
2349 2355
 			service.UpdateDrugCancel(item.CancelStockId)

+ 4 - 0
controllers/gobal_config_api_controller.go Visa fil

@@ -1040,6 +1040,10 @@ func (c *GobalConfigApiController) GetPrintInfo() {
1040 1040
 	dataBody := make(map[string]interface{}, 0)
1041 1041
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1042 1042
 	idsInters := dataBody["ids"].([]interface{})
1043
+	advice_type, _ := c.GetInt64("advice_type")
1044
+	stop_type, _ := c.GetInt64("stop_type")
1045
+	fmt.Println("advcie_type23323232322332", advice_type)
1046
+	fmt.Println("stop_type33332323223232323", stop_type)
1043 1047
 	if len(idsInters) == 0 {
1044 1048
 		if err != nil {
1045 1049
 			c.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")

+ 8 - 0
controllers/mobile_api_controllers/patient_api_controller.go Visa fil

@@ -975,6 +975,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
975 975
 
976 976
 func (c *PatientApiController) ModifyExecDoctorAdvice() {
977 977
 	execution_time := c.GetString("execution_time")
978
+	fmt.Println("execution_time", execution_time)
978 979
 	groupno, _ := c.GetInt64("groupno", -1)
979 980
 
980 981
 	var ids []string
@@ -1060,7 +1061,14 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1060 1061
 			ExecutionTime: theTime.Unix(),
1061 1062
 			UpdatedTime:   time.Now().Unix(),
1062 1063
 		}
1064
+		fmt.Println("ids2323232232323", ids)
1063 1065
 		service.ModifyExceDoctorAdviceById(&advicesinfo, ids)
1066
+
1067
+		project := models.HisPrescriptionProject{
1068
+			ExecutionTime: theTime.Unix(),
1069
+			Mtime:         time.Now().Unix(),
1070
+		}
1071
+		service.ModifyHisPrescriptionProject(&project, ids)
1064 1072
 	}
1065 1073
 	if err != nil {
1066 1074
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateDoctorAdviceFail)

+ 11 - 0
service/dialysis_service.go Visa fil

@@ -1219,6 +1219,17 @@ func ModifyExceDoctorAdviceById(m *models.HisDoctorAdviceInfo, ids []string) (er
1219 1219
 	return err
1220 1220
 }
1221 1221
 
1222
+func ModifyHisPrescriptionProject(m *models.HisPrescriptionProject, ids []string) (err error) {
1223
+	ut := writeDb.Begin()
1224
+	err = ut.Model(&models.HisPrescriptionProject{}).Where("status = 1   AND id IN (?) AND execution_state = 1", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime}).Error
1225
+	if err != nil {
1226
+		ut.Rollback()
1227
+		return
1228
+	}
1229
+	ut.Commit()
1230
+	return err
1231
+}
1232
+
1222 1233
 func FindHisProjectById(orgID int64, id int64) (advice models.HisPrescriptionProject, err error) {
1223 1234
 	err = readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id=? and status=1 and id = ?", orgID, id).First(&advice).Error
1224 1235
 	return

+ 2 - 2
service/gobal_config_service.go Visa fil

@@ -166,9 +166,9 @@ func FindAdviceInitConfig(org_id int64) (adviceInit models.AdviceInit, err error
166 166
 func GetPrint(ids []int64, orgid int64) (doctor []*models.DoctorAdvice, err error) {
167 167
 
168 168
 	if len(ids) == 1 {
169
-		err = XTReadDB().Model(&doctor).Where("groupno = ? and user_org_id = ?", ids[0], orgid).Find(&doctor).Error
169
+		err = XTReadDB().Model(&doctor).Where("groupno = ? and user_org_id = ? and status = 1", ids[0], orgid).Find(&doctor).Error
170 170
 	} else {
171
-		err = XTReadDB().Model(&doctor).Where("groupno IN(?) and user_org_id = ?", ids, orgid).Find(&doctor).Error
171
+		err = XTReadDB().Model(&doctor).Where("groupno IN(?) and user_org_id = ? and status = 1", ids, orgid).Find(&doctor).Error
172 172
 	}
173 173
 
174 174
 	return doctor, err

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Visa fil

@@ -267,7 +267,7 @@ type AssessmentBeforeDislysisVM struct {
267 267
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
268 268
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
269 269
 	EmergencyTreatmentOther        string  `gorm:"column:emergency_treatment_other" json:"emergency_treatment_other"`
270
-	DialysisCount                  int64   `gorm:"column:dialysis_count" json:"dialysis_count"`
270
+	DialysisCount                  string  `gorm:"column:dialysis_count" json:"dialysis_count"`
271 271
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
272 272
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
273 273
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`