作者 Your Name

更新数据导出

package query
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
)
type ManufactureExportRewardSummaryQuery struct {
*allied_creation_manufacture.SearchRewardSummaryRequest
//操作人
Operator domain.Operator `json:"-"`
SelectedField []string `json:"selectedField"`
}
... ...
... ... @@ -2,6 +2,7 @@ package service
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
... ... @@ -150,3 +151,15 @@ func (srv ExcelDataService) ExportDailyFillingAbnormalLog(cmd *query.CostDailyFi
}
return ExportDailyFillingAbnormalLog{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportRewardSummary 导出功过奖惩明细
func (srv ExcelDataService) ExportRewardSummary(cmd *query.ManufactureExportRewardSummaryQuery) (ExportRewardSummaryData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
cmd.PageNumber = 1
cmd.PageSize = 10000
result, err := creationUserGateway.SearchRewardSummary(*cmd.SearchRewardSummaryRequest)
if err != nil {
return ExportRewardSummaryData{}, fmt.Errorf("获取功过奖惩明细数据失败:%w", err)
}
return ExportRewardSummaryData{SourceData: result.Grid.List}, nil
}
... ...
... ... @@ -2,6 +2,7 @@ package service
import (
"fmt"
"github.com/linmadan/egglib-go/utils/excel"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
... ... @@ -98,7 +99,7 @@ func (data ExportCompanyUserData) TableTitle() []string {
return nil
}
//ExportCooperationUserData 导出共创用户数据
// ExportCooperationUserData 导出共创用户数据
type ExportCooperationUserData struct {
SourceData []allied_creation_user.UserDetail
SelectedField []string
... ... @@ -179,7 +180,7 @@ func (data ExportCooperationUserData) TableTitle() []string {
return nil
}
//ExportProductsData 导出产品数据
// ExportProductsData 导出产品数据
type ExportProductsData struct {
SourceData []allied_creation_manufacture.SearchProductItem
SelectedField []string
... ... @@ -241,7 +242,7 @@ func (data ExportProductsData) TableTitle() []string {
return nil
}
//ExportEmployeeProductiveData 导出员工产能数据
// ExportEmployeeProductiveData 导出员工产能数据
type ExportEmployeeProductiveData struct {
SourceData []allied_creation_manufacture.EmployeeProductiveItem
SelectedField []string
... ... @@ -327,7 +328,7 @@ func (data ExportEmployeeProductiveData) TableTitle() []string {
return nil
}
//ExportWorkshopProductiveData 导出员工产能数据
// ExportWorkshopProductiveData 导出员工产能数据
type ExportWorkshopProductiveData struct {
SourceData []allied_creation_manufacture.WorkshopProductiveItem
SelectedField []string
... ... @@ -409,7 +410,7 @@ func (data ExportWorkshopProductiveData) TableTitle() []string {
return nil
}
//ExportEmployeeAttendanceStaticsData 导出员工产能数据
// ExportEmployeeAttendanceStaticsData 导出员工产能数据
type ExportEmployeeAttendanceStaticsData struct {
SourceData []allied_creation_manufacture.SearchEmployeeAttendanceStaticsItem
SelectedField []string
... ... @@ -486,7 +487,7 @@ func (data ExportEmployeeAttendanceStaticsData) TableTitle() []string {
return nil
}
//ExportWorkshopAttendanceStaticsData 导出车间工时统计
// ExportWorkshopAttendanceStaticsData 导出车间工时统计
type ExportWorkshopAttendanceStaticsData struct {
SourceData []allied_creation_manufacture.SearchWorkshopWorkTimeStaticsItem
SelectedField []string
... ... @@ -557,7 +558,7 @@ func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string {
return nil
}
//ExportWorkshopProductiveData 导出员工产能数据
// ExportWorkshopProductiveData 导出员工产能数据
type ExportSecondLevelData struct {
SourceData []allied_creation_manufacture.SecondLevelRecordItem
SelectedField []string
... ... @@ -636,3 +637,63 @@ func (data ExportSecondLevelData) DataListLen() int {
func (data ExportSecondLevelData) TableTitle() []string {
return nil
}
// ExportRewardSummaryData 导出奖惩明细数据
type ExportRewardSummaryData struct {
SourceData []allied_creation_manufacture.RewardSummaryItem
}
var _ excel.ExcelMaker = (*ExportRewardSummaryData)(nil)
func (data ExportRewardSummaryData) CellValue(index int, enName string) (value interface{}) {
switch enName {
case "workshopName":
return data.SourceData[index].WorkshopName
case "recordDate":
return data.SourceData[index].RecordDate
case "sectionName":
return data.SourceData[index].SectionName
case "workerName":
return data.SourceData[index].WorkerName
case "upToStandard":
return data.SourceData[index].UpToStandard
case "yield":
return data.SourceData[index].Yield
case "accident1":
return data.SourceData[index].Accident1
case "accident2":
return data.SourceData[index].Accident2
case "accident3":
return data.SourceData[index].Accident3
case "summaryResult":
return data.SourceData[index].SummaryResult
case "resultDesc":
return data.SourceData[index].ResultDesc
}
return ""
}
func (data ExportRewardSummaryData) DataFieldList() []excel.DataField {
fields := []excel.DataField{
{EnName: "recordDate", CnName: "日期"},
{EnName: "workshopName", CnName: "车间"},
{EnName: "sectionName", CnName: "工段"},
{EnName: "workerName", CnName: "姓名"},
{EnName: "yield", CnName: "产效"},
{EnName: "upToStandard", CnName: "合格率"},
{EnName: "accident1", CnName: "质量事故"},
{EnName: "accident2", CnName: "安全事故"},
{EnName: "accident3", CnName: "异物"},
{EnName: "summaryResult", CnName: "奖惩结果(元)"},
{EnName: "resultDesc", CnName: "产效结果"},
}
return fields
}
func (data ExportRewardSummaryData) DataListLen() int {
return len(data.SourceData)
}
func (data ExportRewardSummaryData) TableTitle() []string {
return nil
}
... ...
... ... @@ -9,7 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
//HttpLibAlliedCreationManufacture 生产制造模块
// HttpLibAlliedCreationManufacture 生产制造模块
type HttpLibAlliedCreationManufacture struct {
service_gateway.BaseServiceGateway
baseUrL string
... ... @@ -35,7 +35,7 @@ func (gateway HttpLibAlliedCreationManufacture) BaseUrl() string {
return gateway.baseUrL
}
//BatchAddProduct 批量添加产品
// BatchAddProduct 批量添加产品
func (gateway HttpLibAlliedCreationManufacture) BatchAddProduct(param BatchAddProductRequest) (*BatchAddProductResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/batch-add")
method := "post"
... ... @@ -49,7 +49,7 @@ type BatchAddProductRequest struct {
}
type BatchAddProductResponse []interface{}
//SearchProduct 搜索产品
// SearchProduct 搜索产品
func (gateway HttpLibAlliedCreationManufacture) SearchProduct(param SearchProductRequest) (*SearchProductResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/search")
method := "post"
... ... @@ -87,7 +87,7 @@ type (
/*设备*/
//BatchAddProduct 批量添加产品
// BatchAddProduct 批量添加产品
func (gateway HttpLibAlliedCreationManufacture) BatchAddDevice(param BatchAddDeviceRequest) (*BatchAddProductResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/devices/batch-add")
method := "post"
... ... @@ -167,7 +167,7 @@ type (
}
)
//SearchProduct 搜索员工产能统计
// SearchProduct 搜索员工产能统计
func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search")
method := "post"
... ... @@ -226,7 +226,7 @@ type (
}
)
//SearchProduct 搜索员工产能统计
// SearchProduct 搜索员工产能统计
func (gateway HttpLibAlliedCreationManufacture) SearchSecondLevelRecord(param SearchSecondLevelRecordRequest) (*SearchSecondLevelRecordResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/second-level-record/search")
method := "post"
... ... @@ -356,7 +356,7 @@ type (
}
)
//SearchEmployeeAttendanceStatics 搜索员工工时统计
// SearchEmployeeAttendanceStatics 搜索员工工时统计
func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search")
method := "post"
... ... @@ -399,3 +399,52 @@ type (
AuthFlag bool `json:"authFlag"`
}
)
// 搜索功过奖惩明细
type (
SearchRewardSummaryRequest struct {
// 页码
PageNumber int `json:"pageNumber"`
// 页数
PageSize int `json:"pageSize"`
// 车间名称
WorkshopName string `json:"workshopName"`
//产线名称
LineName string `json:"workerName"`
//开始日期
BeginDate string `json:"beginDate"`
//结束日期
EndDate string `json:"endDate"`
}
SearchRewardSummaryResponse struct {
Grid struct {
List []RewardSummaryItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
RewardSummaryItem struct {
Id int `json:"id"`
RecordDate string `json:"recordDate"` //日期
WorkshopName string `json:"workshopName"` //车间名称
LineName string `json:"lineName"` //线别名称
SectionName string `json:"sectionName"` //工段
WorkerName string `json:"workerName"` //员工名字
Yield string `json:"yield"` //产效
UpToStandard string `json:"upToStandard"` //合格率
Accident1 string `json:"accident1"` //质量事故
Accident2 string `json:"accident2"` //安全事故
Accident3 string `json:"accident3"` //异物事故
SummaryResult string `json:"summaryResult"` //奖惩结果
ResultDesc string `json:"resultDesc"` //产效结果
}
)
// SearchRewardSummary 搜索功过奖惩明细
func (gateway HttpLibAlliedCreationManufacture) SearchRewardSummary(param SearchRewardSummaryRequest) (*SearchRewardSummaryResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product_trouble/reward_summary/seach")
method := "post"
var data SearchRewardSummaryResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
... ...
... ... @@ -353,6 +353,12 @@ func fileExport(controller *ExcelDataController, code string) {
query.Operator = exportDataCommand.Operator
data, err = excelService.ExportDailyFillingAbnormalLog(query)
filename = "异常记录"
case "ExportRewardSummary":
query := &query.ManufactureExportRewardSummaryQuery{}
controllers.Must(exportDataCommand.UnmarshalQuery(query))
query.Operator = exportDataCommand.Operator
data, err = excelService.ExportRewardSummary(query)
filename = "导出功过奖惩明细"
default:
err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
}
... ...