Parcourir la source

11月8日库存管理

XMLWAN il y a 3 ans
Parent
révision
1406dd38c3

+ 9 - 10
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Voir le fichier

428
 	schedule, _ := this.GetInt64("schedule", 0) //1已2未
428
 	schedule, _ := this.GetInt64("schedule", 0) //1已2未
429
 	contagion, _ := this.GetInt64("contagion", 0)
429
 	contagion, _ := this.GetInt64("contagion", 0)
430
 	keywords := this.GetString("keywords", "")
430
 	keywords := this.GetString("keywords", "")
431
-	adminInfo := this.GetAdminUserInfo()
432
-
431
+	adminInfo := this.GetMobileAdminUserInfo()
433
 	thisTime := time.Now()
432
 	thisTime := time.Now()
434
 	weekDay := int(thisTime.Weekday())
433
 	weekDay := int(thisTime.Weekday())
435
 	if weekDay == 0 {
434
 	if weekDay == 0 {
453
 	weekStart := theStarTime.Unix()
452
 	weekStart := theStarTime.Unix()
454
 	weekEnd := theEndTime.Unix()
453
 	weekEnd := theEndTime.Unix()
455
 
454
 
456
-	patients, _ := service.GetPatientWithScheduleAndSolution(adminInfo.CurrentOrgId, keywords, weekStart, weekEnd, schedule, contagion)
455
+	patients, _ := service.GetPatientWithScheduleAndSolution(adminInfo.Org.Id, keywords, weekStart, weekEnd, schedule, contagion)
457
 
456
 
458
 	this.ServeSuccessJSON(map[string]interface{}{
457
 	this.ServeSuccessJSON(map[string]interface{}{
459
 		"patients": patients,
458
 		"patients": patients,
469
 		return
468
 		return
470
 	}
469
 	}
471
 
470
 
472
-	adminUserInfo := c.GetAdminUserInfo()
473
-	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patientID)
471
+	adminUserInfo := c.GetMobileAdminUserInfo()
472
+	patientInfo, _ := service.FindPatientById(adminUserInfo.Org.Id, patientID)
474
 	if patientInfo.ID == 0 {
473
 	if patientInfo.ID == 0 {
475
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
474
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
476
 		return
475
 		return
582
 	schedule.CreatedTime = time.Now().Unix()
581
 	schedule.CreatedTime = time.Now().Unix()
583
 	schedule.UpdatedTime = time.Now().Unix()
582
 	schedule.UpdatedTime = time.Now().Unix()
584
 	schedule.Status = 1
583
 	schedule.Status = 1
585
-	schedule.UserOrgId = adminUserInfo.CurrentOrgId
584
+	schedule.UserOrgId = adminUserInfo.Org.Id
586
 
585
 
587
-	bed, _ := service.GetDeviceNumberByID(adminUserInfo.CurrentOrgId, schedule.BedId)
586
+	bed, _ := service.GetDeviceNumberByID(adminUserInfo.Org.Id, schedule.BedId)
588
 	if bed == nil {
587
 	if bed == nil {
589
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeviceNumberNotExist)
588
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeviceNumberNotExist)
590
 		return
589
 		return
603
 	endTime := theEndTime.Unix()
602
 	endTime := theEndTime.Unix()
604
 
603
 
605
 	//一天只有排班一次
604
 	//一天只有排班一次
606
-	daySchedule, err := service.GetDaySchedule(adminUserInfo.CurrentOrgId, startTime, endTime, patientID)
605
+	daySchedule, err := service.GetDaySchedule(adminUserInfo.Org.Id, startTime, endTime, patientID)
607
 	if daySchedule.ID > 0 {
606
 	if daySchedule.ID > 0 {
608
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleAgainOneDay)
607
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleAgainOneDay)
609
 		return
608
 		return
610
 	}
609
 	}
611
 
610
 
612
 	//同天同位置只能排一个
611
 	//同天同位置只能排一个
613
-	pointSchedule, err := service.GetPointSchedule(adminUserInfo.CurrentOrgId, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
612
+	pointSchedule, err := service.GetPointSchedule(adminUserInfo.Org.Id, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
614
 	if err != nil {
613
 	if err != nil {
615
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
614
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
616
 		return
615
 		return
624
 	defer redis.Close()
623
 	defer redis.Close()
625
 	err = service.CreateSchedule(&schedule)
624
 	err = service.CreateSchedule(&schedule)
626
 
625
 
627
-	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
626
+	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
628
 	redis.Set(key, "", time.Second)
627
 	redis.Set(key, "", time.Second)
629
 
628
 
630
 	fmt.Println(err)
629
 	fmt.Println(err)