作者 Your Name

更新产能管理

package command
type SaveEmployeeProductRecordCmd struct {
EmployeeProductRecordId int `json:"id"`
// 车间ID
WorkshopId int `cname:"车间ID" json:"workshopId" valid:"Required"`
// 生产线ID
LineId int `cname:"生产线ID" json:"lineId" valid:"Required"`
// 工段ID
SectionId int `cname:"工段ID" json:"sectionId" valid:"Required"`
//员工
WorkerId int `cname:"工人ID" json:"workerId" valid:"Required"`
//产量重量
Weigh float64 `cname:"重量" json:"weigh" valid:"Required" `
//产品编码
ProductCode string `json:"productCode"`
// 参与类型 1:正常 2:支援
ParticipateType int `json:"participateType"`
//日期
RecordDate string `json:"recordDate"`
//上班班次 1:全天 2:白班 4:中班 8:夜班
WorkOn int `json:"workOn"`
}
... ...
package dto
//产能管理-列表
type ProductCapacitiesList struct {
EmployeeProductRecordId int `json:"employeeProductRecordId"`
WorkshopName string `json:"workshopName"` //车间名称
LineName string `json:"lineName"` //线别名称
SectionName string `json:"sectionName"` //工段
WorkerName string `json:"workerName"` // 用户姓名
EmployeeType int `json:"employeeType"` // 员工类型 1:固定 2:派遣 3.临时
ProductName string `json:"productName"` //品名
ParticipateType int `json:"participateType"` // 参与类型 1:正常 2:支援
ProductWeigh float64 `json:"productWeigh"` // 产能
CreatedAt string `json:"createdAt"` // 创建时间
ApproveStatus int `json:"approveStatus"` //0:未审核 1:已审核 2.自动审核
}
//产能管理-列表-详情
type ProductCapacitiesInfo struct {
EmployeeProductRecordId int `json:"id"`
WorkshopId int ` json:"workshopId" ` // 车间ID
WorkshopName string `json:"workshopName"` //
LineId int `json:"lineId"` // 生产线ID
LineName string `json:"lineName"` //
SectionId int `json:"sectionId" ` // 工段ID
SectionName string `json:"sectionName"` //
WorkerId int `json:"workerId" ` //员工
WorkerName string `json:"workerName"` //
Weigh float64 `json:"weigh"` //产量重量
ProductCode string `json:"productCode"` //产品编码
ProductName string `json:"productName"` //产品名称
ParticipateType int `json:"participateType"` //参与类型 1:正常 2:支援
RecordDate string `json:"recordDate"` //日期
WorkOn int `json:"workOn"` //上班班次 1:全天 2:白班 4:中班 8:夜班
}
... ...
package query
type GetProductCapacitiesQuery struct {
EmployeeProductRecordId int `json:"id"`
}
... ...
package query
type ListProductCapacitiesQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CompanyId int `json:"companyId"`
OrgId int `json:"orgId"`
WorkshopName string `json:"workshopName"`
LineName string `json:"lineName"`
SectionName string `json:"sectionName"`
ProductBeginTime string `json:"productBeginTime"`
ProductEndTime string `json:"productEndTime"`
WorkerName string `json:"workerName"`
}
... ...
package service
import (
"time"
"github.com/linmadan/egglib-go/core/application"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
)
//产能管理
// 产能管理 页面上手动创建员工生产记录
func (productRecordService *ProductRecordService) CreateProductCapacities(operateInfo *domain.OperateInfo, param *command.SaveEmployeeProductRecordCmd) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
//日期
recordDate, err := time.ParseInLocation("2006-01-02", param.RecordDate, time.Local)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
}
//员工数据
var worker *domain.User
userService := domainService.NewUserService()
worker, err = userService.User(param.WorkerId)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取员工错误,"+err.Error())
}
//操作人数据
var user *domain.User
user, err = userService.User(operateInfo.UserId)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取操作人错误,"+err.Error())
}
//组织数据
var org *domain.Org
org, err = userService.Organization(operateInfo.OrgId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
//车间数据
workshopRepo, _ := factory.CreateWorkshopRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
workshop, err := workshopRepo.FindOne(map[string]interface{}{"workshopId": param.WorkshopId})
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取车间数据失败"+err.Error())
}
workstation, err := workshop.FindWorkStation(param.WorkshopId, param.LineId, param.SectionId)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取车间工段数据失败"+err.Error())
}
//产品数据
productRepo, _ := factory.CreateProductRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//获取产品
productData, err := productRepo.FindOne(map[string]interface{}{
"companyId": operateInfo.CompanyId,
"orgId": operateInfo.OrgId,
"productCode": param.ProductCode,
})
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取产品数据失败"+err.Error())
}
nowTime := time.Now()
//员工生产记录
eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
var epRecord *domain.EmployeeProductRecord
if param.EmployeeProductRecordId != 0 {
epRecord, err = eProductRecordRepo.FindOne(map[string]interface{}{
"employeeProductRecordId": param.EmployeeProductRecordId,
})
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取员工生产记录数据失败"+err.Error())
}
} else {
epRecord = &domain.EmployeeProductRecord{
CreatedAt: nowTime,
OrgId: operateInfo.OrgId,
CompanyId: operateInfo.CompanyId,
}
}
epRecord.UpdatedAt = time.Now()
epRecord.ParticipateType = param.ParticipateType //参与类型
epRecord.WorkStation = workstation //车间工段
epRecord.ProductWorker = worker //员工
epRecord.WorkOn = param.WorkOn //上班班次
epRecord.CreatedAt = recordDate //日期
epRecord.Ext = &domain.Ext{
Operator: user,
OrgName: org.OrgName,
}
epRecord.ProductWeigh = param.Weigh //重量
if epRecord.ProductRecordInfo == nil {
epRecord.ProductRecordInfo = &domain.ProductRecordStaticInfo{}
}
epRecord.ProductRecordInfo.OutputWeight = param.Weigh //重量
epRecord.ProductRecordInfo.PlanProductName = productData.ProductName //产品名称
epRecord.ProductRecordInfo.PlanProductCode = productData.ProductCode //产品编码
epRecord.ProductRecordInfo.OutputWeight = param.Weigh //重量
_, err = eProductRecordRepo.Save(epRecord)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
"employeeProductRecordId": epRecord.EmployeeProductRecordId,
}, nil
}
// 产能管理 列表
func (productRecordService *ProductRecordService) ListProductCapacities(operateInfo *domain.OperateInfo, param *query.ListProductCapacitiesQuery) (int64, []dto.ProductCapacitiesList, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
productRecordRepository, _ := dao.NewEmployeeProductRecordDao(transactionContext.(*pgTransaction.TransactionContext))
productBeginTime, _ := time.ParseInLocation("2006-01-02", param.ProductBeginTime, time.Local)
productEndTime, _ := time.ParseInLocation("2006-01-02", param.ProductEndTime, time.Local)
condition := map[string]interface{}{
"companyId": param.CompanyId,
"orgId": param.OrgId,
"workerName": param.WorkerName,
"workshopName": param.WorkshopName,
"lineName": param.LineName,
"sectionName": param.SectionName,
"productBeginTime": productBeginTime,
"productEndTime": productEndTime,
}
limit := param.PageSize
offset := param.PageSize * (param.PageNumber - 1)
if limit >= 0 {
condition["limit"] = limit
}
if offset >= 0 {
condition["offset"] = limit
}
count, productRecords, err := productRecordRepository.SearchEmployeeProductRecord(condition)
if err != nil {
return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var result = make([]dto.ProductCapacitiesList, 0)
for _, v := range productRecords {
item := dto.ProductCapacitiesList{
EmployeeProductRecordId: v.EmployeeProductRecordId,
WorkshopName: v.WorkStation.WorkshopName,
LineName: v.WorkStation.LineName,
SectionName: v.WorkStation.SectionName,
WorkerName: v.ProductWorker.UserName,
EmployeeType: v.ProductWorker.EmployeeType,
ProductName: v.ProductRecordInfo.PlanProductName,
ParticipateType: v.ParticipateType,
ProductWeigh: v.ProductRecordInfo.OutputWeight,
CreatedAt: v.CreatedAt.Format("2006-01-02"),
ApproveStatus: v.ApproveStatus,
}
result = append(result, item)
}
return count, result, nil
}
// 产能管理 列表-详情
func (productRecordService *ProductRecordService) GetProductCapacities(operateInfo *domain.OperateInfo, id int) (*dto.ProductCapacitiesInfo, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{
"employeeProductRecordId": id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var result = dto.ProductCapacitiesInfo{
EmployeeProductRecordId: recordData.EmployeeProductRecordId,
WorkshopId: recordData.WorkStation.WorkshopId,
WorkshopName: recordData.WorkStation.WorkshopName,
LineId: recordData.WorkStation.LineId,
LineName: recordData.WorkStation.LineName,
SectionId: recordData.WorkStation.SectionId,
SectionName: recordData.WorkStation.SectionName,
WorkerId: recordData.ProductWorker.UserId,
WorkerName: recordData.ProductWorker.UserName,
Weigh: recordData.ProductRecordInfo.OutputWeight,
ProductCode: recordData.ProductRecordInfo.PlanProductCode,
ProductName: recordData.ProductRecordInfo.PlanProductName,
ParticipateType: recordData.ParticipateType,
RecordDate: recordData.CreatedAt.Format("2006-01-02"),
WorkOn: recordData.WorkOn,
}
return &result, nil
}
// 产能管理 列表-删除
func (productRecordService *ProductRecordService) DeleteProductCapacities(operateInfo *domain.OperateInfo, id int) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{
"employeeProductRecordId": id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_, err = eProductRecordRepo.Remove(recordData)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
"employeeProductRecordId": recordData.EmployeeProductRecordId,
}, nil
}
// 产能管理 列表-审核
func (productRecordService *ProductRecordService) ApproveProductCapacities(operateInfo *domain.OperateInfo, id int) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{
"employeeProductRecordId": id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
userService := domainService.NewUserService()
//操作人数据
var user *domain.User
user, err = userService.User(operateInfo.UserId)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取操作人错误,"+err.Error())
}
nowTime := time.Now()
recordData.ApproveAt = &nowTime
recordData.ApproveStatus = 1
recordData.ApproveUser = user
_, err = eProductRecordRepo.Save(recordData)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "保存数据错误,"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
"employeeProductRecordId": recordData.EmployeeProductRecordId,
}, nil
}
... ...
package domain
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
)
const (
... ... @@ -49,6 +50,10 @@ 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 {
... ...
... ... @@ -7,6 +7,8 @@ type ProductRecordStaticInfo struct {
ProductDate string `json:"productDate"`
// 生产计划ID
ProductPlanId int `json:"productPlanId,omitempty"`
PlanProductCode string `json:"planProductCode"`
// 计划的产品名称
PlanProductName string `json:"planProductName,omitempty"`
// 批号
... ...
... ... @@ -54,6 +54,7 @@ func init() {
(*models.RewardStandard)(nil),
(*models.RewardRule)(nil),
(*models.ProductTrouble)(nil),
(*models.RewardSummary)(nil),
} {
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
Temp: false,
... ...
package models
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
)
type EmployeeProductRecord struct {
... ... @@ -37,4 +38,8 @@ 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:"审核人"` // 审核人
}
... ...
... ... @@ -17,14 +17,21 @@ type RewardSummary struct {
WorkStation domain.WorkStation // 工作位置
Worker domain.User //员工
UpToStandard float64 //合格率
UpToStandardResult int //合格率 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
Yield float64 //产能
YieldResult int //产能 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
AccidentNum1 int //质量事故 次数
AccidentAmount1 float64 //质量事故 损失金额
AccidentResult1 int //质量事故 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
AccidentNum2 int //安全事故 次数
AccidentAmount2 float64 //安全事故 损失金额
AccidentResult2 int //安全事故 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
AccidentNum3 int //异物金属事故 次数
AccidentResult3 int //异物金属事故 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
AccidentNum4 int //异物非金属事故 次数
AccidentResult4 int //异物非金属事故 功过评定结果 1`功` -1 `过` 0 `不奖不惩`
SummaryResult float64 //奖惩金额计算结果(元)
CreatedAt time.Time //
UpdatedAt time.Time //
SummaryResult float64 //奖惩计算结果
}
... ...
... ... @@ -22,5 +22,8 @@ func TransformToEmployeeProductRecordDomainModelFromPgModels(employeeProductReco
Version: employeeProductRecordModel.Version,
ProductRecordInfo: employeeProductRecordModel.ProductRecordInfo,
ProductWorker: employeeProductRecordModel.ProductWorker,
ApproveStatus: employeeProductRecordModel.ApproveStatus,
ApproveAt: employeeProductRecordModel.ApproveAt,
ApproveUser: employeeProductRecordModel.ApproveUser,
}, nil
}
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -41,6 +42,9 @@ 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"))
... ... @@ -66,6 +70,9 @@ 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,
... ... @@ -83,6 +90,9 @@ func (repository *EmployeeProductRecordRepository) Save(employeeProductRecord *d
employeeProductRecord.Version,
employeeProductRecord.ProductRecordInfo,
employeeProductRecord.ProductWorker,
employeeProductRecord.ApproveStatus,
employeeProductRecord.ApproveAt,
employeeProductRecord.ApproveUser,
); err != nil {
return employeeProductRecord, err
}
... ... @@ -104,6 +114,9 @@ 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,
... ... @@ -121,6 +134,9 @@ 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
... ...
... ... @@ -128,3 +128,53 @@ func (controller *ProductRecordController) SearchWorkshopProductRecord() {
total, data, err := productPlanService.SearchWorkshopProductRecord(ParseOperateInfo(controller.BaseController), cmd)
ResponseGrid(controller.BaseController, total, data, err)
}
// 产能管理 添加产能
func (controller *ProductRecordController) CreateProductCapacities() {
productRecordService := service.NewProductRecordService(nil)
saveCommand := &command.SaveEmployeeProductRecordCmd{}
controller.Unmarshal(saveCommand)
operateInfo := ParseOperateInfo(controller.BaseController)
data, err := productRecordService.CreateProductCapacities(operateInfo, saveCommand)
controller.Response(data, err)
}
// 产能管理 产能列表
func (controller *ProductRecordController) ListProductCapacities() {
productRecordService := service.NewProductRecordService(nil)
listQury := &query.ListProductCapacitiesQuery{}
controller.Unmarshal(listQury)
operateInfo := ParseOperateInfo(controller.BaseController)
listQury.CompanyId = operateInfo.CompanyId
listQury.OrgId = operateInfo.OrgId
total, data, err := productRecordService.ListProductCapacities(operateInfo, listQury)
ResponseGrid(controller.BaseController, total, data, err)
}
// 产能管理 产能详情
func (controller *ProductRecordController) GetProductCapacities() {
productRecordService := service.NewProductRecordService(nil)
productRecordId, _ := controller.GetInt(":productRecordId")
operateInfo := ParseOperateInfo(controller.BaseController)
data, err := productRecordService.GetProductCapacities(operateInfo, productRecordId)
controller.Response(data, err)
}
// 产能管理 删除产能
func (controller *ProductRecordController) DeleteProductCapacities() {
productRecordService := service.NewProductRecordService(nil)
productRecordId, _ := controller.GetInt(":productRecordId")
operateInfo := ParseOperateInfo(controller.BaseController)
data, err := productRecordService.DeleteProductCapacities(operateInfo, productRecordId)
controller.Response(data, err)
}
// 产能管理 审核产能
func (controller *ProductRecordController) ApproveProductCapacities() {
productRecordService := service.NewProductRecordService(nil)
queryCommand := &query.GetProductCapacitiesQuery{}
controller.Unmarshal(queryCommand)
operateInfo := ParseOperateInfo(controller.BaseController)
data, err := productRecordService.ApproveProductCapacities(operateInfo, queryCommand.EmployeeProductRecordId)
controller.Response(data, err)
}
... ...
... ... @@ -18,4 +18,17 @@ func init() {
web.Router("/product-records/cancel", &controllers.ProductRecordController{}, "Post:CancelProductRecord")
web.Router("/product-records/employee-productive/search", &controllers.ProductRecordController{}, "Post:SearchEmployeeProductRecord")
web.Router("/product-records/workshop-productive/search", &controllers.ProductRecordController{}, "Post:SearchWorkshopProductRecord")
//产能管理 列表
web.Router("/product-records/product-capacities/search", &controllers.ProductRecordController{}, "Post:ListProductCapacities")
//产能管理 添加产能
web.Router("/product-records/product-capacities", &controllers.ProductRecordController{}, "Post:CreateProductCapacities")
//产能管理 列表-产能详情
web.Router("/product-records/product-capacities/:productRecordId", &controllers.ProductRecordController{}, "Get:GetProductCapacities")
//产能管理 列表 -删除产能
web.Router("/product-records/product-capacities/:productRecordId", &controllers.ProductRecordController{}, "Delete:DeleteProductCapacities")
//产能管理 列表 -审核产能
web.Router("/product-records/product-capacities/approve", &controllers.ProductRecordController{}, "Post:ApproveProductCapacities")
}
... ...