作者 Administrator

合并分支 'test' 到 'master'

Test



查看合并请求 !33
  1 +{
  2 + // 使用 IntelliSense 了解相关属性。
  3 + // 悬停以查看现有属性的描述。
  4 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  5 + "version": "0.2.0",
  6 + "configurations": [
  7 + {
  8 + "name": "Launch file",
  9 + "type": "go",
  10 + "request": "launch",
  11 + "mode": "debug",
  12 + "program": "./main.go",
  13 + "buildFlags": ""
  14 + }
  15 + ]
  16 +}
@@ -112,7 +112,7 @@ spec: @@ -112,7 +112,7 @@ spec:
112 - name: ALLIED_CREATION_COOPERATION_HOST 112 - name: ALLIED_CREATION_COOPERATION_HOST
113 value: "http://allied-creation-cooperation-dev.fjmaimaimai.com" 113 value: "http://allied-creation-cooperation-dev.fjmaimaimai.com"
114 - name: ALLIED_CREATION_MANUFACTURE_HOST 114 - name: ALLIED_CREATION_MANUFACTURE_HOST
115 - value: "http://106.75.231.90:9999" 115 + value: "http://allied-creation-manufacture-dev.fjmaimaimai.com" #http://106.75.231.90:9999
116 - name: ALLIED_CREATION_BASIC_HOST 116 - name: ALLIED_CREATION_BASIC_HOST
117 value: "http://allied-creation-basic-dev.fjmaimaimai.com" 117 value: "http://allied-creation-basic-dev.fjmaimaimai.com"
118 - name: SMS_SERVE_HOST 118 - name: SMS_SERVE_HOST
  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 +}
@@ -4,6 +4,9 @@ import ( @@ -4,6 +4,9 @@ import (
4 "bytes" 4 "bytes"
5 "encoding/json" 5 "encoding/json"
6 "fmt" 6 "fmt"
  7 + "io"
  8 + "strings"
  9 +
7 "github.com/linmadan/egglib-go/core/application" 10 "github.com/linmadan/egglib-go/core/application"
8 "github.com/linmadan/egglib-go/utils/excel" 11 "github.com/linmadan/egglib-go/utils/excel"
9 "github.com/xuri/excelize/v2" 12 "github.com/xuri/excelize/v2"
@@ -16,8 +19,6 @@ import ( @@ -16,8 +19,6 @@ import (
16 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured" 19 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
17 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/converter" 20 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/converter"
18 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/oss" 21 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/oss"
19 - "io"  
20 - "strings"  
21 ) 22 )
22 23
23 type ExcelDataService struct { 24 type ExcelDataService struct {
@@ -486,6 +487,14 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -486,6 +487,14 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
486 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220628/object/1656396441_5Ms2hRRk2Z7fTW32RWjwdKfhA5wM5YeZ.xlsx", 487 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220628/object/1656396441_5Ms2hRRk2Z7fTW32RWjwdKfhA5wM5YeZ.xlsx",
487 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx", 488 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
488 domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220616/object/1655349687_CjpXGrjD4EH2jrw4SXJmHkaQZXKQcT56.xlsx", 489 domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220616/object/1655349687_CjpXGrjD4EH2jrw4SXJmHkaQZXKQcT56.xlsx",
  490 + //车间制造-二级品审核导入
  491 + "ImportProductRecordLevel2": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221104/object/1667552594_netGknahfaANTkJw4zMXKXHYEbKsRskT.xlsx",
  492 + //车间制造-工时管理导入
  493 + "ImportAttendance": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221107/object/1667816767_tH2ZPNdmByGzQNhpFH4dpM7e5dH7z6nW.xlsx",
  494 + //车间制造-事故管理导入
  495 + "ImportProductTrouble": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221101/object/1667294264_2WyhcbfrAFJs3knpEnmnrTR7kA34XNFM.xlsx",
  496 + //产能管理导入
  497 + "ImportProductCapacities": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221101/object/1667294313_cJ7pysrycjdPePpDQaxQCacHdrPCYY6p.xlsx",
489 } 498 }
490 var url string 499 var url string
491 var ok bool 500 var ok bool
@@ -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 +}
@@ -15,16 +15,16 @@ var LOG_PREFIX = "[allied-creation-gateway]" @@ -15,16 +15,16 @@ var LOG_PREFIX = "[allied-creation-gateway]"
15 15
16 var FileStatic = "./static" 16 var FileStatic = "./static"
17 17
18 -var HTTP_PORT int = 8083 18 +var HTTP_PORT int = 8080
19 var ALLIED_CREATION_GATEWAY_HOST = "http://localhost:8080" 19 var ALLIED_CREATION_GATEWAY_HOST = "http://localhost:8080"
20 20
21 -//天联共创基础模块 21 +// 天联共创基础模块
22 var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com" 22 var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com"
23 23
24 -//天联共创用户模块 24 +// 天联共创用户模块
25 var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creation-user-dev.fjmaimaimai.com" 25 var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creation-user-dev.fjmaimaimai.com"
26 26
27 -//天联共创业务模块 27 +// 天联共创业务模块
28 var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied-creation-cooperation-dev.fjmaimaimai.com" 28 var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied-creation-cooperation-dev.fjmaimaimai.com"
29 29
30 // 天联共创 生产制造模块 30 // 天联共创 生产制造模块
@@ -33,10 +33,10 @@ var ALLIED_CREATION_MANUFACTURE_HOST = "http://localhost:8083" @@ -33,10 +33,10 @@ var ALLIED_CREATION_MANUFACTURE_HOST = "http://localhost:8083"
33 // 版本更新模块 33 // 版本更新模块
34 var SUPLUS_ADMIN_BASE_HOST = "http://suplus-admin-base-dev.fjmaimaimai.com" 34 var SUPLUS_ADMIN_BASE_HOST = "http://suplus-admin-base-dev.fjmaimaimai.com"
35 35
36 -//通用模块短信服务 36 +// 通用模块短信服务
37 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897" 37 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
38 38
39 -//素加销售导航服务 39 +// 素加销售导航服务
40 var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com" 40 var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
41 41
42 // TODO:特殊短信验证码,不验证,正式环境注入空 42 // TODO:特殊短信验证码,不验证,正式环境注入空
@@ -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 +}
1 package beego 1 package beego
2 2
3 import ( 3 import (
  4 + "net/http"
  5 + "os"
  6 + "strconv"
  7 +
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 8 "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" 9 "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_user" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
7 chart_editor "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/chart-editor" 11 chart_editor "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/chart-editor"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
9 - "net/http"  
10 - "os"  
11 - "strconv"  
12 13
13 "github.com/beego/beego/v2/server/web/context" 14 "github.com/beego/beego/v2/server/web/context"
14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 15 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
1 package web_client 1 package web_client
2 2
3 import ( 3 import (
  4 + "bytes"
4 "fmt" 5 "fmt"
5 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"  
6 "io" 6 "io"
  7 + "mime/multipart"
  8 + "net/http"
  9 + "net/url"
7 "strings" 10 "strings"
8 11
  12 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  13 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
  14 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/middleware"
  15 +
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 16 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
10 17
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" 18 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
12 19
13 "github.com/beego/beego/v2/server/web/context" 20 "github.com/beego/beego/v2/server/web/context"
  21 + "github.com/linmadan/egglib-go/core/application"
14 "github.com/linmadan/egglib-go/utils/excel" 22 "github.com/linmadan/egglib-go/utils/excel"
15 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query" 23 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
16 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/service" 24 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/service"
@@ -180,6 +188,44 @@ func (controller *ExcelDataController) FileImport() { @@ -180,6 +188,44 @@ func (controller *ExcelDataController) FileImport() {
180 importDividendsOrder(controller) 188 importDividendsOrder(controller)
181 case domain.ImportDividendsReturnOrders: 189 case domain.ImportDividendsReturnOrders:
182 importDividendsReturnedOrder(controller) 190 importDividendsReturnedOrder(controller)
  191 + case "ImportProductRecordLevel2", "ImportAttendance", "ImportProductTrouble", "ImportProductCapacities":
  192 + //二级品审核导入,工时管理导入 ,事故管理导入,产能管理导入
  193 + sourceFile, err := controller.GetExcelFile()
  194 + if err != nil {
  195 + e := application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  196 + controller.Response(nil, e)
  197 + return
  198 + }
  199 + bodyBuf := &bytes.Buffer{}
  200 + formWriter := multipart.NewWriter(bodyBuf)
  201 + fileWriter, _ := formWriter.CreateFormFile("file", code+".xlsx")
  202 + io.Copy(fileWriter, sourceFile)
  203 + formWriter.WriteField("code", code)
  204 + formWriter.Close()
  205 + target, _ := url.Parse(constant.ALLIED_CREATION_MANUFACTURE_HOST)
  206 + targetPath := strings.Replace(controller.Ctx.Request.URL.Path, "/v1/web", "", 1)
  207 + newReq, _ := http.NewRequest(http.MethodPost, target.String()+targetPath, bodyBuf)
  208 + // 传递当前登录信息(可配置)
  209 + loginToken, ok := middleware.FormCtxLoginToken(controller.Ctx)
  210 + if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 {
  211 + newReq.Header.Set("companyId", fmt.Sprintf("%v", loginToken.CompanyId))
  212 + newReq.Header.Set("orgId", fmt.Sprintf("%v", loginToken.OrgId))
  213 + newReq.Header.Set("userId", fmt.Sprintf("%v", loginToken.UserId))
  214 + orgIdList := make([]string, 0)
  215 + for i := range loginToken.OrgIds {
  216 + orgIdList = append(orgIdList, fmt.Sprintf("%d", loginToken.OrgIds[i]))
  217 + }
  218 + newReq.Header.Add("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
  219 + }
  220 + newReq.Header.Set("Content-Type", formWriter.FormDataContentType())
  221 + resp, err := http.DefaultClient.Do(newReq)
  222 + if err != nil {
  223 + e := application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  224 + controller.Response(nil, e)
  225 + return
  226 + }
  227 + respData, _ := io.ReadAll(resp.Body)
  228 + controller.Ctx.ResponseWriter.Write(respData)
183 default: 229 default:
184 defaultImport(controller) 230 defaultImport(controller)
185 } 231 }
@@ -307,6 +353,12 @@ func fileExport(controller *ExcelDataController, code string) { @@ -307,6 +353,12 @@ func fileExport(controller *ExcelDataController, code string) {
307 query.Operator = exportDataCommand.Operator 353 query.Operator = exportDataCommand.Operator
308 data, err = excelService.ExportDailyFillingAbnormalLog(query) 354 data, err = excelService.ExportDailyFillingAbnormalLog(query)
309 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 = "导出功过奖惩明细"
310 default: 362 default:
311 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code) 363 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
312 } 364 }
@@ -366,7 +418,7 @@ func (controller *ExcelDataController) ExportCostStructuredDailyFillingAbnormalL @@ -366,7 +418,7 @@ func (controller *ExcelDataController) ExportCostStructuredDailyFillingAbnormalL
366 fileExport(controller, domain.ExportCostStructuredDailyFillingAbnormalLog) 418 fileExport(controller, domain.ExportCostStructuredDailyFillingAbnormalLog)
367 } 419 }
368 420
369 -//GetExcelDataFields 获取导出excel数据的可选字段 421 +// GetExcelDataFields 获取导出excel数据的可选字段
370 func (controller *ExcelDataController) GetExcelDataFields() { 422 func (controller *ExcelDataController) GetExcelDataFields() {
371 code := controller.GetString(":code") 423 code := controller.GetString(":code")
372 var excelService = service.NewExcelDataService(nil) 424 var excelService = service.NewExcelDataService(nil)
@@ -3,14 +3,15 @@ package middleware @@ -3,14 +3,15 @@ package middleware
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
5 "fmt" 5 "fmt"
  6 + "io/ioutil"
  7 + "net/http"
  8 + "strings"
  9 +
6 "github.com/beego/beego/v2/client/httplib" 10 "github.com/beego/beego/v2/client/httplib"
7 "github.com/beego/beego/v2/server/web" 11 "github.com/beego/beego/v2/server/web"
8 "github.com/beego/beego/v2/server/web/context" 12 "github.com/beego/beego/v2/server/web/context"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" 14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
11 - "io/ioutil"  
12 - "net/http"  
13 - "strings"  
14 ) 15 )
15 16
16 type internalService interface { 17 type internalService interface {
@@ -53,6 +54,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc @@ -53,6 +54,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc
53 } 54 }
54 req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ","))) 55 req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
55 } 56 }
  57 +
56 req.Body(ctx.Input.RequestBody) 58 req.Body(ctx.Input.RequestBody)
57 response, err := req.Response() 59 response, err := req.Response()
58 if err != nil { 60 if err != nil {
@@ -35,4 +35,36 @@ func init() { @@ -35,4 +35,36 @@ func init() {
35 web.Post("/v1/manufacture-weigh/statistics/device-production-efficiency-statistics", middleware.RedirectManufactureWeigh()) 35 web.Post("/v1/manufacture-weigh/statistics/device-production-efficiency-statistics", middleware.RedirectManufactureWeigh())
36 36
37 web.Post("/v1/manufacture-weigh/statistics/internal/:actionType", middleware.RedirectManufactureWeigh()) 37 web.Post("/v1/manufacture-weigh/statistics/internal/:actionType", middleware.RedirectManufactureWeigh())
  38 + //奖惩标准
  39 + web.Post("/v1/manufacture-weigh/reward-standard/search", middleware.RedirectManufactureWeigh())
  40 + //奖惩规则
  41 + web.Get("/v1/manufacture-weigh/reward-rule/", middleware.RedirectManufactureWeigh())
  42 + // 功过看板(员工)-日榜
  43 + web.Get("/v1/manufacture-weigh/reward-summary/public-notice/day", middleware.RedirectManufactureWeigh())
  44 + // 功过看板(员工)-产效
  45 + web.Get("/v1/manufacture-weigh/reward-summary/public-notice/yield", middleware.RedirectManufactureWeigh())
  46 + // 功过看板 (员工)-合格率
  47 + web.Get("/v1/manufacture-weigh/reward-summary/public-notice/up-to-standard", middleware.RedirectManufactureWeigh())
  48 + // 功过看板 (员工)-异常
  49 + web.Get("/v1/manufacture-weigh/reward-summary/public-notice/accident", middleware.RedirectManufactureWeigh())
  50 + // 功过看板 (员工)-月榜
  51 + web.Get("/v1/manufacture-weigh/reward-summary/public-notice/month", middleware.RedirectManufactureWeigh())
  52 +
  53 + //车间看板(生产)
  54 + //车间描述
  55 + web.Get("/v1/manufacture-weigh/workshop-public-notice/workshop", middleware.RedirectManufactureWeigh())
  56 + //员工效率排名
  57 + web.Get("/v1/manufacture-weigh/workshop-public-notice/employee/workpiece-ratio", middleware.RedirectManufactureWeigh())
  58 + //时段产能
  59 + web.Get("/v1/manufacture-weigh/workshop-public-notice/section-product-info", middleware.RedirectManufactureWeigh())
  60 + //二级品占比
  61 + web.Get("/v1/manufacture-weigh/workshop-public-notice/proportion-of-second-level", middleware.RedirectManufactureWeigh())
  62 + //今日 昨日 历史最佳
  63 + web.Get("/v1/manufacture-weigh/workshop-public-notice/top-show", middleware.RedirectManufactureWeigh())
  64 + //计划批次
  65 + web.Get("/v1/manufacture-weigh/workshop-public-notice/product_plan", middleware.RedirectManufactureWeigh())
  66 + //计划达成率
  67 + web.Get("/v1/manufacture-weigh/workshop-public-notice/workshop-plan-completion/current", middleware.RedirectManufactureWeigh())
  68 + //近5天计划达成率
  69 + web.Get("/v1/manufacture-weigh/workshop-public-notice/workshop-plan-completion/5day", middleware.RedirectManufactureWeigh())
38 } 70 }