|
|
@@ -5,7 +5,6 @@ import (
|
|
|
"bswas/orm"
|
|
|
"bswas/utilities"
|
|
|
"encoding/json"
|
|
|
- "fmt"
|
|
|
"net/http"
|
|
|
)
|
|
|
|
|
|
@@ -16,7 +15,7 @@ func Export(w http.ResponseWriter,req *http.Request) {
|
|
|
// 解析参数 存入map
|
|
|
e := decoder.Decode(¶ms)
|
|
|
if e != nil{
|
|
|
- utilities.WriteLog("/api/controller/controller.go:17 参数解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:18 参数解析失败!","ERROR")
|
|
|
return
|
|
|
}
|
|
|
file := excel.CreateFile(selectModule(params))
|
|
|
@@ -26,14 +25,26 @@ func Export(w http.ResponseWriter,req *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
if _, err := file.WriteTo(w); err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:22 返回二进制流失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:28 返回二进制流失败!","ERROR")
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+type base struct {
|
|
|
+ ROW []interface{} `json:"row"`
|
|
|
+ LIST [][]interface{} `json:"list"`
|
|
|
+}
|
|
|
|
|
|
func selectModule(params map[string]string) (row []interface{}, list [][]interface{}, mergeRow map[string]string, mergeColumn []string) {
|
|
|
var data []map[string]string
|
|
|
switch params["type"] {
|
|
|
+ case "base":
|
|
|
+ var val base
|
|
|
+ err := json.Unmarshal([]byte(params["data"]),&val)
|
|
|
+ if err != nil {
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:44 JSON解析失败!","ERROR")
|
|
|
+ }
|
|
|
+ row = val.ROW
|
|
|
+ list = val.LIST
|
|
|
case "waybill":
|
|
|
data = orm.GetMysqlData(params["sql"])
|
|
|
row, list = WaybillFormat(data)
|
|
|
@@ -77,7 +88,7 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
|
|
|
}else{
|
|
|
err := json.Unmarshal([]byte(params["data"]), &data)
|
|
|
if err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:73 库存数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:91 库存数据json解析失败!","ERROR")
|
|
|
}
|
|
|
}
|
|
|
row, list = InventoryFormat(data, true)
|
|
|
@@ -87,7 +98,7 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
|
|
|
}else{
|
|
|
err := json.Unmarshal([]byte(params["data"]), &data)
|
|
|
if err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:83 全部库存数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:101 全部库存数据json解析失败!","ERROR")
|
|
|
}
|
|
|
}
|
|
|
row, list = InventoryFormat(data, false)
|
|
|
@@ -106,14 +117,14 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
|
|
|
case "laborReport":
|
|
|
err := json.Unmarshal([]byte(params["data"]), &data)
|
|
|
if err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:102 临时工报表数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:120 临时工报表数据json解析失败!","ERROR")
|
|
|
}
|
|
|
row, list = LaborReportFormat(data)
|
|
|
case "orderIssue":
|
|
|
sqlList := make(map[string]string)
|
|
|
err := json.Unmarshal([]byte(params["sqlList"]), &sqlList)
|
|
|
if err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:110 订单问题件数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:129 订单问题件数据json解析失败!","ERROR")
|
|
|
}
|
|
|
if sqlList["orderPackageSql"] == "" || sqlList["secondOrderPackageSql"] == "" || sqlList["orderIssueSql"] == "" || sqlList["rejectedBillItemSql"] == "" || sqlList["logSql"] == ""{
|
|
|
return
|
|
|
@@ -169,15 +180,13 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
|
|
|
request := paramList{}
|
|
|
err := json.Unmarshal([]byte(params["data"]), &request)
|
|
|
if err != nil {
|
|
|
- utilities.WriteLog("/api/controller/controller.go:137 称重统计数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:183 称重统计数据json解析失败!","ERROR")
|
|
|
}
|
|
|
row, list = PackageStatisticFormat(request.ROW, request.LIST)
|
|
|
case "inventoryAccountMission":
|
|
|
- fmt.Println(params["data"])
|
|
|
err := json.Unmarshal([]byte(params["data"]), &data)
|
|
|
if err != nil {
|
|
|
- fmt.Println(err)
|
|
|
- utilities.WriteLog("/api/controller/controller.go:178 库存盘点数据json解析失败!","ERROR")
|
|
|
+ utilities.WriteLog("/api/controller/controller.go:189 库存盘点数据json解析失败!","ERROR")
|
|
|
}
|
|
|
row, list = InventoryAccountMissionFormat(data)
|
|
|
case "inventoryCompare":
|