作者 yangfu

feat: 车间、员工产能导出

  1 +package query
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type ManufactureEmployeeProductiveQuery struct {
  6 + // 页码
  7 + PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
  8 + // 页数
  9 + PageSize int `cname:"页数" json:"pageSize,omitempty"`
  10 + // 车间名称
  11 + WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
  12 + // 生产线名称
  13 + LineName string `cname:"生产线名称" json:"lineName,omitempty"`
  14 + // 工段名称
  15 + SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
  16 + // 姓名
  17 + UserName string `cname:"姓名" json:"userName"`
  18 + // 员工类型 1:固定 2:派遣 3.临时
  19 + EmployeeType string `cname:"员工类型 1:固定 2:派遣 3.临时" json:"employeeType"`
  20 + // 开始时间
  21 + BeginTime string `cname:"开始时间" json:"beginTime"`
  22 + // 结束时间
  23 + EndTime string `cname:"结束时间" json:"endTime"`
  24 + //操作人
  25 + Operator domain.Operator `json:"-"`
  26 + SelectedField []string `json:"selectedField"`
  27 +}
  1 +package query
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type ManufactureWorkshopProductiveQuery struct {
  6 + // 工段名称
  7 + SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
  8 + // 品名
  9 + PlanProductName string `cname:"品名" json:"planProductName,omitempty"`
  10 + // 开始时间
  11 + BeginTime string `cname:"开始时间" json:"beginTime"`
  12 + // 结束时间
  13 + EndTime string `cname:"结束时间" json:"endTime"`
  14 + //操作人
  15 + Operator domain.Operator `json:"-"`
  16 + SelectedField []string `json:"selectedField"`
  17 +}
@@ -65,3 +65,34 @@ func (srv ExcelDataService) ExportProducts(cmd *query.SearchProductQuery) (Expor @@ -65,3 +65,34 @@ func (srv ExcelDataService) ExportProducts(cmd *query.SearchProductQuery) (Expor
65 } 65 }
66 return ExportProductsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil 66 return ExportProductsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
67 } 67 }
  68 +
  69 +func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmployeeProductiveQuery) (ExportEmployeeProductiveData, error) {
  70 + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
  71 + result, err := creationUserGateway.SearchEmployeeProductive(allied_creation_manufacture.SearchEmployeeProductiveRequest{
  72 + WorkshopName: cmd.WorkshopName,
  73 + LineName: cmd.LineName,
  74 + SectionName: cmd.SectionName,
  75 + UserName: cmd.UserName,
  76 + EmployeeType: cmd.EmployeeType,
  77 + BeginTime: cmd.BeginTime,
  78 + EndTime: cmd.EndTime,
  79 + })
  80 + if err != nil {
  81 + return ExportEmployeeProductiveData{}, fmt.Errorf("获取员工产能数据失败:%w", err)
  82 + }
  83 + return ExportEmployeeProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
  84 +}
  85 +
  86 +func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorkshopProductiveQuery) (ExportWorkshopProductiveData, error) {
  87 + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
  88 + result, err := creationUserGateway.SearchWorkshopProductive(allied_creation_manufacture.SearchWorkshopProductiveRequest{
  89 + SectionName: cmd.SectionName,
  90 + PlanProductName: cmd.PlanProductName,
  91 + BeginTime: cmd.BeginTime,
  92 + EndTime: cmd.EndTime,
  93 + })
  94 + if err != nil {
  95 + return ExportWorkshopProductiveData{}, fmt.Errorf("获取员工产能数据失败:%w", err)
  96 + }
  97 + return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
  98 +}
@@ -284,7 +284,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -284,7 +284,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
284 domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx", 284 domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx",
285 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx", 285 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
286 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx", 286 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx",
287 - domain.ImportDevices: "", 287 + domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
288 } 288 }
289 var url string 289 var url string
290 var ok bool 290 var ok bool
@@ -3,6 +3,7 @@ package service @@ -3,6 +3,7 @@ package service
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "github.com/linmadan/egglib-go/utils/excel" 5 "github.com/linmadan/egglib-go/utils/excel"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
8 ) 9 )
@@ -239,3 +240,171 @@ func (data ExportProductsData) DataListLen() int { @@ -239,3 +240,171 @@ func (data ExportProductsData) DataListLen() int {
239 func (data ExportProductsData) TableTitle() []string { 240 func (data ExportProductsData) TableTitle() []string {
240 return nil 241 return nil
241 } 242 }
  243 +
  244 +//ExportEmployeeProductiveData 导出员工产能数据
  245 +type ExportEmployeeProductiveData struct {
  246 + SourceData []allied_creation_manufacture.EmployeeProductiveItem
  247 + SelectedField []string
  248 +}
  249 +
  250 +var _ excel.ExcelMaker = (*ExportEmployeeProductiveData)(nil)
  251 +
  252 +func (data ExportEmployeeProductiveData) AllFields() []DataFieldOptions {
  253 + return []DataFieldOptions{
  254 + {EnName: "createdAt", CnName: "日期"},
  255 + {EnName: "workshopName", CnName: "车间名称"},
  256 + {EnName: "lineName", CnName: "线别"},
  257 + {EnName: "sectionName", CnName: "工段"},
  258 + {EnName: "workOn", CnName: "班别"},
  259 + {EnName: "userName", CnName: "姓名"},
  260 + {EnName: "employeeType", CnName: "员工类型"},
  261 + {EnName: "participateType", CnName: "类别"},
  262 + {EnName: "planProductName", CnName: "品名"},
  263 + {EnName: "productWeigh", CnName: "产能"},
  264 + {EnName: "secondLevelWeigh", CnName: "二级品"},
  265 + {EnName: "qualificationRate", CnName: "合格率"},
  266 + {EnName: "orgName", CnName: "组织机构"},
  267 + }
  268 +}
  269 +
  270 +func (data ExportEmployeeProductiveData) DataFieldList() []excel.DataField {
  271 + fields := []excel.DataField{}
  272 + allFields := data.AllFields()
  273 + for _, value2 := range allFields {
  274 + if len(data.SelectedField) == 0 || value2.IsDefault {
  275 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  276 + continue
  277 + }
  278 + for _, value3 := range data.SelectedField {
  279 + if value2.EnName == value3 {
  280 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  281 + }
  282 + }
  283 + }
  284 + return fields
  285 +}
  286 +
  287 +func (data ExportEmployeeProductiveData) CellValue(index int, enName string) (value interface{}) {
  288 + if index > data.DataListLen() {
  289 + return ""
  290 + }
  291 + switch enName {
  292 + case "createdAt":
  293 + return data.SourceData[index].CreatedAt
  294 + case "workshopName":
  295 + return data.SourceData[index].WorkshopName
  296 + case "lineName":
  297 + return data.SourceData[index].LineName
  298 + case "sectionName":
  299 + return data.SourceData[index].SectionName
  300 + case "workOn":
  301 + return data.SourceData[index].WorkOn
  302 + case "userName":
  303 + return data.SourceData[index].ProductWorker.UserName
  304 + case "employeeType":
  305 + return domain.EmployeeTypeDescription(data.SourceData[index].ProductWorker.EmployeeType)
  306 + case "participateType":
  307 + return domain.ParticipateTypeDescription(data.SourceData[index].ParticipateType)
  308 + case "planProductName":
  309 + return data.SourceData[index].PlanProductName
  310 + case "productWeigh":
  311 + return fmt.Sprintf("%vKg", data.SourceData[index].ProductWeigh)
  312 + case "secondLevelWeigh":
  313 + return fmt.Sprintf("%vKg", data.SourceData[index].SecondLevelWeigh)
  314 + case "qualificationRate":
  315 + return fmt.Sprintf("%v%%", data.SourceData[index].QualificationRate)
  316 + case "orgName":
  317 + return data.SourceData[index].OrgName
  318 + }
  319 + return nil
  320 +}
  321 +
  322 +func (data ExportEmployeeProductiveData) DataListLen() int {
  323 + return len(data.SourceData)
  324 +}
  325 +
  326 +func (data ExportEmployeeProductiveData) TableTitle() []string {
  327 + return nil
  328 +}
  329 +
  330 +//ExportWorkshopProductiveData 导出员工产能数据
  331 +type ExportWorkshopProductiveData struct {
  332 + SourceData []allied_creation_manufacture.WorkshopProductiveItem
  333 + SelectedField []string
  334 +}
  335 +
  336 +var _ excel.ExcelMaker = (*ExportWorkshopProductiveData)(nil)
  337 +
  338 +func (data ExportWorkshopProductiveData) AllFields() []DataFieldOptions {
  339 + return []DataFieldOptions{
  340 + {EnName: "createdAt", CnName: "日期"},
  341 + {EnName: "batchNumber", CnName: "批次号"},
  342 + {EnName: "workshopName", CnName: "车间名称"},
  343 + {EnName: "lineName", CnName: "线别"},
  344 + {EnName: "sectionName", CnName: "工段"},
  345 + {EnName: "planProductName", CnName: "品名"},
  346 + {EnName: "devotedProductWeigh", CnName: "投入量"},
  347 + {EnName: "productWeigh", CnName: "产出量"},
  348 + {EnName: "secondLevelWeigh", CnName: "二级品"},
  349 + {EnName: "qualificationRate", CnName: "出品率"},
  350 + {EnName: "orgName", CnName: "组织机构"},
  351 + }
  352 +}
  353 +
  354 +func (data ExportWorkshopProductiveData) DataFieldList() []excel.DataField {
  355 + fields := []excel.DataField{}
  356 + allFields := data.AllFields()
  357 + for _, value2 := range allFields {
  358 + if len(data.SelectedField) == 0 || value2.IsDefault {
  359 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  360 + continue
  361 + }
  362 + for _, value3 := range data.SelectedField {
  363 + if value2.EnName == value3 {
  364 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  365 + }
  366 + }
  367 + }
  368 + return fields
  369 +}
  370 +
  371 +func (data ExportWorkshopProductiveData) CellValue(index int, enName string) (value interface{}) {
  372 + if index > data.DataListLen() {
  373 + return ""
  374 + }
  375 + switch enName {
  376 + case "createdAt":
  377 + return data.SourceData[index].CreatedAt
  378 + case "batchNumber":
  379 + return data.SourceData[index].BatchNumber
  380 + case "workshopName":
  381 + return data.SourceData[index].WorkshopName
  382 + case "lineName":
  383 + return data.SourceData[index].LineName
  384 + case "sectionName":
  385 + return data.SourceData[index].SectionName
  386 + case "userName":
  387 + return data.SourceData[index].ProductWorker.UserName
  388 + case "planProductName":
  389 + return data.SourceData[index].PlanProductName
  390 + case "devotedProductWeigh":
  391 + return fmt.Sprintf("%vKg", data.SourceData[index].DevotedProductWeigh)
  392 + case "productWeigh":
  393 + return fmt.Sprintf("%vKg", data.SourceData[index].ProductWeigh)
  394 + case "secondLevelWeigh":
  395 + return fmt.Sprintf("%vKg", data.SourceData[index].SecondLevelWeigh)
  396 + case "qualificationRate":
  397 + return fmt.Sprintf("%v%%", data.SourceData[index].QualificationRate)
  398 + case "orgName":
  399 + return data.SourceData[index].OrgName
  400 + }
  401 + return nil
  402 +}
  403 +
  404 +func (data ExportWorkshopProductiveData) DataListLen() int {
  405 + return len(data.SourceData)
  406 +}
  407 +
  408 +func (data ExportWorkshopProductiveData) TableTitle() []string {
  409 + return nil
  410 +}
  1 +package constant
  2 +
  3 +import (
  4 + "os"
  5 + "strconv"
  6 +)
  7 +
  8 +var (
  9 + // 生产制造 - 称重系统 - 默认公司
  10 + MANUFACTURE_WEIGH_DEFAULT_COMPANYID = 1
  11 + // 生产制造 - 称重系统 - 默认组织
  12 + MANUFACTURE_WEIGH_DEFAULT_ORGID = 1
  13 +)
  14 +
  15 +func init() {
  16 + if os.Getenv("MANUFACTURE_WEIGH_DEFAULT_COMPANY_ID") != "" {
  17 + MANUFACTURE_WEIGH_DEFAULT_COMPANYID, _ = strconv.Atoi(os.Getenv("MANUFACTURE_WEIGH_DEFAULT_COMPANYID"))
  18 + }
  19 + if os.Getenv("MANUFACTURE_WEIGH_DEFAULT_ORGID") != "" {
  20 + MANUFACTURE_WEIGH_DEFAULT_ORGID, _ = strconv.Atoi(os.Getenv("MANUFACTURE_WEIGH_DEFAULT_ORGID"))
  21 + }
  22 +}
@@ -65,9 +65,9 @@ const ( @@ -65,9 +65,9 @@ const (
65 ImportDividendsReturnOrders = "BUSINESS_ALLIED-CREATION_BONUS_RETURN" 65 ImportDividendsReturnOrders = "BUSINESS_ALLIED-CREATION_BONUS_RETURN"
66 66
67 // 导入产品 67 // 导入产品
68 - ImportProducts = "ImportProducts" 68 + ImportProducts = "BUSINESS_ALLIED-MANUFACTURING_BASIC_PRODUCT"
69 // 导入设备 69 // 导入设备
70 - ImportDevices = "ImportDevices" 70 + ImportDevices = "BUSINESS_ALLIED-MANUFACTURING_BASIC_DEVICE"
71 ) 71 )
72 72
73 const ( 73 const (
@@ -78,6 +78,10 @@ const ( @@ -78,6 +78,10 @@ const (
78 78
79 // 导入产品 79 // 导入产品
80 ExportProducts = "ExportProducts" 80 ExportProducts = "ExportProducts"
  81 + // 导出员工产能统计
  82 + ExportManufactureEmployeeProductive = "ExportManufactureEmployeeProductive"
  83 + // 导出车间产能统计
  84 + ExportManufactureWorkshopProductive = "ExportManufactureWorkshopProductive"
81 ) 85 )
82 86
83 const ( 87 const (
@@ -93,3 +97,26 @@ const ( @@ -93,3 +97,26 @@ const (
93 const ( 97 const (
94 DefaultPassword = "4a693460c4cf078ea5b6b5a9e2cf382064a6f810" // TL123456! 98 DefaultPassword = "4a693460c4cf078ea5b6b5a9e2cf382064a6f810" // TL123456!
95 ) 99 )
  100 +
  101 +func EmployeeTypeDescription(employeeType int) string {
  102 + if employeeType == 1 {
  103 + return "固定"
  104 + }
  105 + if employeeType == 2 {
  106 + return "派遣"
  107 + }
  108 + if employeeType == 3 {
  109 + return "临时"
  110 + }
  111 + return "固定"
  112 +}
  113 +
  114 +func ParticipateTypeDescription(participateType int) string {
  115 + if participateType == 1 {
  116 + return "正常"
  117 + }
  118 + if participateType == 2 {
  119 + return "支援"
  120 + }
  121 + return "正常"
  122 +}
@@ -48,7 +48,7 @@ type BatchAddProductRequest struct { @@ -48,7 +48,7 @@ type BatchAddProductRequest struct {
48 } 48 }
49 type BatchAddProductResponse []interface{} 49 type BatchAddProductResponse []interface{}
50 50
51 -//BatchAddProduct 批量添加产品 51 +//SearchProduct 搜索产品
52 func (gateway HttpLibAlliedCreationManufacture) SearchProduct(param SearchProductRequest) (*SearchProductResponse, error) { 52 func (gateway HttpLibAlliedCreationManufacture) SearchProduct(param SearchProductRequest) (*SearchProductResponse, error) {
53 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/search") 53 url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/products/search")
54 method := "post" 54 method := "post"
@@ -99,3 +99,128 @@ type BatchAddDeviceRequest struct { @@ -99,3 +99,128 @@ type BatchAddDeviceRequest struct {
99 List []*domain.ImportDeviceItem `json:"list"` 99 List []*domain.ImportDeviceItem `json:"list"`
100 } 100 }
101 type BatchAddDeviceResponse []interface{} 101 type BatchAddDeviceResponse []interface{}
  102 +
  103 +/**生产记录**/
  104 +//SearchProduct 搜索员工产能统计
  105 +func (gateway HttpLibAlliedCreationManufacture) SearchEmployeeProductive(param SearchEmployeeProductiveRequest) (*SearchEmployeeProductiveResponse, error) {
  106 + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/employee-productive/search")
  107 + method := "post"
  108 + var data SearchEmployeeProductiveResponse
  109 + err := gateway.FastDoRequest(url, method, param, &data)
  110 + return &data, err
  111 +}
  112 +
  113 +type (
  114 + SearchEmployeeProductiveRequest struct {
  115 + // 页码
  116 + //PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
  117 + // 页数
  118 + //PageSize int `cname:"页数" json:"pageSize,omitempty"`
  119 + // 车间名称
  120 + WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
  121 + // 生产线名称
  122 + LineName string `cname:"生产线名称" json:"lineName,omitempty"`
  123 + // 工段名称
  124 + SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
  125 + // 姓名
  126 + UserName string `cname:"姓名" json:"userName"`
  127 + // 员工类型 1:固定 2:派遣 3.临时
  128 + EmployeeType string `cname:"员工类型 1:固定 2:派遣 3.临时" json:"employeeType"`
  129 + // 开始时间
  130 + BeginTime string `cname:"开始时间" json:"beginTime"`
  131 + // 结束时间
  132 + EndTime string `cname:"结束时间" json:"endTime"`
  133 + }
  134 + SearchEmployeeProductiveResponse struct {
  135 + Grid struct {
  136 + List []EmployeeProductiveItem `json:"list"`
  137 + Total int `json:"total"`
  138 + } `json:"grid"`
  139 + }
  140 + EmployeeProductiveItem struct {
  141 + EmployeeProductRecordID int `json:"employeeProductRecordId"`
  142 + ProductWorker struct {
  143 + UserID int `json:"userId"`
  144 + UserName string `json:"userName"`
  145 + Avatar string `json:"avatar"`
  146 + Phone string `json:"phone"`
  147 + EmployeeType int `json:"employeeType"`
  148 + } `json:"productWorker"`
  149 + WorkStationID string `json:"workStationId"`
  150 + WorkshopID int `json:"workshopId"`
  151 + WorkshopName string `json:"workshopName"`
  152 + LineID int `json:"lineId"`
  153 + LineName string `json:"lineName"`
  154 + SectionID int `json:"sectionId"`
  155 + SectionName string `json:"sectionName"`
  156 + WorkOn string `json:"workOn"`
  157 + PlanProductName string `json:"planProductName"`
  158 + BatchNumber string `json:"batchNumber"`
  159 + ParticipateType int `json:"participateType"`
  160 + ProductWeigh float64 `json:"productWeigh"`
  161 + SecondLevelWeigh float64 `json:"secondLevelWeigh"`
  162 + CreatedAt string `json:"createdAt"`
  163 + OrgName string `json:"orgName"`
  164 + AuthFlag bool `json:"authFlag"`
  165 + QualificationRate int `json:"qualificationRate"`
  166 + }
  167 +)
  168 +
  169 +//SearchProduct 搜索员工产能统计
  170 +func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) {
  171 + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search")
  172 + method := "post"
  173 + var data SearchWorkshopProductiveResponse
  174 + err := gateway.FastDoRequest(url, method, param, &data)
  175 + return &data, err
  176 +}
  177 +
  178 +type (
  179 + SearchWorkshopProductiveRequest struct {
  180 + // 品名
  181 + PlanProductName string `cname:"品名" json:"planProductName,omitempty"`
  182 + // 工段名称
  183 + SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
  184 + // 开始时间
  185 + BeginTime string `cname:"开始时间" json:"beginTime"`
  186 + // 结束时间
  187 + EndTime string `cname:"结束时间" json:"endTime"`
  188 + }
  189 + SearchWorkshopProductiveResponse struct {
  190 + Grid struct {
  191 + List []WorkshopProductiveItem `json:"list"`
  192 + Total int `json:"total"`
  193 + } `json:"grid"`
  194 + }
  195 + WorkshopProductiveItem struct {
  196 + EmployeeProductRecordID int `json:"employeeProductRecordId"`
  197 + ProductWorker struct {
  198 + UserID int `json:"userId"`
  199 + UserName string `json:"userName"`
  200 + Avatar string `json:"avatar"`
  201 + Phone string `json:"phone"`
  202 + EmployeeType int `json:"employeeType"`
  203 + } `json:"productWorker"`
  204 + WorkStationID string `json:"workStationId"`
  205 + WorkshopID int `json:"workshopId"`
  206 + WorkshopName string `json:"workshopName"`
  207 + LineID int `json:"lineId"`
  208 + LineName string `json:"lineName"`
  209 + SectionID int `json:"sectionId"`
  210 + SectionName string `json:"sectionName"`
  211 + WorkOn string `json:"workOn"`
  212 + PlanProductName string `json:"planProductName"`
  213 + BatchNumber string `json:"batchNumber"`
  214 + //ParticipateType int `json:"participateType"`
  215 + // 投入量
  216 + DevotedProductWeigh float64 `json:"devotedProductWeigh"`
  217 + // 产能
  218 + ProductWeigh float64 `json:"productWeigh"`
  219 + // 二级品产能
  220 + SecondLevelWeigh float64 `json:"secondLevelWeigh"`
  221 + CreatedAt string `json:"createdAt"`
  222 + OrgName string `json:"orgName"`
  223 + AuthFlag bool `json:"authFlag"`
  224 + QualificationRate int `json:"qualificationRate"`
  225 + }
  226 +)
@@ -271,6 +271,18 @@ func fileExport(controller *ExcelDataController, code string) { @@ -271,6 +271,18 @@ func fileExport(controller *ExcelDataController, code string) {
271 companyUserListQuery.Operator = exportDataCommand.Operator 271 companyUserListQuery.Operator = exportDataCommand.Operator
272 data, err = excelService.ExportProducts(companyUserListQuery) 272 data, err = excelService.ExportProducts(companyUserListQuery)
273 filename = "导出商品" 273 filename = "导出商品"
  274 + case domain.ExportManufactureEmployeeProductive:
  275 + companyUserListQuery := &query.ManufactureEmployeeProductiveQuery{}
  276 + exportDataCommand.UnmarshalQuery(companyUserListQuery)
  277 + companyUserListQuery.Operator = exportDataCommand.Operator
  278 + data, err = excelService.ExportEmployeeProductive(companyUserListQuery)
  279 + filename = "导出员工产能统计"
  280 + case domain.ExportManufactureWorkshopProductive:
  281 + companyUserListQuery := &query.ManufactureWorkshopProductiveQuery{}
  282 + exportDataCommand.UnmarshalQuery(companyUserListQuery)
  283 + companyUserListQuery.Operator = exportDataCommand.Operator
  284 + data, err = excelService.ExportWorkshopProductive(companyUserListQuery)
  285 + filename = "导出车间产能汇总"
274 default: 286 default:
275 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code) 287 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
276 } 288 }
@@ -301,6 +313,21 @@ func (controller *ExcelDataController) ExportCooperationUser() { @@ -301,6 +313,21 @@ func (controller *ExcelDataController) ExportCooperationUser() {
301 fileExport(controller, domain.ExportCooperationUser) 313 fileExport(controller, domain.ExportCooperationUser)
302 } 314 }
303 315
  316 +// ExportProducts 导出生产制造产品
  317 +func (controller *ExcelDataController) ExportProducts() {
  318 + fileExport(controller, domain.ExportProducts)
  319 +}
  320 +
  321 +// ExportManufactureEmployeeProductive 导出生产制造-员工产能统计
  322 +func (controller *ExcelDataController) ExportManufactureEmployeeProductive() {
  323 + fileExport(controller, domain.ExportManufactureEmployeeProductive)
  324 +}
  325 +
  326 +// ExportManufactureEmployeeProductive 导出生产制造-车间产能统计
  327 +func (controller *ExcelDataController) ExportManufactureWorkshopProductive() {
  328 + fileExport(controller, domain.ExportManufactureWorkshopProductive)
  329 +}
  330 +
304 //GetExcelDataFields 获取导出excel数据的可选字段 331 //GetExcelDataFields 获取导出excel数据的可选字段
305 func (controller *ExcelDataController) GetExcelDataFields() { 332 func (controller *ExcelDataController) GetExcelDataFields() {
306 333
  1 +package web_client
  2 +
  3 +// 称重系统
  1 +package middleware
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  6 + "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 +)
  9 +
  10 +func RedirectManufactureWeigh() web.FilterFunc {
  11 + return RedirectInternalService("/v1/manufacture-weigh", allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(domain.Operator{
  12 + CompanyId: int64(constant.MANUFACTURE_WEIGH_DEFAULT_COMPANYID),
  13 + OrgId: int64(constant.MANUFACTURE_WEIGH_DEFAULT_ORGID),
  14 + }))
  15 +}
@@ -8,6 +8,9 @@ import ( @@ -8,6 +8,9 @@ import (
8 func init() { 8 func init() {
9 web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser") 9 web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser")
10 web.Router("/v1/web/excel/export/cooperation-user", &web_client.ExcelDataController{}, "Post:ExportCooperationUser") 10 web.Router("/v1/web/excel/export/cooperation-user", &web_client.ExcelDataController{}, "Post:ExportCooperationUser")
  11 + web.Router("/v1/web/excel/export/manufacture-products", &web_client.ExcelDataController{}, "Post:ExportProducts")
  12 + web.Router("/v1/web/excel/export/manufacture-employee-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureEmployeeProductive")
  13 + web.Router("/v1/web/excel/export/manufacture-workshop-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureWorkshopProductive")
11 14
12 web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder") 15 web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder")
13 web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder") 16 web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder")
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/middleware"
  6 +)
  7 +
  8 +func init() {
  9 + // 车间列表
  10 + web.Post("/v1/manufacture-weigh/workshops/selector", middleware.RedirectManufactureWeigh())
  11 + // 车间员工
  12 + web.Post("/v1/manufacture-weigh/product-groups/employees", middleware.RedirectManufactureWeigh())
  13 + // 生产批次列表
  14 + web.Post("/v1/manufacture-weigh/product-plans/search", middleware.RedirectManufactureWeigh())
  15 + // 物料列表
  16 + web.Post("/v1/manufacture-weigh/unit-conversions/materials", middleware.RedirectManufactureWeigh())
  17 + // 领料
  18 + web.Post("/v1/manufacture-weigh/product-plans/receive-material", middleware.RedirectManufactureWeigh())
  19 + // 退料
  20 + web.Post("/v1/manufacture-weigh/product-plans/return-material", middleware.RedirectManufactureWeigh())
  21 + // 提交二级品
  22 + web.Post("/v1/manufacture-weigh/product-plans/submit-product-record", middleware.RedirectManufactureWeigh())
  23 +}