作者 Your Name

Merge branch 'dev' into test

@@ -12,7 +12,7 @@ type ListRewardSummaryQuery struct { @@ -12,7 +12,7 @@ type ListRewardSummaryQuery struct {
12 // 车间名称 12 // 车间名称
13 WorkshopName string `cname:"车间名称" json:"workshopName"` 13 WorkshopName string `cname:"车间名称" json:"workshopName"`
14 14
15 - LineName string `cname:"线别名称" json:"workerName"` 15 + LineName string `cname:"线别名称" json:"lineName"`
16 16
17 BeginDate string `cname:"开始的日期" json:"beginDate"` 17 BeginDate string `cname:"开始的日期" json:"beginDate"`
18 18
@@ -495,17 +495,21 @@ func (srv ProductTroubleService) ListRewardSummary(param *query.ListRewardSummar @@ -495,17 +495,21 @@ func (srv ProductTroubleService) ListRewardSummary(param *query.ListRewardSummar
495 _, err = time.Parse("2006-01-02", param.BeginDate) 495 _, err = time.Parse("2006-01-02", param.BeginDate)
496 if err != nil { 496 if err != nil {
497 return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误") 497 return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
498 - } 498 + } else {
499 condition["beginDate"] = param.BeginDate 499 condition["beginDate"] = param.BeginDate
500 } 500 }
  501 +
  502 + }
501 //搜索条件日期 503 //搜索条件日期
502 if len(param.EndDate) > 0 { 504 if len(param.EndDate) > 0 {
503 _, err = time.Parse("2006-01-02", param.EndDate) 505 _, err = time.Parse("2006-01-02", param.EndDate)
504 if err != nil { 506 if err != nil {
505 return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误") 507 return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
506 - } 508 + } else {
507 condition["endDate"] = param.EndDate 509 condition["endDate"] = param.EndDate
508 } 510 }
  511 +
  512 + }
509 //搜索条件 车间名称 513 //搜索条件 车间名称
510 if len(param.WorkshopName) > 0 { 514 if len(param.WorkshopName) > 0 {
511 condition["workshopName"] = param.WorkshopName 515 condition["workshopName"] = param.WorkshopName
@@ -3,6 +3,7 @@ package dao @@ -3,6 +3,7 @@ package dao
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 5
  6 + "github.com/go-pg/pg/v10"
6 pgTransaction "github.com/linmadan/egglib-go/transaction/pg" 7 pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
7 ) 8 )
8 9
@@ -64,7 +65,7 @@ func (d *BoardShowDao) OnDutyCount(companyId int, orgId int, workshopId int) (in @@ -64,7 +65,7 @@ func (d *BoardShowDao) OnDutyCount(companyId int, orgId int, workshopId int) (in
64 and sign_in>to_date(to_char(now(), 'YYYY-MM-DD'),'YYYY-MM-DD')` 65 and sign_in>to_date(to_char(now(), 'YYYY-MM-DD'),'YYYY-MM-DD')`
65 var cnt int 66 var cnt int
66 tx := d.transactionContext.PgTx 67 tx := d.transactionContext.PgTx
67 - _, err := tx.QueryOne(&cnt, sqlStr, companyId, orgId, workshopId) 68 + _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, companyId, orgId, workshopId)
68 return cnt, err 69 return cnt, err
69 } 70 }
70 71
@@ -349,7 +350,7 @@ func (d *BoardShowDao) WorkshopPlanCompletionCurrent(companyId int, orgId int, w @@ -349,7 +350,7 @@ func (d *BoardShowDao) WorkshopPlanCompletionCurrent(companyId int, orgId int, w
349 } 350 }
350 var result string 351 var result string
351 tx := d.transactionContext.PgTx 352 tx := d.transactionContext.PgTx
352 - _, err := tx.QueryOne(&result, sqlStr, condition...) 353 + _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...)
353 return result, err 354 return result, err
354 } 355 }
355 356
@@ -126,6 +126,7 @@ func (repo *ProductTroubleRepository) Find(queryOptions map[string]interface{}) @@ -126,6 +126,7 @@ func (repo *ProductTroubleRepository) Find(queryOptions map[string]interface{})
126 } 126 }
127 127
128 //TODO 128 //TODO
  129 +
129 cnt, err := query.SelectAndCount() 130 cnt, err := query.SelectAndCount()
130 if err != nil { 131 if err != nil {
131 return 0, nil, err 132 return 0, nil, err
@@ -101,11 +101,11 @@ func (repo *RewardSummaryRepository) Find(queryOptions map[string]interface{}) ( @@ -101,11 +101,11 @@ func (repo *RewardSummaryRepository) Find(queryOptions map[string]interface{}) (
101 } 101 }
102 //车间名称 102 //车间名称
103 if v, ok := queryOptions["workshopName"]; ok && len(v.(string)) > 0 { 103 if v, ok := queryOptions["workshopName"]; ok && len(v.(string)) > 0 {
104 - query.Where(`Work_station->>'workshopName' like '%?%'`, v) 104 + query.Where(`Work_station->>'workshopName' like ?`, fmt.Sprintf("%%%v%%", v))
105 } 105 }
106 //线别名称 106 //线别名称
107 if v, ok := queryOptions["lineName"]; ok && len(v.(string)) > 0 { 107 if v, ok := queryOptions["lineName"]; ok && len(v.(string)) > 0 {
108 - query.Where(`Work_station->>'lineName' like '%?%'`, v) 108 + query.Where(`Work_station->>'lineName' like ?`, fmt.Sprintf("%%%v%%", v))
109 } 109 }
110 //工段id 110 //工段id
111 if v, ok := queryOptions["sectionId"]; ok && len(v.(string)) > 0 { 111 if v, ok := queryOptions["sectionId"]; ok && len(v.(string)) > 0 {
@@ -9,6 +9,7 @@ type BoardDataController struct { @@ -9,6 +9,7 @@ type BoardDataController struct {
9 beego.BaseController 9 beego.BaseController
10 } 10 }
11 11
  12 +// 车间描述
12 func (c *BoardDataController) WorkshopDesc() { 13 func (c *BoardDataController) WorkshopDesc() {
13 srv := service.NewCommonStatisticsService(nil) 14 srv := service.NewCommonStatisticsService(nil)
14 data, err := srv.WorkshopDesc() 15 data, err := srv.WorkshopDesc()
@@ -21,6 +22,7 @@ func (c *BoardDataController) EmployeeWorkpieceRatio() { @@ -21,6 +22,7 @@ func (c *BoardDataController) EmployeeWorkpieceRatio() {
21 c.Response(data, err) 22 c.Response(data, err)
22 } 23 }
23 24
  25 +// 时段产能
24 func (c *BoardDataController) TimeSectionProductRecord() { 26 func (c *BoardDataController) TimeSectionProductRecord() {
25 srv := service.NewCommonStatisticsService(nil) 27 srv := service.NewCommonStatisticsService(nil)
26 data, err := srv.TimeSectionProductRecord() 28 data, err := srv.TimeSectionProductRecord()