作者 Your Name

Merge branch 'dev' into test

... ... @@ -12,7 +12,7 @@ type ListRewardSummaryQuery struct {
// 车间名称
WorkshopName string `cname:"车间名称" json:"workshopName"`
LineName string `cname:"线别名称" json:"workerName"`
LineName string `cname:"线别名称" json:"lineName"`
BeginDate string `cname:"开始的日期" json:"beginDate"`
... ...
... ... @@ -495,16 +495,20 @@ func (srv ProductTroubleService) ListRewardSummary(param *query.ListRewardSummar
_, err = time.Parse("2006-01-02", param.BeginDate)
if err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
} else {
condition["beginDate"] = param.BeginDate
}
condition["beginDate"] = param.BeginDate
}
//搜索条件日期
if len(param.EndDate) > 0 {
_, err = time.Parse("2006-01-02", param.EndDate)
if err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
} else {
condition["endDate"] = param.EndDate
}
condition["endDate"] = param.EndDate
}
//搜索条件 车间名称
if len(param.WorkshopName) > 0 {
... ...
... ... @@ -3,6 +3,7 @@ package dao
import (
"fmt"
"github.com/go-pg/pg/v10"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
... ... @@ -64,7 +65,7 @@ func (d *BoardShowDao) OnDutyCount(companyId int, orgId int, workshopId int) (in
and sign_in>to_date(to_char(now(), 'YYYY-MM-DD'),'YYYY-MM-DD')`
var cnt int
tx := d.transactionContext.PgTx
_, err := tx.QueryOne(&cnt, sqlStr, companyId, orgId, workshopId)
_, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, companyId, orgId, workshopId)
return cnt, err
}
... ... @@ -349,7 +350,7 @@ func (d *BoardShowDao) WorkshopPlanCompletionCurrent(companyId int, orgId int, w
}
var result string
tx := d.transactionContext.PgTx
_, err := tx.QueryOne(&result, sqlStr, condition...)
_, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...)
return result, err
}
... ...
... ... @@ -126,6 +126,7 @@ func (repo *ProductTroubleRepository) Find(queryOptions map[string]interface{})
}
//TODO
cnt, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
... ...
... ... @@ -101,11 +101,11 @@ func (repo *RewardSummaryRepository) Find(queryOptions map[string]interface{}) (
}
//车间名称
if v, ok := queryOptions["workshopName"]; ok && len(v.(string)) > 0 {
query.Where(`Work_station->>'workshopName' like '%?%'`, v)
query.Where(`Work_station->>'workshopName' like ?`, fmt.Sprintf("%%%v%%", v))
}
//线别名称
if v, ok := queryOptions["lineName"]; ok && len(v.(string)) > 0 {
query.Where(`Work_station->>'lineName' like '%?%'`, v)
query.Where(`Work_station->>'lineName' like ?`, fmt.Sprintf("%%%v%%", v))
}
//工段id
if v, ok := queryOptions["sectionId"]; ok && len(v.(string)) > 0 {
... ...
... ... @@ -9,6 +9,7 @@ type BoardDataController struct {
beego.BaseController
}
// 车间描述
func (c *BoardDataController) WorkshopDesc() {
srv := service.NewCommonStatisticsService(nil)
data, err := srv.WorkshopDesc()
... ... @@ -21,6 +22,7 @@ func (c *BoardDataController) EmployeeWorkpieceRatio() {
c.Response(data, err)
}
// 时段产能
func (c *BoardDataController) TimeSectionProductRecord() {
srv := service.NewCommonStatisticsService(nil)
data, err := srv.TimeSectionProductRecord()
... ...