正在显示
9 个修改的文件
包含
87 行增加
和
37 行删除
| @@ -97,7 +97,7 @@ func (productJobService *ProductJobService) GetProductJob(getProductJobQuery *qu | @@ -97,7 +97,7 @@ func (productJobService *ProductJobService) GetProductJob(getProductJobQuery *qu | ||
| 97 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 97 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 98 | } | 98 | } |
| 99 | productJob.WorkStation, _ = workshop.FindWorkStation(productJob.WorkStation.WorkshopId, productJob.WorkStation.LineId, productJob.WorkStation.SectionId) | 99 | productJob.WorkStation, _ = workshop.FindWorkStation(productJob.WorkStation.WorkshopId, productJob.WorkStation.LineId, productJob.WorkStation.SectionId) |
| 100 | - | 100 | + productJob.WorkStation.Principal = workshop.Principal |
| 101 | newJobDto := &dto.ProductJobDto{} | 101 | newJobDto := &dto.ProductJobDto{} |
| 102 | newJobDto.LoadDto(productJob, 0) | 102 | newJobDto.LoadDto(productJob, 0) |
| 103 | 103 |
| @@ -25,8 +25,8 @@ type ReceiveMaterialCommand struct { | @@ -25,8 +25,8 @@ type ReceiveMaterialCommand struct { | ||
| 25 | ProductGroupId int `cname:"生产小组" json:"productGroupId" valid:"Required"` | 25 | ProductGroupId int `cname:"生产小组" json:"productGroupId" valid:"Required"` |
| 26 | // 员工Id 用户唯一标识 | 26 | // 员工Id 用户唯一标识 |
| 27 | EmployeeId int `cname:"员工" json:"employeeId" valid:"Required"` | 27 | EmployeeId int `cname:"员工" json:"employeeId" valid:"Required"` |
| 28 | - // 产品ID | ||
| 29 | - ProductId int `cname:"产品" json:"productId" valid:"Required"` | 28 | + // 物料ID |
| 29 | + UnitConversionId int `cname:"物料ID" json:"unitConversionId" valid:"Required"` | ||
| 30 | // 重量 | 30 | // 重量 |
| 31 | Weigh float64 `cname:"重量" json:"weigh" valid:"Required"` | 31 | Weigh float64 `cname:"重量" json:"weigh" valid:"Required"` |
| 32 | } | 32 | } |
| @@ -25,8 +25,8 @@ type ReturnMaterialCommand struct { | @@ -25,8 +25,8 @@ type ReturnMaterialCommand struct { | ||
| 25 | ProductGroupId int `cname:"生产小组" json:"productGroupId" valid:"Required"` | 25 | ProductGroupId int `cname:"生产小组" json:"productGroupId" valid:"Required"` |
| 26 | // 员工Id 用户唯一标识 | 26 | // 员工Id 用户唯一标识 |
| 27 | EmployeeId int `cname:"员工" json:"employeeId" valid:"Required"` | 27 | EmployeeId int `cname:"员工" json:"employeeId" valid:"Required"` |
| 28 | - // 产品ID | ||
| 29 | - ProductId int `cname:"产品" json:"productId" valid:"Required"` | 28 | + // 物料ID |
| 29 | + UnitConversionId int `cname:"物料ID" json:"unitConversionId" valid:"Required"` | ||
| 30 | // 重量 | 30 | // 重量 |
| 31 | Weigh float64 `cname:"重量" json:"weigh" valid:"Required"` | 31 | Weigh float64 `cname:"重量" json:"weigh" valid:"Required"` |
| 32 | } | 32 | } |
| @@ -9,8 +9,26 @@ import ( | @@ -9,8 +9,26 @@ import ( | ||
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| 11 | type SubmitProductRecordCommand struct { | 11 | type SubmitProductRecordCommand struct { |
| 12 | + // 企业id | ||
| 13 | + CompanyId int `cname:"企业id" json:"companyId" valid:"Required"` | ||
| 14 | + // 组织ID | ||
| 15 | + OrgId int `cname:"组织ID" json:"orgId" valid:"Required"` | ||
| 12 | // 生产计划ID | 16 | // 生产计划ID |
| 13 | - ProductPlanId int `cname:"生产计划ID" json:"productPlanId" valid:"Required"` | 17 | + ProductPlanId int `cname:"生产计划" json:"productPlanId" valid:"Required"` |
| 18 | + // 车间ID | ||
| 19 | + WorkshopId int `cname:"车间" json:"workshopId" valid:"Required"` | ||
| 20 | + // 生产线ID | ||
| 21 | + LineId int `cname:"生产线" json:"lineId" valid:"Required"` | ||
| 22 | + // 工段ID | ||
| 23 | + SectionId int `cname:"工段" json:"sectionId" valid:"Required"` | ||
| 24 | + // 生产小组ID | ||
| 25 | + ProductGroupId int `cname:"生产小组" json:"productGroupId" valid:"Required"` | ||
| 26 | + // 员工Id 用户唯一标识 | ||
| 27 | + EmployeeId int `cname:"员工" json:"employeeId" valid:"Required"` | ||
| 28 | + // 物料ID | ||
| 29 | + UnitConversionId int `cname:"物料ID" json:"unitConversionId" valid:"Required"` | ||
| 30 | + // 重量 | ||
| 31 | + Weigh float64 `cname:"重量" json:"weigh" valid:"Required"` | ||
| 14 | } | 32 | } |
| 15 | 33 | ||
| 16 | func (submitProductRecordCommand *SubmitProductRecordCommand) Valid(validation *validation.Validation) { | 34 | func (submitProductRecordCommand *SubmitProductRecordCommand) Valid(validation *validation.Validation) { |
| @@ -3,6 +3,7 @@ package service | @@ -3,6 +3,7 @@ package service | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | "github.com/linmadan/egglib-go/core/application" | 5 | "github.com/linmadan/egglib-go/core/application" |
| 6 | + "github.com/linmadan/egglib-go/transaction/pg" | ||
| 6 | "github.com/linmadan/egglib-go/utils/tool_funs" | 7 | "github.com/linmadan/egglib-go/utils/tool_funs" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/command" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/command" |
| @@ -483,10 +484,17 @@ func (productPlanService *ProductPlanService) ReceiveMaterial(receiveMaterialCom | @@ -483,10 +484,17 @@ func (productPlanService *ProductPlanService) ReceiveMaterial(receiveMaterialCom | ||
| 483 | defer func() { | 484 | defer func() { |
| 484 | transactionContext.RollbackTransaction() | 485 | transactionContext.RollbackTransaction() |
| 485 | }() | 486 | }() |
| 487 | + | ||
| 488 | + productRecordService, _ := domainService.NewPGProductRecordService(transactionContext.(*pg.TransactionContext)) | ||
| 489 | + | ||
| 490 | + _, err = productRecordService.SubmitProductRecord(domain.RecordTypeReceiveMaterial, tool_funs.SimpleStructToMap(receiveMaterialCommand)) | ||
| 491 | + if err != nil { | ||
| 492 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 493 | + } | ||
| 486 | if err := transactionContext.CommitTransaction(); err != nil { | 494 | if err := transactionContext.CommitTransaction(); err != nil { |
| 487 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 495 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 488 | } | 496 | } |
| 489 | - return nil, nil | 497 | + return struct{}{}, nil |
| 490 | } | 498 | } |
| 491 | 499 | ||
| 492 | // 退料 | 500 | // 退料 |
| @@ -504,10 +512,18 @@ func (productPlanService *ProductPlanService) ReturnMaterial(returnMaterialComma | @@ -504,10 +512,18 @@ func (productPlanService *ProductPlanService) ReturnMaterial(returnMaterialComma | ||
| 504 | defer func() { | 512 | defer func() { |
| 505 | transactionContext.RollbackTransaction() | 513 | transactionContext.RollbackTransaction() |
| 506 | }() | 514 | }() |
| 515 | + | ||
| 516 | + productRecordService, _ := domainService.NewPGProductRecordService(transactionContext.(*pg.TransactionContext)) | ||
| 517 | + | ||
| 518 | + _, err = productRecordService.SubmitProductRecord(domain.RecordTypeReturnMaterial, tool_funs.SimpleStructToMap(returnMaterialCommand)) | ||
| 519 | + if err != nil { | ||
| 520 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 521 | + } | ||
| 522 | + | ||
| 507 | if err := transactionContext.CommitTransaction(); err != nil { | 523 | if err := transactionContext.CommitTransaction(); err != nil { |
| 508 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 524 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 509 | } | 525 | } |
| 510 | - return nil, nil | 526 | + return struct{}{}, nil |
| 511 | } | 527 | } |
| 512 | 528 | ||
| 513 | // 提交成品记录 (成品 二级品) | 529 | // 提交成品记录 (成品 二级品) |
| @@ -525,10 +541,17 @@ func (productPlanService *ProductPlanService) SubmitProductRecord(submitProductR | @@ -525,10 +541,17 @@ func (productPlanService *ProductPlanService) SubmitProductRecord(submitProductR | ||
| 525 | defer func() { | 541 | defer func() { |
| 526 | transactionContext.RollbackTransaction() | 542 | transactionContext.RollbackTransaction() |
| 527 | }() | 543 | }() |
| 544 | + | ||
| 545 | + productRecordService, _ := domainService.NewPGProductRecordService(transactionContext.(*pg.TransactionContext)) | ||
| 546 | + | ||
| 547 | + _, err = productRecordService.SubmitProductRecord(domain.RecordTypeSecondLevelWeigh, tool_funs.SimpleStructToMap(submitProductRecordCommand)) | ||
| 548 | + if err != nil { | ||
| 549 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 550 | + } | ||
| 528 | if err := transactionContext.CommitTransaction(); err != nil { | 551 | if err := transactionContext.CommitTransaction(); err != nil { |
| 529 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 552 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 530 | } | 553 | } |
| 531 | - return nil, nil | 554 | + return struct{}{}, nil |
| 532 | } | 555 | } |
| 533 | 556 | ||
| 534 | func NewProductPlanService(options map[string]interface{}) *ProductPlanService { | 557 | func NewProductPlanService(options map[string]interface{}) *ProductPlanService { |
| @@ -2,7 +2,11 @@ package domain | @@ -2,7 +2,11 @@ package domain | ||
| 2 | 2 | ||
| 3 | // 生产记录信息 (物料、批次、产能(产能、领料、退料、二级品)) | 3 | // 生产记录信息 (物料、批次、产能(产能、领料、退料、二级品)) |
| 4 | type ProductRecordInfo struct { | 4 | type ProductRecordInfo struct { |
| 5 | - // 产能 | 5 | + // 生产日期 |
| 6 | + ProductDate string `json:"productDate"` | ||
| 7 | + // 原始上报数据 | ||
| 8 | + OriginalWeigh float64 `json:"originalWeigh,omitempty"` | ||
| 9 | + // 换算后的产能 | ||
| 6 | Weigh float64 `json:"weigh,omitempty"` | 10 | Weigh float64 `json:"weigh,omitempty"` |
| 7 | // 产能 - 审核前 | 11 | // 产能 - 审核前 |
| 8 | WeighBefore float64 `json:"weighBefore,omitempty"` | 12 | WeighBefore float64 `json:"weighBefore,omitempty"` |
| @@ -13,9 +17,9 @@ type ProductRecordInfo struct { | @@ -13,9 +17,9 @@ type ProductRecordInfo struct { | ||
| 13 | // 审核时间 | 17 | // 审核时间 |
| 14 | ApproveAt int64 `json:"approveAt"` | 18 | ApproveAt int64 `json:"approveAt"` |
| 15 | // 物料信息 | 19 | // 物料信息 |
| 16 | - Material *UnitConversion `json:"material,omitempty"` | 20 | + //Material *UnitConversion `json:"material,omitempty"` |
| 17 | // 生产计划信息(批次) | 21 | // 生产计划信息(批次) |
| 18 | - ProductPlan *ProductPlan `json:"productPlan,omitempty"` | 22 | + //ProductPlan *ProductPlan `json:"productPlan,omitempty"` |
| 19 | // 单位换算ID | 23 | // 单位换算ID |
| 20 | UnitConversionId int `json:"unitConversionId,omitempty"` | 24 | UnitConversionId int `json:"unitConversionId,omitempty"` |
| 21 | 25 |
| @@ -40,7 +40,7 @@ type SubmitOptions struct { | @@ -40,7 +40,7 @@ type SubmitOptions struct { | ||
| 40 | // SubmitProductRecord 提交生产记录 | 40 | // SubmitProductRecord 提交生产记录 |
| 41 | func (ptr *PGProductRecordService) SubmitProductRecord(productRecordType int, queryOptions map[string]interface{}) (interface{}, error) { | 41 | func (ptr *PGProductRecordService) SubmitProductRecord(productRecordType int, queryOptions map[string]interface{}) (interface{}, error) { |
| 42 | var request = &SubmitOptions{} | 42 | var request = &SubmitOptions{} |
| 43 | - if err := utils.LoadQueryObject(queryOptions, &request); err != nil { | 43 | + if err := utils.LoadQueryObject(queryOptions, request); err != nil { |
| 44 | return nil, err | 44 | return nil, err |
| 45 | } | 45 | } |
| 46 | 46 | ||
| @@ -103,6 +103,8 @@ func (ptr *PGProductRecordService) SubmitProductRecord(productRecordType int, qu | @@ -103,6 +103,8 @@ func (ptr *PGProductRecordService) SubmitProductRecord(productRecordType int, qu | ||
| 103 | CreatedAt: time.Now(), | 103 | CreatedAt: time.Now(), |
| 104 | UpdatedAt: time.Now(), | 104 | UpdatedAt: time.Now(), |
| 105 | ProductRecordInfo: &domain.ProductRecordInfo{ | 105 | ProductRecordInfo: &domain.ProductRecordInfo{ |
| 106 | + ProductDate: plan.ProductDate.Format("2006-01-02"), | ||
| 107 | + OriginalWeigh: request.Weigh, | ||
| 106 | Weigh: weight, | 108 | Weigh: weight, |
| 107 | WeighBefore: weight, | 109 | WeighBefore: weight, |
| 108 | UnitConversionId: request.UnitConversionId, | 110 | UnitConversionId: request.UnitConversionId, |
| @@ -38,19 +38,13 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -38,19 +38,13 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
| 38 | "product_record_info", | 38 | "product_record_info", |
| 39 | "ext", | 39 | "ext", |
| 40 | } | 40 | } |
| 41 | - insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | ||
| 42 | - insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 41 | + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_record_id", "deleted_at")) |
| 42 | + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_record_id", "deleted_at")) | ||
| 43 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 43 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
| 44 | - updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productRecord_id") | 44 | + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_record_id", "deleted_at") |
| 45 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) | 45 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) |
| 46 | tx := repository.transactionContext.PgTx | 46 | tx := repository.transactionContext.PgTx |
| 47 | if productRecord.Identify() == nil { | 47 | if productRecord.Identify() == nil { |
| 48 | - productRecordId, err := repository.nextIdentify() | ||
| 49 | - if err != nil { | ||
| 50 | - return productRecord, err | ||
| 51 | - } else { | ||
| 52 | - productRecord.ProductRecordId = int(productRecordId) | ||
| 53 | - } | ||
| 54 | if _, err := tx.QueryOne( | 48 | if _, err := tx.QueryOne( |
| 55 | pg.Scan( | 49 | pg.Scan( |
| 56 | &productRecord.ProductRecordId, | 50 | &productRecord.ProductRecordId, |
| @@ -65,8 +59,8 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -65,8 +59,8 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
| 65 | &productRecord.ProductRecordInfo, | 59 | &productRecord.ProductRecordInfo, |
| 66 | &productRecord.Ext, | 60 | &productRecord.Ext, |
| 67 | ), | 61 | ), |
| 68 | - fmt.Sprintf("INSERT INTO product_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | ||
| 69 | - productRecord.ProductRecordId, | 62 | + fmt.Sprintf("INSERT INTO manufacture.product_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
| 63 | + //productRecord.ProductRecordId, | ||
| 70 | productRecord.CompanyId, | 64 | productRecord.CompanyId, |
| 71 | productRecord.OrgId, | 65 | productRecord.OrgId, |
| 72 | productRecord.ProductRecordType, | 66 | productRecord.ProductRecordType, |
| @@ -74,7 +68,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -74,7 +68,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
| 74 | productRecord.WorkStation, | 68 | productRecord.WorkStation, |
| 75 | productRecord.CreatedAt, | 69 | productRecord.CreatedAt, |
| 76 | productRecord.UpdatedAt, | 70 | productRecord.UpdatedAt, |
| 77 | - productRecord.DeletedAt, | 71 | + //productRecord.DeletedAt, |
| 78 | productRecord.ProductRecordInfo, | 72 | productRecord.ProductRecordInfo, |
| 79 | productRecord.Ext, | 73 | productRecord.Ext, |
| 80 | ); err != nil { | 74 | ); err != nil { |
| @@ -95,8 +89,8 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -95,8 +89,8 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
| 95 | &productRecord.ProductRecordInfo, | 89 | &productRecord.ProductRecordInfo, |
| 96 | &productRecord.Ext, | 90 | &productRecord.Ext, |
| 97 | ), | 91 | ), |
| 98 | - fmt.Sprintf("UPDATE product_records SET %s WHERE product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | ||
| 99 | - productRecord.ProductRecordId, | 92 | + fmt.Sprintf("UPDATE manufacture.product_records SET %s WHERE product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
| 93 | + //productRecord.ProductRecordId, | ||
| 100 | productRecord.CompanyId, | 94 | productRecord.CompanyId, |
| 101 | productRecord.OrgId, | 95 | productRecord.OrgId, |
| 102 | productRecord.ProductRecordType, | 96 | productRecord.ProductRecordType, |
| @@ -104,7 +98,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -104,7 +98,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
| 104 | productRecord.WorkStation, | 98 | productRecord.WorkStation, |
| 105 | productRecord.CreatedAt, | 99 | productRecord.CreatedAt, |
| 106 | productRecord.UpdatedAt, | 100 | productRecord.UpdatedAt, |
| 107 | - productRecord.DeletedAt, | 101 | + //productRecord.DeletedAt, |
| 108 | productRecord.ProductRecordInfo, | 102 | productRecord.ProductRecordInfo, |
| 109 | productRecord.Ext, | 103 | productRecord.Ext, |
| 110 | productRecord.Identify(), | 104 | productRecord.Identify(), |
| @@ -64,17 +64,23 @@ func (controller *ProductPlanController) ListProductPlan() { | @@ -64,17 +64,23 @@ func (controller *ProductPlanController) ListProductPlan() { | ||
| 64 | 64 | ||
| 65 | func (controller *ProductPlanController) ReceiveMaterial() { | 65 | func (controller *ProductPlanController) ReceiveMaterial() { |
| 66 | productPlanService := service.NewProductPlanService(nil) | 66 | productPlanService := service.NewProductPlanService(nil) |
| 67 | - receiveMaterialCommand := &command.ReceiveMaterialCommand{} | ||
| 68 | - Must(controller.Unmarshal(receiveMaterialCommand)) | ||
| 69 | - data, err := productPlanService.ReceiveMaterial(receiveMaterialCommand) | 67 | + cmd := &command.ReceiveMaterialCommand{} |
| 68 | + Must(controller.Unmarshal(cmd)) | ||
| 69 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 70 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 71 | + cmd.OrgId = operateInfo.OrgId | ||
| 72 | + data, err := productPlanService.ReceiveMaterial(cmd) | ||
| 70 | controller.Response(data, err) | 73 | controller.Response(data, err) |
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | func (controller *ProductPlanController) ReturnMaterial() { | 76 | func (controller *ProductPlanController) ReturnMaterial() { |
| 74 | productPlanService := service.NewProductPlanService(nil) | 77 | productPlanService := service.NewProductPlanService(nil) |
| 75 | - returnMaterialCommand := &command.ReturnMaterialCommand{} | ||
| 76 | - Must(controller.Unmarshal(returnMaterialCommand)) | ||
| 77 | - data, err := productPlanService.ReturnMaterial(returnMaterialCommand) | 78 | + cmd := &command.ReturnMaterialCommand{} |
| 79 | + Must(controller.Unmarshal(cmd)) | ||
| 80 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 81 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 82 | + cmd.OrgId = operateInfo.OrgId | ||
| 83 | + data, err := productPlanService.ReturnMaterial(cmd) | ||
| 78 | controller.Response(data, err) | 84 | controller.Response(data, err) |
| 79 | } | 85 | } |
| 80 | 86 | ||
| @@ -104,9 +110,12 @@ func (controller *ProductPlanController) Switch() { | @@ -104,9 +110,12 @@ func (controller *ProductPlanController) Switch() { | ||
| 104 | 110 | ||
| 105 | func (controller *ProductPlanController) SubmitProductRecord() { | 111 | func (controller *ProductPlanController) SubmitProductRecord() { |
| 106 | productPlanService := service.NewProductPlanService(nil) | 112 | productPlanService := service.NewProductPlanService(nil) |
| 107 | - submitProductRecordCommand := &command.SubmitProductRecordCommand{} | ||
| 108 | - Must(controller.Unmarshal(submitProductRecordCommand)) | ||
| 109 | - data, err := productPlanService.SubmitProductRecord(submitProductRecordCommand) | 113 | + cmd := &command.SubmitProductRecordCommand{} |
| 114 | + Must(controller.Unmarshal(cmd)) | ||
| 115 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 116 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 117 | + cmd.OrgId = operateInfo.OrgId | ||
| 118 | + data, err := productPlanService.SubmitProductRecord(cmd) | ||
| 110 | controller.Response(data, err) | 119 | controller.Response(data, err) |
| 111 | } | 120 | } |
| 112 | 121 |
-
请 注册 或 登录 后发表评论