正在显示
16 个修改的文件
包含
305 行增加
和
5 行删除
1 | +package dto | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | ||
5 | + "strings" | ||
6 | +) | ||
7 | + | ||
8 | +// 生产班组员工 | ||
9 | +type ProductGroupEmployeesDto struct { | ||
10 | + // 用户Id 用户唯一标识 | ||
11 | + UserId int `json:"userId,omitempty"` | ||
12 | + // 用户姓名 | ||
13 | + UserName string `json:"userName,omitempty"` | ||
14 | + // 班组名称 | ||
15 | + GroupName string `json:"groupName,omitempty"` | ||
16 | + // 上班班次 1:全天 2:白班 4:中班 8:夜班 | ||
17 | + WorkOnDescription string `json:"workOn,omitempty"` | ||
18 | + // 工作位置键值 (车间ID+'.'+生产线ID+'.'+工段ID) | ||
19 | + //WorkStationId string `json:"workStationId,omitempty"` | ||
20 | +} | ||
21 | + | ||
22 | +func NewProductGroupEmployeesDto(group *domain.ProductGroup) []*ProductGroupEmployeesDto { | ||
23 | + employees := make([]*ProductGroupEmployeesDto, 0) | ||
24 | + if group.GroupLeader != nil { | ||
25 | + employees = append(employees, NewGroupEmployee(group, group.GroupLeader)) | ||
26 | + } | ||
27 | + for i := range group.GroupMembers { | ||
28 | + employees = append(employees, NewGroupEmployee(group, group.GroupMembers[i])) | ||
29 | + } | ||
30 | + return employees | ||
31 | +} | ||
32 | + | ||
33 | +func NewGroupEmployee(group *domain.ProductGroup, u *domain.User) *ProductGroupEmployeesDto { | ||
34 | + item := &ProductGroupEmployeesDto{} | ||
35 | + item.UserId = u.UserId | ||
36 | + item.UserName = u.UserName | ||
37 | + item.GroupName = group.GroupName | ||
38 | + workOns := domain.WorkOnDescription(group.WorkOn) | ||
39 | + item.WorkOnDescription = strings.Join(workOns, ",") | ||
40 | + //item.WorkStationId = group.WorkStation.WorkStationId | ||
41 | + return item | ||
42 | +} | ||
43 | + | ||
44 | +type ProductGroupEmployeesDtos struct { | ||
45 | + Result []*ProductGroupEmployeesDto | ||
46 | + MapResult map[int]*ProductGroupEmployeesDto | ||
47 | +} | ||
48 | + | ||
49 | +func (d *ProductGroupEmployeesDtos) Append(items ...*ProductGroupEmployeesDto) { | ||
50 | + for i := range items { | ||
51 | + if _, ok := d.MapResult[items[i].UserId]; ok { | ||
52 | + continue | ||
53 | + } | ||
54 | + d.MapResult[items[i].UserId] = items[i] | ||
55 | + d.Result = append(d.Result, items[i]) | ||
56 | + } | ||
57 | +} | ||
58 | + | ||
59 | +func (d *ProductGroupEmployeesDtos) LoadDto(groups ...*domain.ProductGroup) { | ||
60 | + for i := range groups { | ||
61 | + items := NewProductGroupEmployeesDto(groups[i]) | ||
62 | + d.Append(items...) | ||
63 | + } | ||
64 | +} | ||
65 | + | ||
66 | +func NewProductGroupEmployeesDtos() *ProductGroupEmployeesDtos { | ||
67 | + return &ProductGroupEmployeesDtos{ | ||
68 | + Result: make([]*ProductGroupEmployeesDto, 0), | ||
69 | + MapResult: make(map[int]*ProductGroupEmployeesDto), | ||
70 | + } | ||
71 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +type SearchProductGroupEmployeesQuery struct { | ||
11 | + // 查询偏离量 | ||
12 | + //Offset int `cname:"查询偏离量" json:"offset"` | ||
13 | + // 查询限制 | ||
14 | + //Limit int `cname:"查询限制" json:"limit"` | ||
15 | + // 页码 | ||
16 | + //PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | ||
17 | + // 页数 | ||
18 | + //PageSize int `cname:"页数" json:"pageSize,omitempty"` | ||
19 | + // 当前公司 | ||
20 | + CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | ||
21 | + // 当前登录的组织 | ||
22 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` | ||
23 | + // 车间ID | ||
24 | + WorkshopId int `cname:"车间ID" json: workshopId,omitempty"` | ||
25 | + // 生产线ID | ||
26 | + LineId int `cname:"生产线ID" json:"lineId,omitempty"` | ||
27 | + // 工段ID | ||
28 | + SectionId int `json:"sectionId,omitempty"` | ||
29 | +} | ||
30 | + | ||
31 | +func (listProductGroupQuery *SearchProductGroupEmployeesQuery) Valid(validation *validation.Validation) { | ||
32 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
33 | +} | ||
34 | + | ||
35 | +func (listProductGroupQuery *SearchProductGroupEmployeesQuery) ValidateQuery() error { | ||
36 | + valid := validation.Validation{} | ||
37 | + b, err := valid.Valid(listProductGroupQuery) | ||
38 | + if err != nil { | ||
39 | + return err | ||
40 | + } | ||
41 | + if !b { | ||
42 | + elem := reflect.TypeOf(listProductGroupQuery).Elem() | ||
43 | + for _, validErr := range valid.Errors { | ||
44 | + field, isExist := elem.FieldByName(validErr.Field) | ||
45 | + if isExist { | ||
46 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
47 | + } else { | ||
48 | + return fmt.Errorf(validErr.Message) | ||
49 | + } | ||
50 | + } | ||
51 | + } | ||
52 | + return nil | ||
53 | +} |
@@ -367,6 +367,48 @@ func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo * | @@ -367,6 +367,48 @@ func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo * | ||
367 | return count, results, nil | 367 | return count, results, nil |
368 | } | 368 | } |
369 | 369 | ||
370 | +// 返回生产班组服务列表 | ||
371 | +func (productGroupService *ProductGroupService) SearchProductGroupEmployees(operateInfo *domain.OperateInfo, cmd *query.SearchProductGroupEmployeesQuery) (int64, interface{}, error) { | ||
372 | + if err := cmd.ValidateQuery(); err != nil { | ||
373 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
374 | + } | ||
375 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
376 | + if err != nil { | ||
377 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
378 | + } | ||
379 | + if err := transactionContext.StartTransaction(); err != nil { | ||
380 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
381 | + } | ||
382 | + defer func() { | ||
383 | + transactionContext.RollbackTransaction() | ||
384 | + }() | ||
385 | + | ||
386 | + //workshops, _ := factory.FastPgWorkshops(transactionContext, operateInfo.CompanyId) | ||
387 | + queryOptions := utils.ObjectToMap(cmd) | ||
388 | + //queryOptions = workshops.FindByNameWithQuery(queryOptions, cmd.WorkshopName, cmd.LineName, "") | ||
389 | + | ||
390 | + var productGroupRepository domain.ProductGroupRepository | ||
391 | + productGroupRepository, _, _ = factory.FastPgProductGroup(transactionContext, 0) | ||
392 | + _, productGroups, err := productGroupRepository.Find(queryOptions) | ||
393 | + if err != nil { | ||
394 | + return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
395 | + } | ||
396 | + var results = dto.NewProductGroupEmployeesDtos() | ||
397 | + for i := range productGroups { | ||
398 | + item := productGroups[i] | ||
399 | + //workStation := workshops.FindWorkStation(item.WorkStation.WorkshopId, item.WorkStation.LineId, item.WorkStation.SectionId) | ||
400 | + //item.WorkStation = workStation | ||
401 | + items := dto.NewProductGroupEmployeesDto(item) | ||
402 | + results.Append(items...) | ||
403 | + } | ||
404 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
405 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
406 | + } | ||
407 | + return int64(len(results.Result)), map[string]interface{}{ | ||
408 | + "employees": results.Result, | ||
409 | + }, nil | ||
410 | +} | ||
411 | + | ||
370 | func NewProductGroupService(options map[string]interface{}) *ProductGroupService { | 412 | func NewProductGroupService(options map[string]interface{}) *ProductGroupService { |
371 | newProductGroupService := &ProductGroupService{} | 413 | newProductGroupService := &ProductGroupService{} |
372 | return newProductGroupService | 414 | return newProductGroupService |
@@ -19,7 +19,7 @@ type SearchProductPlanQuery struct { | @@ -19,7 +19,7 @@ type SearchProductPlanQuery struct { | ||
19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
20 | OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` | 20 | OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
21 | // 匹配多个组织 | 21 | // 匹配多个组织 |
22 | - InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty"` |
23 | // 页码 | 23 | // 页码 |
24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
25 | // 页数 | 25 | // 页数 |
1 | +package dto | ||
2 | + | ||
3 | +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | ||
4 | + | ||
5 | +type MaterialUnitConversionDto struct { | ||
6 | + // 单位换算ID | ||
7 | + UnitConversionId int `json:"unitConversionId,omitempty"` | ||
8 | + // 物料名称 | ||
9 | + MaterialName string `json:"materialName,omitempty"` | ||
10 | + // 转换前单位数量 | ||
11 | + FromUnitQuantity *domain.UnitQuantity `json:"fromUnitQuantity,omitempty"` | ||
12 | + // 转换后单位数量 | ||
13 | + ToUnitQuantity *domain.UnitQuantity `json:"toUnitQuantity,omitempty"` | ||
14 | +} | ||
15 | + | ||
16 | +func (d *MaterialUnitConversionDto) LoadDto(m *domain.UnitConversion) *MaterialUnitConversionDto { | ||
17 | + d.UnitConversionId = m.UnitConversionId | ||
18 | + d.MaterialName = m.Material.MaterialName | ||
19 | + d.FromUnitQuantity = m.FromUnitQuantity | ||
20 | + d.ToUnitQuantity = m.ToUnitQuantity | ||
21 | + return d | ||
22 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +type SearchMaterialsQuery struct { | ||
11 | + // 当前公司 | ||
12 | + CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | ||
13 | + // 当前登录的组织 | ||
14 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` | ||
15 | + // 车间ID | ||
16 | + WorkshopId int `cname:"车间ID" json: workshopId,omitempty"` | ||
17 | + // 生产线ID | ||
18 | + LineId int `cname:"生产线ID" json:"lineId,omitempty"` | ||
19 | + // 工段ID | ||
20 | + SectionId int `json:"sectionId,omitempty"` | ||
21 | +} | ||
22 | + | ||
23 | +func (listProductGroupQuery *SearchMaterialsQuery) Valid(validation *validation.Validation) { | ||
24 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
25 | +} | ||
26 | + | ||
27 | +func (listProductGroupQuery *SearchMaterialsQuery) ValidateQuery() error { | ||
28 | + valid := validation.Validation{} | ||
29 | + b, err := valid.Valid(listProductGroupQuery) | ||
30 | + if err != nil { | ||
31 | + return err | ||
32 | + } | ||
33 | + if !b { | ||
34 | + elem := reflect.TypeOf(listProductGroupQuery).Elem() | ||
35 | + for _, validErr := range valid.Errors { | ||
36 | + field, isExist := elem.FieldByName(validErr.Field) | ||
37 | + if isExist { | ||
38 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
39 | + } else { | ||
40 | + return fmt.Errorf(validErr.Message) | ||
41 | + } | ||
42 | + } | ||
43 | + } | ||
44 | + return nil | ||
45 | +} |
@@ -307,6 +307,42 @@ func (unitConversionService *UnitConversionService) SearchUnitConversion(operate | @@ -307,6 +307,42 @@ func (unitConversionService *UnitConversionService) SearchUnitConversion(operate | ||
307 | return count, result, nil | 307 | return count, result, nil |
308 | } | 308 | } |
309 | 309 | ||
310 | +// 返回单位换算服务列表 | ||
311 | +func (unitConversionService *UnitConversionService) SearchMaterial(operateInfo *domain.OperateInfo, listUnitConversionQuery *query.SearchMaterialsQuery) (int64, interface{}, error) { | ||
312 | + if err := listUnitConversionQuery.ValidateQuery(); err != nil { | ||
313 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
314 | + } | ||
315 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
316 | + if err != nil { | ||
317 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
318 | + } | ||
319 | + if err := transactionContext.StartTransaction(); err != nil { | ||
320 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
321 | + } | ||
322 | + defer func() { | ||
323 | + transactionContext.RollbackTransaction() | ||
324 | + }() | ||
325 | + unitConversionRepository, _, _ := factory.FastPgUnitConversion(transactionContext, 0) | ||
326 | + count, unitConversions, err := unitConversionRepository.Find(utils.ObjectToMap(listUnitConversionQuery)) | ||
327 | + if err != nil { | ||
328 | + return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
329 | + } | ||
330 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
331 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
332 | + } | ||
333 | + | ||
334 | + var result = make([]*dto.MaterialUnitConversionDto, 0) | ||
335 | + for i := range unitConversions { | ||
336 | + item := unitConversions[i] | ||
337 | + newItem := &dto.MaterialUnitConversionDto{} | ||
338 | + newItem.LoadDto(item) | ||
339 | + result = append(result, newItem) | ||
340 | + } | ||
341 | + return count, map[string]interface{}{ | ||
342 | + "materials": result, | ||
343 | + }, nil | ||
344 | +} | ||
345 | + | ||
310 | func NewUnitConversionService(options map[string]interface{}) *UnitConversionService { | 346 | func NewUnitConversionService(options map[string]interface{}) *UnitConversionService { |
311 | newUnitConversionService := &UnitConversionService{} | 347 | newUnitConversionService := &UnitConversionService{} |
312 | return newUnitConversionService | 348 | return newUnitConversionService |
@@ -166,7 +166,10 @@ func (repository *ProductGroupRepository) Find(queryOptions map[string]interface | @@ -166,7 +166,10 @@ func (repository *ProductGroupRepository) Find(queryOptions map[string]interface | ||
166 | if v, ok := queryOptions["groupName"]; ok && len(v.(string)) > 0 { | 166 | if v, ok := queryOptions["groupName"]; ok && len(v.(string)) > 0 { |
167 | query.Where(fmt.Sprintf(`group_name like '%%%v%%'`, v)) | 167 | query.Where(fmt.Sprintf(`group_name like '%%%v%%'`, v)) |
168 | } | 168 | } |
169 | - query.SetOffsetAndLimit(20) | 169 | + query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") |
170 | + query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId") | ||
171 | + query.SetWhereByQueryOption("work_station->>'sectionId'='?'", "sectionId") | ||
172 | + query.SetOffsetAndLimit(domain.MaxQueryRow) | ||
170 | query.SetOrderDirect("product_group_id", "DESC") | 173 | query.SetOrderDirect("product_group_id", "DESC") |
171 | if count, err := query.SelectAndCount(); err != nil { | 174 | if count, err := query.SelectAndCount(); err != nil { |
172 | return 0, productGroups, err | 175 | return 0, productGroups, err |
@@ -183,7 +183,7 @@ func (repository *ProductPlanRepository) Find(queryOptions map[string]interface{ | @@ -183,7 +183,7 @@ func (repository *ProductPlanRepository) Find(queryOptions map[string]interface{ | ||
183 | query.Where(fmt.Sprintf(`workshop->>'workshopName' like '%%%v%%'`, v)) | 183 | query.Where(fmt.Sprintf(`workshop->>'workshopName' like '%%%v%%'`, v)) |
184 | } | 184 | } |
185 | query.SetWhereByQueryOption("plan_status=?", "planStatus") | 185 | query.SetWhereByQueryOption("plan_status=?", "planStatus") |
186 | - query.SetOffsetAndLimit(20) | 186 | + query.SetOffsetAndLimit(domain.MaxQueryRow) |
187 | query.SetOrderDirect("product_plan_id", "DESC") | 187 | query.SetOrderDirect("product_plan_id", "DESC") |
188 | if count, err := query.SelectAndCount(); err != nil { | 188 | if count, err := query.SelectAndCount(); err != nil { |
189 | return 0, productPlans, err | 189 | return 0, productPlans, err |
@@ -149,7 +149,7 @@ func (repository *ProductRecordRepository) Find(queryOptions map[string]interfac | @@ -149,7 +149,7 @@ func (repository *ProductRecordRepository) Find(queryOptions map[string]interfac | ||
149 | var productRecordModels []*models.ProductRecord | 149 | var productRecordModels []*models.ProductRecord |
150 | productRecords := make([]*domain.ProductRecord, 0) | 150 | productRecords := make([]*domain.ProductRecord, 0) |
151 | query := sqlbuilder.BuildQuery(tx.Model(&productRecordModels), queryOptions) | 151 | query := sqlbuilder.BuildQuery(tx.Model(&productRecordModels), queryOptions) |
152 | - query.SetOffsetAndLimit(20) | 152 | + query.SetOffsetAndLimit(domain.MaxQueryRow) |
153 | query.SetOrderDirect("product_record_id", "DESC") | 153 | query.SetOrderDirect("product_record_id", "DESC") |
154 | if count, err := query.SelectAndCount(); err != nil { | 154 | if count, err := query.SelectAndCount(); err != nil { |
155 | return 0, productRecords, err | 155 | return 0, productRecords, err |
@@ -157,7 +157,7 @@ func (repository *ProductRepository) Find(queryOptions map[string]interface{}) ( | @@ -157,7 +157,7 @@ func (repository *ProductRepository) Find(queryOptions map[string]interface{}) ( | ||
157 | if v, ok := queryOptions["productCategory"]; ok && len(v.(string)) > 0 { | 157 | if v, ok := queryOptions["productCategory"]; ok && len(v.(string)) > 0 { |
158 | query.Where(fmt.Sprintf(`product_category like '%%%v%%'`, v)) | 158 | query.Where(fmt.Sprintf(`product_category like '%%%v%%'`, v)) |
159 | } | 159 | } |
160 | - query.SetOffsetAndLimit(20) | 160 | + query.SetOffsetAndLimit(domain.MaxQueryRow) |
161 | query.SetOrderDirect("product_id", "DESC") | 161 | query.SetOrderDirect("product_id", "DESC") |
162 | if count, err := query.SelectAndCount(); err != nil { | 162 | if count, err := query.SelectAndCount(); err != nil { |
163 | return 0, products, err | 163 | return 0, products, err |
@@ -146,6 +146,9 @@ func (repository *UnitConversionRepository) Find(queryOptions map[string]interfa | @@ -146,6 +146,9 @@ func (repository *UnitConversionRepository) Find(queryOptions map[string]interfa | ||
146 | query := sqlbuilder.BuildQuery(tx.Model(&unitConversionModels), queryOptions) | 146 | query := sqlbuilder.BuildQuery(tx.Model(&unitConversionModels), queryOptions) |
147 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 147 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
148 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 148 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
149 | + query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") | ||
150 | + query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId") | ||
151 | + query.SetWhereByQueryOption("work_station->>'sectionId'='?'", "sectionId") | ||
149 | if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | 152 | if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { |
150 | query.Where(`org_id in (?)`, pg.In(v)) | 153 | query.Where(`org_id in (?)`, pg.In(v)) |
151 | } | 154 | } |
@@ -78,3 +78,14 @@ func (controller *ProductGroupController) SearchProductGroup() { | @@ -78,3 +78,14 @@ func (controller *ProductGroupController) SearchProductGroup() { | ||
78 | total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), cmd) | 78 | total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), cmd) |
79 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
80 | } | 80 | } |
81 | + | ||
82 | +func (controller *ProductGroupController) SearchProductGroupEmployees() { | ||
83 | + productGroupService := service.NewProductGroupService(nil) | ||
84 | + cmd := &query.SearchProductGroupEmployeesQuery{} | ||
85 | + Must(controller.Unmarshal(cmd)) | ||
86 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
87 | + cmd.OrgId = operateInfo.OrgId | ||
88 | + cmd.CompanyId = operateInfo.CompanyId | ||
89 | + _, data, err := productGroupService.SearchProductGroupEmployees(operateInfo, cmd) | ||
90 | + controller.Response(data, err) | ||
91 | +} |
@@ -78,3 +78,14 @@ func (controller *UnitConversionController) SearchUnitConversion() { | @@ -78,3 +78,14 @@ func (controller *UnitConversionController) SearchUnitConversion() { | ||
78 | total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), cmd) | 78 | total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), cmd) |
79 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
80 | } | 80 | } |
81 | + | ||
82 | +func (controller *UnitConversionController) SearchMaterial() { | ||
83 | + unitConversionService := service.NewUnitConversionService(nil) | ||
84 | + cmd := &query.SearchMaterialsQuery{} | ||
85 | + Must(controller.Unmarshal(cmd)) | ||
86 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
87 | + cmd.OrgId = operateInfo.OrgId | ||
88 | + cmd.CompanyId = operateInfo.CompanyId | ||
89 | + _, data, err := unitConversionService.SearchMaterial(ParseOperateInfo(controller.BaseController), cmd) | ||
90 | + controller.Response(data, err) | ||
91 | +} |
@@ -13,4 +13,5 @@ func init() { | @@ -13,4 +13,5 @@ func init() { | ||
13 | web.Router("/product-groups/batch-remove", &controllers.ProductGroupController{}, "Post:BatchRemoveProductGroup") | 13 | web.Router("/product-groups/batch-remove", &controllers.ProductGroupController{}, "Post:BatchRemoveProductGroup") |
14 | web.Router("/product-groups/", &controllers.ProductGroupController{}, "Get:ListProductGroup") | 14 | web.Router("/product-groups/", &controllers.ProductGroupController{}, "Get:ListProductGroup") |
15 | web.Router("/product-groups/search", &controllers.ProductGroupController{}, "Post:SearchProductGroup") | 15 | web.Router("/product-groups/search", &controllers.ProductGroupController{}, "Post:SearchProductGroup") |
16 | + web.Router("/product-groups/employees", &controllers.ProductGroupController{}, "Post:SearchProductGroupEmployees") | ||
16 | } | 17 | } |
@@ -13,4 +13,6 @@ func init() { | @@ -13,4 +13,6 @@ func init() { | ||
13 | web.Router("/unit-conversions/batch-remove", &controllers.UnitConversionController{}, "Post:BatchRemoveUnitConversion") | 13 | web.Router("/unit-conversions/batch-remove", &controllers.UnitConversionController{}, "Post:BatchRemoveUnitConversion") |
14 | web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Get:ListUnitConversion") | 14 | web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Get:ListUnitConversion") |
15 | web.Router("/unit-conversions/search", &controllers.UnitConversionController{}, "Post:SearchUnitConversion") | 15 | web.Router("/unit-conversions/search", &controllers.UnitConversionController{}, "Post:SearchUnitConversion") |
16 | + | ||
17 | + web.Router("/unit-conversions/materials", &controllers.UnitConversionController{}, "Post:SearchMaterial") | ||
16 | } | 18 | } |
-
请 注册 或 登录 后发表评论