作者 Your Name

更新

... ... @@ -266,6 +266,11 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param
UpdatedAt: nowTime,
DeletedAt: time.Time{},
ProductDate: productDate,
Ext: &domain.Ext{
DeviceExt: &domain.DeviceExt{},
ProductPlanExt: &domain.ProductPlanExt{},
AttendanceExt: &domain.ProductAttendanceRecordExt{},
},
}
//计算工时
workTime := tempItem.ComputeWorkTime(beakTime)
... ...
... ... @@ -554,9 +554,6 @@ func (srv *ProductRecordService) BatchAddProductCapacities(operate *domain.Opera
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return failRows, nil
}
... ...
... ... @@ -160,6 +160,9 @@ func (productAttendanceRecord *ProductAttendanceRecord) Approve(approveUser *Use
}
func (productAttendanceRecord *ProductAttendanceRecord) ProductTime() time.Time {
if productAttendanceRecord.Ext == nil {
return time.Time{}
}
attendanceExt := productAttendanceRecord.Ext.AttendanceExt
if attendanceExt != nil && !xtime.IsZero(productAttendanceRecord.ProductDate) {
return productAttendanceRecord.ProductDate
... ... @@ -232,8 +235,8 @@ func (productAttendanceRecord *ProductAttendanceRecord) AttendanceBreakTime(prod
return bt
}
//计算上岗到 离岗之间的工作时间,
//breakTime 休息时间(小时)
// 计算上岗到 离岗之间的工作时间,
// breakTime 休息时间(小时)
func (productAttendanceRecord *ProductAttendanceRecord) ComputeWorkTime(breakTime float64) float64 {
signIn := roundTime(productAttendanceRecord.SignIn)
signOut := roundTime(productAttendanceRecord.SignOut)
... ...
... ... @@ -50,10 +50,6 @@ type EmployeeProductRecord struct {
ProductRecordInfo *ProductRecordStaticInfo `json:"productRecordInfo"`
// 生产工人
ProductWorker *User `comment:"生产工人"`
ApproveStatus int `json:"approveStatus"` // 审核状态 0:未审核 1:已审核 2.自动审核
ApproveAt *time.Time `json:"approveAt"` // 审核时间
ApproveUser *User `json:"approveUser"` // 审核人
}
type EmployeeProductRecordRepository interface {
... ...
... ... @@ -38,8 +38,4 @@ type EmployeeProductRecord struct {
ProductRecordInfo *domain.ProductRecordStaticInfo `comment:"生产记录信息"`
// 生产工人
ProductWorker *domain.User `comment:"生产工人"`
ApproveStatus int `comment:"审核状态 0:未审核 1:已审核 2.自动审核"` // 审核状态 0:未审核 1:已审核 2.自动审核
ApproveAt *time.Time `comment:"审核时间"` //
ApproveUser *domain.User `comment:"审核人"` // 审核人
}
... ...
... ... @@ -22,8 +22,5 @@ func TransformToEmployeeProductRecordDomainModelFromPgModels(employeeProductReco
Version: employeeProductRecordModel.Version,
ProductRecordInfo: employeeProductRecordModel.ProductRecordInfo,
ProductWorker: employeeProductRecordModel.ProductWorker,
ApproveStatus: employeeProductRecordModel.ApproveStatus,
ApproveAt: employeeProductRecordModel.ApproveAt,
ApproveUser: employeeProductRecordModel.ApproveUser,
}, nil
}
... ...
... ... @@ -42,9 +42,6 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
"version",
"product_record_info",
"product_worker",
"approve_status",
"approve_at",
"approve_user",
}
insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "employee_product_record_id", "deleted_at"))
insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "employee_product_record_id", "deleted_at"))
... ... @@ -70,9 +67,6 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
&employeeProductRecord.Version,
&employeeProductRecord.ProductRecordInfo,
&employeeProductRecord.ProductWorker,
&employeeProductRecord.ApproveStatus,
&employeeProductRecord.ApproveAt,
&employeeProductRecord.ApproveUser,
),
fmt.Sprintf("INSERT INTO manufacture.employee_product_record (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
//employeeProductRecord.EmployeeProductRecordId,
... ... @@ -90,9 +84,6 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
employeeProductRecord.Version,
employeeProductRecord.ProductRecordInfo,
employeeProductRecord.ProductWorker,
employeeProductRecord.ApproveStatus,
employeeProductRecord.ApproveAt,
employeeProductRecord.ApproveUser,
); err != nil {
return employeeProductRecord, err
}
... ... @@ -114,9 +105,6 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
&employeeProductRecord.Version,
&employeeProductRecord.ProductRecordInfo,
&employeeProductRecord.ProductWorker,
&employeeProductRecord.ApproveStatus,
&employeeProductRecord.ApproveAt,
&employeeProductRecord.ApproveUser,
),
fmt.Sprintf("UPDATE manufacture.employee_product_record SET %s WHERE employee_product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
//employeeProductRecord.EmployeeProductRecordId,
... ... @@ -134,9 +122,6 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
employeeProductRecord.Version,
employeeProductRecord.ProductRecordInfo,
employeeProductRecord.ProductWorker,
employeeProductRecord.ApproveStatus,
employeeProductRecord.ApproveAt,
employeeProductRecord.ApproveUser,
employeeProductRecord.Identify(),
); err != nil {
return employeeProductRecord, err
... ...