正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
@@ -2,6 +2,7 @@ package service | @@ -2,6 +2,7 @@ package service | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | + "fmt" | ||
5 | "strconv" | 6 | "strconv" |
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
@@ -216,21 +217,22 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param | @@ -216,21 +217,22 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param | ||
216 | continue | 217 | continue |
217 | } | 218 | } |
218 | //检查上岗时间格式 | 219 | //检查上岗时间格式 |
219 | - signIn, err := time.ParseInLocation("15:04:05", param[i].SignIn, time.Local) | 220 | + signInStr := fmt.Sprintf("%s %s", param[i].ProductDate, param[i].SignIn) |
221 | + signIn, err := time.ParseInLocation("2006-01-02 15:04:05", signInStr, time.Local) | ||
220 | if err != nil { | 222 | if err != nil { |
221 | param[i].FailReason = "上岗时间格式错误,例 15:04:05。" | 223 | param[i].FailReason = "上岗时间格式错误,例 15:04:05。" |
222 | failRows = append(failRows, param[i]) | 224 | failRows = append(failRows, param[i]) |
223 | continue | 225 | continue |
224 | } | 226 | } |
225 | - signIn = productDate.Add(time.Duration(signIn.Second()) * time.Second) | 227 | + |
226 | //检查离岗时间格式 | 228 | //检查离岗时间格式 |
227 | - signOut, err := time.ParseInLocation("15:04:05", param[i].SignOut, time.Local) | 229 | + signOutStr := fmt.Sprintf("%s %s", param[i].ProductDate, param[i].SignOut) |
230 | + signOut, err := time.ParseInLocation("2006-01-02 15:04:05", signOutStr, time.Local) | ||
228 | if err != nil { | 231 | if err != nil { |
229 | param[i].FailReason = "离岗时间格式错误,例 15:04:05。" | 232 | param[i].FailReason = "离岗时间格式错误,例 15:04:05。" |
230 | failRows = append(failRows, param[i]) | 233 | failRows = append(failRows, param[i]) |
231 | continue | 234 | continue |
232 | } | 235 | } |
233 | - signOut = productDate.Add(time.Duration(signOut.Second()) * time.Second) | ||
234 | //检查员工姓名 | 236 | //检查员工姓名 |
235 | var worker *domain.User | 237 | var worker *domain.User |
236 | workKey := param[i].WorkshopName + "/" + param[i].WorkerName | 238 | workKey := param[i].WorkshopName + "/" + param[i].WorkerName |
-
请 注册 或 登录 后发表评论