Browse Source

Merge pull request 'feature_CustomizedQuery' (#154) from feature_CustomizedQuery into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_Acura_MES_Backend/pulls/154
pull/155/head
zhangxin 3 years ago
parent
commit
fe06588ec0
7 changed files with 279 additions and 4 deletions
  1. +8
    -0
      grmi/Date.go
  2. +8
    -0
      grmi/DateTime.go
  3. +8
    -0
      grmi/Time.go
  4. +69
    -0
      services/report/CustomizedQuery.service.go
  5. +63
    -3
      services/report/implments/CustomizedQuery.service.impl.go
  6. +121
    -0
      web/controllers/report/CustomizedQuery.rest.go
  7. +2
    -1
      web/routes/routes.go

+ 8
- 0
grmi/Date.go View File

@ -39,3 +39,11 @@ func (self *Date) ToString() string {
date := self.Restore()
return date.Format(DateOutFormat)
}
func (self *Date) String() string {
if self == nil {
return ""
}
date := self.Restore()
return date.Format(DateTimeOutFormat)
}

+ 8
- 0
grmi/DateTime.go View File

@ -39,3 +39,11 @@ func (self *DateTime) ToString() string {
date := self.Restore()
return date.Format(DateTimeOutFormat)
}
func (self *DateTime) String() string {
if self == nil {
return ""
}
date := self.Restore()
return date.Format(DateTimeOutFormat)
}

+ 8
- 0
grmi/Time.go View File

@ -35,3 +35,11 @@ func (self *Time) ToString() string {
date := self.Restore()
return date.Format(TimeOutFormat)
}
func (self *Time) String() string {
if self == nil {
return ""
}
date := self.Restore()
return date.Format(DateTimeOutFormat)
}

+ 69
- 0
services/report/CustomizedQuery.service.go View File

@ -45,6 +45,31 @@ type CustomizedQueryService interface {
*
******************************************************************************/
ProductFamilyInventoryQuery(*global.User, string, string, string) ([]impl.ProductFamilyInventoryQuery_ProductFamilyStatistics, error)
/******************************************************************************
*
* @Function Name : ProductFamilyInventoryExportExcel
*-----------------------------------------------------------------------------
*
* @Description : 导出派生库存查询结果
*
* @Function Parameters : 当前访问人员信息
*
* @Function Parameters : 派生号
*
* @Function Parameters : 项目
*
* @Function Parameters : 座椅条码
*
* @Return Value : 导出文件路径
*
* @Return Value : 执行时发生的错误
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-08 17:56
*
******************************************************************************/
ProductFamilyInventoryExportExcel(*global.User, string, string, string) (string, error)
/******************************************************************************
*
* @Function Name : SeatQuery
@ -68,6 +93,29 @@ type CustomizedQueryService interface {
*
******************************************************************************/
SeatQuery(*global.User, string, string) ([]impl.SeatQuery_SeatSummary, error)
/******************************************************************************
*
* @Function Name : SeatExportExcel
*-----------------------------------------------------------------------------
*
* @Description : 导出座椅查询结果
*
* @Function Parameters : 当前访问人员信息
*
* @Function Parameters : 座椅条码
*
* @Function Parameters : 状态已打包已目检
*
* @Return Value : 导出文件路径
*
* @Return Value : 执行时发生的错误
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-08 17:58
*
******************************************************************************/
SeatExportExcel(*global.User, string, string) (string, error)
/******************************************************************************
*
* @Function Name : PackingRecordQuery
@ -89,6 +137,27 @@ type CustomizedQueryService interface {
*
******************************************************************************/
PackingRecordQuery(*global.User, string) ([]impl.PackingRecordQuery_PackOrderSummary, error)
/******************************************************************************
*
* @Function Name : PackingRecordExportExcel
*-----------------------------------------------------------------------------
*
* @Description : 导出打包记录查询结果
*
* @Function Parameters : 当前访问人员信息
*
* @Function Parameters : 工单条码
*
* @Return Value : 导出文件路径
*
* @Return Value : 执行时发生的错误
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-08 17:58
*
******************************************************************************/
PackingRecordExportExcel(*global.User, string) (string, error)
}
/******************************************************************************


+ 63
- 3
services/report/implments/CustomizedQuery.service.impl.go View File

@ -323,7 +323,7 @@ func (impl *CustomizedQueryServiceImplement) ProductFamilyInventoryQuery(user *g
engine := db.Eloquent.Master()
session := engine.NewSession()
engine.ShowSQL(true)
defer session.Close()
shipOrders, packOrderGroups, serialOrderGroups, productFamilyKeyMapping, err := impl.querySerialOrdersWithMapping(user, session, projectId)
if err != nil {
@ -460,6 +460,26 @@ func (impl *CustomizedQueryServiceImplement) ProductFamilyInventoryQuery(user *g
return
}
/******************************************************************************
*
* @Reference LAPP_ACURA_MOM_BACKEND/services/report/CustomizedQueryService.ProductFamilyInventoryExportExcel
*
******************************************************************************/
func (impl *CustomizedQueryServiceImplement) ProductFamilyInventoryExportExcel(user *global.User, productFamilyId string, projectId string, serialOrderId string) (filepath string, err error) {
result, err := impl.ProductFamilyInventoryQuery(user, productFamilyId, projectId, serialOrderId)
if err != nil {
return
}
data := make([]interface{}, len(result))
for i, item := range result {
data[i] = item
}
return grmi.SaveExcelFile(data, []string{}, "派生库存", "派生库存查询")
}
/******************************************************************************
*
* @Reference LAPP_ACURA_MOM_BACKEND/services/report/CustomizedQueryService.SeatQuery
@ -471,8 +491,8 @@ func (impl *CustomizedQueryServiceImplement) SeatQuery(user *global.User, serial
status = strings.ToLower(strings.TrimSpace(status))
engine := db.Eloquent.Master()
engine.ShowSQL(true)
session := engine.NewSession()
defer session.Close()
switch status {
case "":
@ -589,6 +609,26 @@ func (impl *CustomizedQueryServiceImplement) SeatQuery(user *global.User, serial
return
}
/******************************************************************************
*
* @Reference LAPP_ACURA_MOM_BACKEND/services/report/CustomizedQueryService.SeatExportExcel
*
******************************************************************************/
func (impl *CustomizedQueryServiceImplement) SeatExportExcel(user *global.User, serialOrderId string, status string) (filepath string, err error) {
result, err := impl.SeatQuery(user, serialOrderId, status)
if err != nil {
return
}
data := make([]interface{}, len(result))
for i, item := range result {
data[i] = item
}
return grmi.SaveExcelFile(data, []string{"座椅条码", "包装单号", "目检时间", "打包时间", "发运单号", "发运时间", "发运模式", "座椅关联的派生"}, "座椅", "座椅查询")
}
/******************************************************************************
*
* @Reference LAPP_ACURA_MOM_BACKEND/services/report/CustomizedQueryService.PackingRecordQuery
@ -599,8 +639,8 @@ func (impl *CustomizedQueryServiceImplement) PackingRecordQuery(user *global.Use
serialOrderId = strings.TrimSpace(serialOrderId)
engine := db.Eloquent.Master()
engine.ShowSQL(true)
session := engine.NewSession()
defer session.Close()
packOrders := make([]wrapper_PackOrder_Lite, 0, 1000)
{
@ -631,3 +671,23 @@ func (impl *CustomizedQueryServiceImplement) PackingRecordQuery(user *global.Use
}
return
}
/******************************************************************************
*
* @Reference LAPP_ACURA_MOM_BACKEND/services/report/CustomizedQueryService.PackingRecordExportExcel
*
******************************************************************************/
func (impl *CustomizedQueryServiceImplement) PackingRecordExportExcel(user *global.User, serialOrderId string) (filepath string, err error) {
result, err := impl.PackingRecordQuery(user, serialOrderId)
if err != nil {
return
}
data := make([]interface{}, len(result))
for i, item := range result {
data[i] = item
}
return grmi.SaveExcelFile(data, []string{"包装单号", "状态", "打包时间", "操作人"}, "打包记录", "打包记录查询")
}

+ 121
- 0
web/controllers/report/CustomizedQuery.rest.go View File

@ -28,8 +28,11 @@ func RegisterRouteMappingOfCustomizedQuery(party router.Party) {
var service = svr.NewCustomizedQueryService()
RegisterRouteOfProductFamilyInventoryQueryInCustomizedQuery(party, service)
RegisterRouteOfProductFamilyInventoryExportExcelInCustomizedQuery(party, service)
RegisterRouteMappingOfSeatQueryInCustomizedQuery(party, service)
RegisterRouteMappingOfSeatExportExcelInCustomizedQuery(party, service)
RegisterRouteMappingOfPackingRecordQueryInCustomizedQuery(party, service)
RegisterRouteMappingOfPackingRecordExportExcelInCustomizedQuery(party, service)
}
/******************************************************************************
@ -76,6 +79,50 @@ func RegisterRouteOfProductFamilyInventoryQueryInCustomizedQuery(party router.Pa
}
/******************************************************************************
*
* @Function Name : RegisterRouteOfProductFamilyInventoryExportExcelInCustomizedQuery
*-----------------------------------------------------------------------------
*
* @Description : 注册自定义查询中导出派生库存查询结果的路由
*
* @Function Parameters : 路由分组
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-09 16:52
*
******************************************************************************/
func RegisterRouteOfProductFamilyInventoryExportExcelInCustomizedQuery(party router.Party, service svr.CustomizedQueryService) {
party.Get("/productfamilyinventoryquery_exportexcel", func(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
if !ok {
return
}
urlParameters := ctx.URLParams()
var productFamilyId string
if productFamilyId, ok = urlParameters["productfamilyid"]; !ok {
productFamilyId = ""
}
var projectId string
if projectId, ok = urlParameters["projectid"]; !ok {
projectId = ""
}
var serialOrderId string
if serialOrderId, ok = urlParameters["serialorderid"]; !ok {
serialOrderId = ""
}
result, err := service.ProductFamilyInventoryExportExcel(user, productFamilyId, projectId, serialOrderId)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
return
}
supports.Ok(ctx, supports.OptionSuccess, result)
})
}
/******************************************************************************
*
* @Function Name : RegisterRouteMappingOfSeatQueryInCustomizedQuery
@ -115,6 +162,45 @@ func RegisterRouteMappingOfSeatQueryInCustomizedQuery(party router.Party, servic
})
}
/******************************************************************************
*
* @Function Name : RegisterRouteMappingOfSeatExportExcelInCustomizedQuery
*-----------------------------------------------------------------------------
*
* @Description : 注册自定义导出座椅查询结果的路由
*
* @Function Parameters : 路由分组
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-09 16:52
*
******************************************************************************/
func RegisterRouteMappingOfSeatExportExcelInCustomizedQuery(party router.Party, service svr.CustomizedQueryService) {
party.Get("/seatquery_exportexcel", func(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
if !ok {
return
}
urlParameters := ctx.URLParams()
var status string
if status, ok = urlParameters["serialorderid"]; !ok {
status = ""
}
var serialOrderId string
if serialOrderId, ok = urlParameters["serialorderid"]; !ok {
serialOrderId = ""
}
result, err := service.SeatExportExcel(user, serialOrderId, status)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
return
}
supports.Ok(ctx, supports.OptionSuccess, result)
})
}
/******************************************************************************
*
* @Function Name : RegisterRouteMappingOfPackingRecordQueryInCustomizedQuery
@ -149,3 +235,38 @@ func RegisterRouteMappingOfPackingRecordQueryInCustomizedQuery(party router.Part
supports.Ok(ctx, supports.OptionSuccess, result)
})
}
/******************************************************************************
*
* @Function Name : RegisterRouteMappingOfPackingRecordExportExcelInCustomizedQuery
*-----------------------------------------------------------------------------
*
* @Description : 注册自定义查询中导出打包记录查询结果的路由
*
* @Function Parameters : 路由分组
*
* @Author : chenglei.wei@le-it.com.cn
*
* @Date : 2022-03-10 17:38
*
******************************************************************************/
func RegisterRouteMappingOfPackingRecordExportExcelInCustomizedQuery(party router.Party, service svr.CustomizedQueryService) {
party.Get("/packingrecordquery_exportexcel", func(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
if !ok {
return
}
urlParameters := ctx.URLParams()
var serialOrderId string
if serialOrderId, ok = urlParameters["serialorderid"]; !ok {
serialOrderId = ""
}
result, err := service.PackingRecordExportExcel(user, serialOrderId)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
return
}
supports.Ok(ctx, supports.OptionSuccess, result)
})
}

+ 2
- 1
web/routes/routes.go View File

@ -12,11 +12,12 @@ import (
homereg "LAPP_ACURA_MOM_BACKEND/web/controllers/home"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/jit"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/me"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/ods"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/om"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/pln"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/pm"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/qm"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/ods"
_ "LAPP_ACURA_MOM_BACKEND/web/controllers/report"
"LAPP_ACURA_MOM_BACKEND/web/middleware"
"LAPP_ACURA_MOM_BACKEND/web/middleware/cors"
"github.com/kataras/iris/v12"


Loading…
Cancel
Save