作者 Your Name

更新数据导出

  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
  6 +)
  7 +
  8 +type ManufactureExportRewardSummaryQuery struct {
  9 + *allied_creation_manufacture.SearchRewardSummaryRequest
  10 + //操作人
  11 + Operator domain.Operator `json:"-"`
  12 + SelectedField []string `json:"selectedField"`
  13 +}
@@ -2,6 +2,7 @@ package service @@ -2,6 +2,7 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
7 8
@@ -150,3 +151,15 @@ func (srv ExcelDataService) ExportDailyFillingAbnormalLog(cmd *query.CostDailyFi @@ -150,3 +151,15 @@ func (srv ExcelDataService) ExportDailyFillingAbnormalLog(cmd *query.CostDailyFi
150 } 151 }
151 return ExportDailyFillingAbnormalLog{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil 152 return ExportDailyFillingAbnormalLog{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
152 } 153 }
  154 +
  155 +// ExportRewardSummary 导出功过奖惩明细
  156 +func (srv ExcelDataService) ExportRewardSummary(cmd *query.ManufactureExportRewardSummaryQuery) (ExportRewardSummaryData, error) {
  157 + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
  158 + cmd.PageNumber = 1
  159 + cmd.PageSize = 10000
  160 + result, err := creationUserGateway.SearchRewardSummary(*cmd.SearchRewardSummaryRequest)
  161 + if err != nil {
  162 + return ExportRewardSummaryData{}, fmt.Errorf("获取功过奖惩明细数据失败:%w", err)
  163 + }
  164 + return ExportRewardSummaryData{SourceData: result.Grid.List}, nil
  165 +}
@@ -2,6 +2,7 @@ package service @@ -2,6 +2,7 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/linmadan/egglib-go/utils/excel" 6 "github.com/linmadan/egglib-go/utils/excel"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
@@ -98,7 +99,7 @@ func (data ExportCompanyUserData) TableTitle() []string { @@ -98,7 +99,7 @@ func (data ExportCompanyUserData) TableTitle() []string {
98 return nil 99 return nil
99 } 100 }
100 101
101 -//ExportCooperationUserData 导出共创用户数据 102 +// ExportCooperationUserData 导出共创用户数据
102 type ExportCooperationUserData struct { 103 type ExportCooperationUserData struct {
103 SourceData []allied_creation_user.UserDetail 104 SourceData []allied_creation_user.UserDetail
104 SelectedField []string 105 SelectedField []string
@@ -179,7 +180,7 @@ func (data ExportCooperationUserData) TableTitle() []string { @@ -179,7 +180,7 @@ func (data ExportCooperationUserData) TableTitle() []string {
179 return nil 180 return nil
180 } 181 }
181 182
182 -//ExportProductsData 导出产品数据 183 +// ExportProductsData 导出产品数据
183 type ExportProductsData struct { 184 type ExportProductsData struct {
184 SourceData []allied_creation_manufacture.SearchProductItem 185 SourceData []allied_creation_manufacture.SearchProductItem
185 SelectedField []string 186 SelectedField []string
@@ -241,7 +242,7 @@ func (data ExportProductsData) TableTitle() []string { @@ -241,7 +242,7 @@ func (data ExportProductsData) TableTitle() []string {
241 return nil 242 return nil
242 } 243 }
243 244
244 -//ExportEmployeeProductiveData 导出员工产能数据 245 +// ExportEmployeeProductiveData 导出员工产能数据
245 type ExportEmployeeProductiveData struct { 246 type ExportEmployeeProductiveData struct {
246 SourceData []allied_creation_manufacture.EmployeeProductiveItem 247 SourceData []allied_creation_manufacture.EmployeeProductiveItem
247 SelectedField []string 248 SelectedField []string
@@ -327,7 +328,7 @@ func (data ExportEmployeeProductiveData) TableTitle() []string { @@ -327,7 +328,7 @@ func (data ExportEmployeeProductiveData) TableTitle() []string {
327 return nil 328 return nil
328 } 329 }
329 330
330 -//ExportWorkshopProductiveData 导出员工产能数据 331 +// ExportWorkshopProductiveData 导出员工产能数据
331 type ExportWorkshopProductiveData struct { 332 type ExportWorkshopProductiveData struct {
332 SourceData []allied_creation_manufacture.WorkshopProductiveItem 333 SourceData []allied_creation_manufacture.WorkshopProductiveItem
333 SelectedField []string 334 SelectedField []string
@@ -409,7 +410,7 @@ func (data ExportWorkshopProductiveData) TableTitle() []string { @@ -409,7 +410,7 @@ func (data ExportWorkshopProductiveData) TableTitle() []string {
409 return nil 410 return nil
410 } 411 }
411 412
412 -//ExportEmployeeAttendanceStaticsData 导出员工产能数据 413 +// ExportEmployeeAttendanceStaticsData 导出员工产能数据
413 type ExportEmployeeAttendanceStaticsData struct { 414 type ExportEmployeeAttendanceStaticsData struct {
414 SourceData []allied_creation_manufacture.SearchEmployeeAttendanceStaticsItem 415 SourceData []allied_creation_manufacture.SearchEmployeeAttendanceStaticsItem
415 SelectedField []string 416 SelectedField []string
@@ -486,7 +487,7 @@ func (data ExportEmployeeAttendanceStaticsData) TableTitle() []string { @@ -486,7 +487,7 @@ func (data ExportEmployeeAttendanceStaticsData) TableTitle() []string {
486 return nil 487 return nil
487 } 488 }
488 489
489 -//ExportWorkshopAttendanceStaticsData 导出车间工时统计 490 +// ExportWorkshopAttendanceStaticsData 导出车间工时统计
490 type ExportWorkshopAttendanceStaticsData struct { 491 type ExportWorkshopAttendanceStaticsData struct {
491 SourceData []allied_creation_manufacture.SearchWorkshopWorkTimeStaticsItem 492 SourceData []allied_creation_manufacture.SearchWorkshopWorkTimeStaticsItem
492 SelectedField []string 493 SelectedField []string
@@ -557,7 +558,7 @@ func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string { @@ -557,7 +558,7 @@ func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string {
557 return nil 558 return nil
558 } 559 }
559 560
560 -//ExportWorkshopProductiveData 导出员工产能数据 561 +// ExportWorkshopProductiveData 导出员工产能数据
561 type ExportSecondLevelData struct { 562 type ExportSecondLevelData struct {
562 SourceData []allied_creation_manufacture.SecondLevelRecordItem 563 SourceData []allied_creation_manufacture.SecondLevelRecordItem
563 SelectedField []string 564 SelectedField []string
@@ -636,3 +637,63 @@ func (data ExportSecondLevelData) DataListLen() int { @@ -636,3 +637,63 @@ func (data ExportSecondLevelData) DataListLen() int {
636 func (data ExportSecondLevelData) TableTitle() []string { 637 func (data ExportSecondLevelData) TableTitle() []string {
637 return nil 638 return nil
638 } 639 }
  640 +
  641 +// ExportRewardSummaryData 导出奖惩明细数据
  642 +type ExportRewardSummaryData struct {
  643 + SourceData []allied_creation_manufacture.RewardSummaryItem
  644 +}
  645 +
  646 +var _ excel.ExcelMaker = (*ExportRewardSummaryData)(nil)
  647 +
  648 +func (data ExportRewardSummaryData) CellValue(index int, enName string) (value interface{}) {
  649 + switch enName {
  650 + case "workshopName":
  651 + return data.SourceData[index].WorkshopName
  652 + case "recordDate":
  653 + return data.SourceData[index].RecordDate
  654 + case "sectionName":
  655 + return data.SourceData[index].SectionName
  656 + case "workerName":
  657 + return data.SourceData[index].WorkerName
  658 + case "upToStandard":
  659 + return data.SourceData[index].UpToStandard
  660 + case "yield":
  661 + return data.SourceData[index].Yield
  662 + case "accident1":
  663 + return data.SourceData[index].Accident1
  664 + case "accident2":
  665 + return data.SourceData[index].Accident2
  666 + case "accident3":
  667 + return data.SourceData[index].Accident3
  668 + case "summaryResult":
  669 + return data.SourceData[index].SummaryResult
  670 + case "resultDesc":
  671 + return data.SourceData[index].ResultDesc
  672 + }
  673 + return ""
  674 +}
  675 +
  676 +func (data ExportRewardSummaryData) DataFieldList() []excel.DataField {
  677 + fields := []excel.DataField{
  678 + {EnName: "recordDate", CnName: "日期"},
  679 + {EnName: "workshopName", CnName: "车间"},
  680 + {EnName: "sectionName", CnName: "工段"},
  681 + {EnName: "workerName", CnName: "姓名"},
  682 + {EnName: "yield", CnName: "产效"},
  683 + {EnName: "upToStandard", CnName: "合格率"},
  684 + {EnName: "accident1", CnName: "质量事故"},
  685 + {EnName: "accident2", CnName: "安全事故"},
  686 + {EnName: "accident3", CnName: "异物"},
  687 + {EnName: "summaryResult", CnName: "奖惩结果(元)"},
  688 + {EnName: "resultDesc", CnName: "产效结果"},
  689 + }
  690 + return fields
  691 +}
  692 +
  693 +func (data ExportRewardSummaryData) DataListLen() int {
  694 + return len(data.SourceData)
  695 +}
  696 +
  697 +func (data ExportRewardSummaryData) TableTitle() []string {
  698 + return nil
  699 +}
@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
10 ) 10 )
11 11
12 -//HttpLibAlliedCreationManufacture 生产制造模块 12 +// HttpLibAlliedCreationManufacture 生产制造模块
13 type HttpLibAlliedCreationManufacture struct { 13 type HttpLibAlliedCreationManufacture struct {
14 service_gateway.BaseServiceGateway 14 service_gateway.BaseServiceGateway
15 baseUrL string 15 baseUrL string
@@ -35,7 +35,7 @@ func (gateway HttpLibAlliedCreationManufacture) BaseUrl() string { @@ -35,7 +35,7 @@ func (gateway HttpLibAlliedCreationManufacture) BaseUrl() string {
35 return gateway.baseUrL 35 return gateway.baseUrL
36 } 36 }
37 37
38 -//BatchAddProduct 批量添加产品 38 +// BatchAddProduct 批量添加产品
39 func (gateway HttpLibAlliedCreationManufacture) BatchAddProduct(param BatchAddProductRequest) (*BatchAddProductResponse, error) { 39 func (gateway HttpLibAlliedCreationManufacture) BatchAddProduct(param BatchAddProductRequest) (*BatchAddProductResponse, error) {
40 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/batch-add") 40 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/batch-add")
41 method := "post" 41 method := "post"
@@ -49,7 +49,7 @@ type BatchAddProductRequest struct { @@ -49,7 +49,7 @@ type BatchAddProductRequest struct {
49 } 49 }
50 type BatchAddProductResponse []interface{} 50 type BatchAddProductResponse []interface{}
51 51
52 -//SearchProduct 搜索产品 52 +// SearchProduct 搜索产品
53 func (gateway HttpLibAlliedCreationManufacture) SearchProduct(param SearchProductRequest) (*SearchProductResponse, error) { 53 func (gateway HttpLibAlliedCreationManufacture) SearchProduct(param SearchProductRequest) (*SearchProductResponse, error) {
54 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/search") 54 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/search")
55 method := "post" 55 method := "post"
@@ -87,7 +87,7 @@ type ( @@ -87,7 +87,7 @@ type (
87 87
88 /*设备*/ 88 /*设备*/
89 89
90 -//BatchAddProduct 批量添加产品 90 +// BatchAddProduct 批量添加产品
91 func (gateway HttpLibAlliedCreationManufacture) BatchAddDevice(param BatchAddDeviceRequest) (*BatchAddProductResponse, error) { 91 func (gateway HttpLibAlliedCreationManufacture) BatchAddDevice(param BatchAddDeviceRequest) (*BatchAddProductResponse, error) {
92 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/devices/batch-add") 92 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/devices/batch-add")
93 method := "post" 93 method := "post"
@@ -167,7 +167,7 @@ type ( @@ -167,7 +167,7 @@ type (
167 } 167 }
168 ) 168 )
169 169
170 -//SearchProduct 搜索员工产能统计 170 +// SearchProduct 搜索员工产能统计
171 func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) { 171 func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) {
172 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search") 172 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search")
173 method := "post" 173 method := "post"
@@ -226,7 +226,7 @@ type ( @@ -226,7 +226,7 @@ type (
226 } 226 }
227 ) 227 )
228 228
229 -//SearchProduct 搜索员工产能统计 229 +// SearchProduct 搜索员工产能统计
230 func (gateway HttpLibAlliedCreationManufacture) SearchSecondLevelRecord(param SearchSecondLevelRecordRequest) (*SearchSecondLevelRecordResponse, error) { 230 func (gateway HttpLibAlliedCreationManufacture) SearchSecondLevelRecord(param SearchSecondLevelRecordRequest) (*SearchSecondLevelRecordResponse, error) {
231 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/second-level-record/search") 231 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/second-level-record/search")
232 method := "post" 232 method := "post"
@@ -356,7 +356,7 @@ type ( @@ -356,7 +356,7 @@ type (
356 } 356 }
357 ) 357 )
358 358
359 -//SearchEmployeeAttendanceStatics 搜索员工工时统计 359 +// SearchEmployeeAttendanceStatics 搜索员工工时统计
360 func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) { 360 func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) {
361 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search") 361 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search")
362 method := "post" 362 method := "post"
@@ -399,3 +399,52 @@ type ( @@ -399,3 +399,52 @@ type (
399 AuthFlag bool `json:"authFlag"` 399 AuthFlag bool `json:"authFlag"`
400 } 400 }
401 ) 401 )
  402 +
  403 +// 搜索功过奖惩明细
  404 +type (
  405 + SearchRewardSummaryRequest struct {
  406 + // 页码
  407 + PageNumber int `json:"pageNumber"`
  408 + // 页数
  409 + PageSize int `json:"pageSize"`
  410 + // 车间名称
  411 + WorkshopName string `json:"workshopName"`
  412 + //产线名称
  413 + LineName string `json:"workerName"`
  414 + //开始日期
  415 + BeginDate string `json:"beginDate"`
  416 + //结束日期
  417 + EndDate string `json:"endDate"`
  418 + }
  419 +
  420 + SearchRewardSummaryResponse struct {
  421 + Grid struct {
  422 + List []RewardSummaryItem `json:"list"`
  423 + Total int `json:"total"`
  424 + } `json:"grid"`
  425 + }
  426 + RewardSummaryItem struct {
  427 + Id int `json:"id"`
  428 + RecordDate string `json:"recordDate"` //日期
  429 + WorkshopName string `json:"workshopName"` //车间名称
  430 + LineName string `json:"lineName"` //线别名称
  431 + SectionName string `json:"sectionName"` //工段
  432 + WorkerName string `json:"workerName"` //员工名字
  433 + Yield string `json:"yield"` //产效
  434 + UpToStandard string `json:"upToStandard"` //合格率
  435 + Accident1 string `json:"accident1"` //质量事故
  436 + Accident2 string `json:"accident2"` //安全事故
  437 + Accident3 string `json:"accident3"` //异物事故
  438 + SummaryResult string `json:"summaryResult"` //奖惩结果
  439 + ResultDesc string `json:"resultDesc"` //产效结果
  440 + }
  441 +)
  442 +
  443 +// SearchRewardSummary 搜索功过奖惩明细
  444 +func (gateway HttpLibAlliedCreationManufacture) SearchRewardSummary(param SearchRewardSummaryRequest) (*SearchRewardSummaryResponse, error) {
  445 + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product_trouble/reward_summary/seach")
  446 + method := "post"
  447 + var data SearchRewardSummaryResponse
  448 + err := gateway.FastDoRequest(url, method, param, &data)
  449 + return &data, err
  450 +}
@@ -353,6 +353,12 @@ func fileExport(controller *ExcelDataController, code string) { @@ -353,6 +353,12 @@ func fileExport(controller *ExcelDataController, code string) {
353 query.Operator = exportDataCommand.Operator 353 query.Operator = exportDataCommand.Operator
354 data, err = excelService.ExportDailyFillingAbnormalLog(query) 354 data, err = excelService.ExportDailyFillingAbnormalLog(query)
355 filename = "异常记录" 355 filename = "异常记录"
  356 + case "ExportRewardSummary":
  357 + query := &query.ManufactureExportRewardSummaryQuery{}
  358 + controllers.Must(exportDataCommand.UnmarshalQuery(query))
  359 + query.Operator = exportDataCommand.Operator
  360 + data, err = excelService.ExportRewardSummary(query)
  361 + filename = "导出功过奖惩明细"
356 default: 362 default:
357 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code) 363 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
358 } 364 }