...
|
...
|
@@ -15,7 +15,7 @@ import ( |
|
|
//产能管理
|
|
|
|
|
|
// 产能管理 页面上手动创建员工生产记录
|
|
|
func (productRecordService *ProductRecordService) CreateProductCapacities(operateInfo *domain.OperateInfo, param *command.SaveEmployeeProductRecordCmd) (map[string]interface{}, error) {
|
|
|
func (productRecordService *ProductRecordService) SaveProductCapacities(operateInfo *domain.OperateInfo, param *command.SaveProductRecordCmd) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -81,8 +81,21 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat |
|
|
productRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
nowTime := time.Now()
|
|
|
if param.ProductRecordId > 0 {
|
|
|
productRecord, err := productRecordRepo.FindOne(map[string]interface{}{
|
|
|
"productRecordId": param.ProductRecordId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取生产记录数据失败"+err.Error())
|
|
|
}
|
|
|
if productRecord.ProductRecordInfo.ApproveStatus != domain.ProductRecordNotApprove {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "生产记录不可再被编辑")
|
|
|
}
|
|
|
}
|
|
|
epRecord := &domain.ProductRecord{
|
|
|
ProductRecordId: param.ProductRecordId,
|
|
|
UpdatedAt: nowTime,
|
|
|
OrgId: operateInfo.OrgId,
|
|
|
CompanyId: operateInfo.CompanyId,
|
...
|
...
|
@@ -112,7 +125,6 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat |
|
|
epRecord.ProductRecordInfo.ApproveStatus = domain.ProductRecordApproved
|
|
|
epRecord.ProductRecordInfo.ApproveUser = user
|
|
|
}
|
|
|
// epRecord.ParticipateType = param.ParticipateType //参与类型
|
|
|
_, err = productRecordRepo.Save(epRecord)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error())
|
...
|
...
|
@@ -161,7 +173,7 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI |
|
|
condition["limit"] = limit
|
|
|
}
|
|
|
if offset >= 0 {
|
|
|
condition["offset"] = limit
|
|
|
condition["offset"] = offset
|
|
|
}
|
|
|
count, productRecords, err := productRecordRepo.Find(condition)
|
|
|
if err != nil {
|
...
|
...
|
|