|
|
@ -9,7 +9,6 @@ import ( |
|
|
|
jitModel "LAPP_ACURA_MOM_BACKEND/models/jit" |
|
|
|
omModel "LAPP_ACURA_MOM_BACKEND/models/om" |
|
|
|
"fmt" |
|
|
|
set "github.com/deckarep/golang-set" |
|
|
|
"github.com/go-xorm/xorm" |
|
|
|
"sort" |
|
|
|
"strings" |
|
|
@ -101,7 +100,7 @@ func NewCustomizedQueryServiceImplement() *CustomizedQueryServiceImplement { |
|
|
|
return &CustomizedQueryServiceImplement{} |
|
|
|
} |
|
|
|
|
|
|
|
func (impl *CustomizedQueryServiceImplement) querySerialOrdersWithMapping(user *global.User, session *xorm.Session, projectId string) (shipOrders []wrapper_ShipOrder, packOrderGroups map[string][]*wrapper_PackOrder, serialOrderGroups map[string][]*wrapper_SerialOrder, productFamilyKeySet set.Set, err error) { |
|
|
|
func (impl *CustomizedQueryServiceImplement) querySerialOrdersWithMapping(user *global.User, session *xorm.Session, projectId string) (shipOrders []wrapper_ShipOrder, packOrderGroups map[string][]*wrapper_PackOrder, serialOrderGroups map[string][]*wrapper_SerialOrder, productFamilyKeyMapping map[string][]string, err error) { |
|
|
|
|
|
|
|
// 查询座椅-座椅状态-包装单项
|
|
|
|
serialOrders := make([]wrapper_SerialOrder, 0, 1000) |
|
|
@ -178,14 +177,19 @@ func (impl *CustomizedQueryServiceImplement) querySerialOrdersWithMapping(user * |
|
|
|
templateItemGroups[templateItem.PackTemplateId] = group |
|
|
|
} |
|
|
|
// 计算系统中现有派生
|
|
|
|
productFamilyKeySet = set.NewSet() |
|
|
|
for _, group := range templateItemGroups { |
|
|
|
productFamilyKeyMapping = make(map[string][]string) |
|
|
|
for packTemplateId, group := range templateItemGroups { |
|
|
|
parts := make([]string, 0, 10) |
|
|
|
for _, templateItem := range group { |
|
|
|
parts = append(parts, templateItem.PartId) |
|
|
|
} |
|
|
|
sort.Strings(parts) |
|
|
|
productFamilyKeySet.Add(strings.Join(parts, ",")) |
|
|
|
productFamilyKey := strings.Join(parts, ",") |
|
|
|
packTemplateIdGroup, ok := productFamilyKeyMapping[productFamilyKey] |
|
|
|
if !ok { |
|
|
|
packTemplateIdGroup = make([]string, 0, 10) |
|
|
|
} |
|
|
|
productFamilyKeyMapping[productFamilyKey] = append(packTemplateIdGroup, packTemplateId) |
|
|
|
} |
|
|
|
// 按发运单分组包装单, key为"" 为没有关联到发运单的包装单(不应该出现)
|
|
|
|
packOrderGroups = make(map[string][]*wrapper_PackOrder) |
|
|
@ -238,7 +242,7 @@ func (impl *CustomizedQueryServiceImplement) ProductFamilyInventoryQuery(user *g |
|
|
|
session := engine.NewSession() |
|
|
|
engine.ShowSQL(true) |
|
|
|
|
|
|
|
//shipOrders, packOrderGroups, serialOrderGroups, productFamilyKeySet, err := impl.querySerialOrdersWithMapping(user, session, projectId)
|
|
|
|
//shipOrders, packOrderGroups, serialOrderGroups, productFamilyKeyMapping, err := impl.querySerialOrdersWithMapping(user, session, projectId)
|
|
|
|
_, _, _, _, err = impl.querySerialOrdersWithMapping(user, session, projectId) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
@ -261,7 +265,7 @@ func (impl *CustomizedQueryServiceImplement) SeatQuery(user *global.User, serial |
|
|
|
engine.ShowSQL(true) |
|
|
|
session := engine.NewSession() |
|
|
|
|
|
|
|
//shipOrders, packOrderGroups, serialOrderGroups, productFamilyKeySet, err := impl.querySerialOrdersWithMapping(user, session, "")
|
|
|
|
//shipOrders, packOrderGroups, serialOrderGroups, productFamilyKeyMapping, err := impl.querySerialOrdersWithMapping(user, session, "")
|
|
|
|
_, _, _, _, err = impl.querySerialOrdersWithMapping(user, session, "") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|