|
|
@ -359,13 +359,12 @@ func (impl *ToyotaCalloffServiceImplement) ExportPageDataCheck(user *global.User |
|
|
|
predicates = append(predicates, p) |
|
|
|
dao := dal.NewToyotaCalloffDAO(session, user.PlantNr, user.UserId) |
|
|
|
condition.Fill(urlParameters) |
|
|
|
result, err := dao.SelectAndPaging(condition.Paging, predicates, []grmi.Field{meta.ToyotaCalloff_RecordId}) |
|
|
|
result, err := dao.SelectWithoutPaging(condition.Paging, predicates, []grmi.Field{meta.ToyotaCalloff_RecordId}) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
data := result.Records.([]model.ToyotaCalloff) |
|
|
|
tabNameLi, err := tolnameDao.OriginSelect([]grmi.Predicate{ |
|
|
|
baseMeta.TabColName_TabName.NewPredicate(grmi.Equal, "ToyotaCalloff"), |
|
|
|
baseMeta.TabColName_TabName.NewPredicate(grmi.Equal, "PLN_ToyotaCalloff"), |
|
|
|
}, nil) |
|
|
|
if err != nil { |
|
|
|
return "", grmi.NewBusinessError("查询翻译数据失败, 错误:" + err.Error()) |
|
|
@ -385,37 +384,31 @@ func (impl *ToyotaCalloffServiceImplement) ExportPageDataCheck(user *global.User |
|
|
|
for _, item := range stdefLi { |
|
|
|
stdefMap[item.StdefTyp] = item.Bez |
|
|
|
} |
|
|
|
li := make([]interface{}, 0, len(data)) |
|
|
|
for _, item := range data { |
|
|
|
parsed, exist := stdefMap[strconv.Itoa(item.Parsed)] |
|
|
|
if !exist { |
|
|
|
parsed = strconv.Itoa(item.Parsed) |
|
|
|
} |
|
|
|
exportItem := model.ToyotaCalloffExcel{ |
|
|
|
PlantNr: item.PlantNr, |
|
|
|
DemandId: item.DemandId, |
|
|
|
SupplierCode: item.SupplierCode, |
|
|
|
ProjectId: item.ProjectId, |
|
|
|
ProductFamilyId: item.ProductFamilyId, |
|
|
|
TotalQty: item.TotalQty, |
|
|
|
CheckSequence: item.CheckSequence, |
|
|
|
Parsed: parsed, |
|
|
|
OrderTime: item.OrderTime.Restore().Format(grmi.DateTimeOutFormat), |
|
|
|
OrderShift: item.OrderShift, |
|
|
|
} |
|
|
|
li = append(li, exportItem) |
|
|
|
} |
|
|
|
|
|
|
|
head := make([]string, 0) |
|
|
|
var exportItem model.ToyotaCalloffExcel |
|
|
|
typeOf := reflect.TypeOf(exportItem) |
|
|
|
var item model.ToyotaCalloff |
|
|
|
typeOf := reflect.TypeOf(item) |
|
|
|
indexLi := make([]int, 0) |
|
|
|
for i := 0; i < typeOf.NumField(); i++ { |
|
|
|
name, exist := tabNameMap[typeOf.Field(i).Name] |
|
|
|
if !exist { |
|
|
|
head = append(head, typeOf.Field(i).Name) |
|
|
|
} else { |
|
|
|
if exist { |
|
|
|
head = append(head, name) |
|
|
|
indexLi = append(indexLi, i) |
|
|
|
} |
|
|
|
} |
|
|
|
filepath, err = grmi.SaveExcelFile(li, head, "Sheet1", "顺引") |
|
|
|
li := make([]map[string]interface{}, 0, len(result)) |
|
|
|
for _, item := range result { |
|
|
|
tv := reflect.ValueOf(item) |
|
|
|
tf := reflect.TypeOf(item) |
|
|
|
m := make(map[string]interface{}) |
|
|
|
for _, index := range indexLi { |
|
|
|
fieldName := tf.Field(index).Name |
|
|
|
fieldValue := tv.FieldByName(fieldName).Interface() |
|
|
|
k := tabNameMap[fieldName] |
|
|
|
m[k] = fieldValue |
|
|
|
} |
|
|
|
li = append(li, m) |
|
|
|
} |
|
|
|
filepath, err = grmi.SaveExcelFileUseMap(li, head, "Sheet1", "发运校验") |
|
|
|
return |
|
|
|
} |