Browse Source

日志更新

pull/303/head
yehongyang 3 years ago
parent
commit
10e92103db
6 changed files with 109 additions and 32 deletions
  1. +1
    -1
      conf/app.go
  2. +22
    -18
      conf/htm_log_config.yaml
  3. +1
    -1
      main.go
  4. +1
    -0
      models/ap/CustDemandVerHead.model.go
  5. +63
    -10
      services/ap/implments/Balance.service.impl.go
  6. +21
    -2
      services/ap/implments/CustDemandVerHead.service.impl.go

+ 1
- 1
conf/app.go View File

@ -10,7 +10,7 @@ import (
var ExampleFile = "http://localhost:9001/public/uploadxlsx/example.xlsx"
var Baseurl = "http://localhost:9001"
var Baseurl = "http://localhost:9003"
type AppConf struct {
DisablePathCorrection bool


+ 22
- 18
conf/htm_log_config.yaml View File

@ -1,19 +1,19 @@
# module配置输出源 配置为map
config:
plan:
# 文件location
filename: ./log/plan
filetype: html
default: "<style>.hr{width:100%;}table{width:100%;border:1;background:#FF9966;}table td{word-break: break-all;background-color:#fff;}.t_title{width:15%;}.time-val{width:30%;}.val{width:40%;font-weight: 700;}.info{width:75%;}</style>"
# 支持文件的最大个数
MaxAge: 30
body:
info : "<table><tr><td class=\"t_title\">时间:</td><td class=\"time-val\">[time]</td><td class=\"t_title\">错误提示:</td><td class=\"val\">[info]</td></tr><tr><td>Request:</td><td class=\"info\" colspan=\"3\">[request]</td></tr><tr><td>Response:</td><td class=\"info\" colspan=\"3\">[response]</td></tr></table><hr></hr>"
replace :
- "time"
- "info"
- "request"
- "response"
# 文件location
filename: ./log/plan
filetype: html
default: "<style>.hr{width:100%;}table{width:100%;border:1;background:#FF9966;}table td{word-break: break-all;background-color:#fff;}.t_title{width:15%;}.time-val{width:30%;}.val{width:40%;font-weight: 700;}.info{width:75%;}</style>"
# 支持文件的最大个数
MaxAge: 30
body:
info : "<table><tr><td class=\"t_title\">时间:</td><td class=\"time-val\">[time]</td><td class=\"t_title\">错误提示:</td><td class=\"val\">[info]</td></tr><tr><td>Request:</td><td class=\"info\" colspan=\"3\">[request]</td></tr><tr><td>Response:</td><td class=\"info\" colspan=\"3\">[response]</td></tr></table><hr></hr>"
replace :
- "time"
- "info"
- "request"
- "response"
salesorder:
# 文件location
filename: ./log/salesOrder
@ -44,15 +44,19 @@ config:
- "response"
planlog:
filename: ./log/planlog
filetype: html-page
default: "<html lang=\"en\"><head><meta charset=\"UTF-8\"><title>[title]</title><script src=\"jquery-3.6.0.min.js\"></script><script src=\"jquery.table2excel.js\"></script></head><body><label for=\"search\">物料ID:</label><input type=\"text\" name=\"search\" id=\"search\"><input type=\"button\" value=\"导出\" id=\"export\"><table border=\"1px\" cellpadding=\"0\" cellspacing=\"0\" class=\"history_table\"><thead><tr>[table_head]</tr></thead><tbody>"
filetype: html
default: "<html lang=\"en\"><head><meta charset=\"UTF-8\"><title>[title]</title><script src=\"../planlogjs/jquery-3.6.0.min.js\"></script><script src=\"../planlogjs/jquery.table2excel.js\"></script></head><body><label for=\"search\">物料ID:</label><input type=\"text\" name=\"search\" id=\"search\"><label for=\"state\">状态</label><select id=\"state\"><option value=\"\">所有</option><option value=\"未发布\">未发布</option><option value=\"已发布\">已发布</option></select><input type=\"button\" value=\"导出\" id=\"export\"><table border=\"1px\" cellpadding=\"0\" cellspacing=\"0\" class=\"history_table\"><thead><tr>[table_head]</tr></thead><tbody>"
body:
info: "<tr class=\"title\">[info_one]</tr>"
info: "<tr class=\"title [class_one]\">[info_one]</tr>"
info_two: "<tr class=\"[info_two_title] content\">[info_two]</tr>"
bottom: "</tbody></table></body></html><script>$(function(){$(\".title\").click(function(){let artId = $(this).children('td').eq(0).html();$(\".\"+artId).toggle(\"fast\",\"linear\")})$(\"#search\").keyup(function(){var txt=$(\"input[type=text]\").val();if($.trim(txt)!=\"\"){$(\".title\").hide().filter(\":contains('\"+txt+\"')\").show();} else {$(\".title\").show();}});$(\"#export\").click(function(){$(\".history_table\").table2excel({exclude: \".noExl\",name: \"[title]\",filename: \"[title]\",bootstrap: false});})})</script><style>.history_table {width: 80%;}.title {cursor: pointer;text-align: center;}.content {display: none;text-align: center;}</style>"
bottom: "</tbody></table></body></html><script>$(function(){$(\".title\").click(function(){var artId = $(this).children('td').eq(0).html();$(\".\"+artId).toggle(\"fast\",\"linear\")});$(\"#search\").keyup(function(){$(\"#state\").val(\"\");var txt=$(\"input[type=text]\").val();if($.trim(txt)!=\"\"){$(\".title\").hide().filter(\":contains('\"+txt+\"')\").show();} else {$(\".title\").show();}});$(\"#state\").change(function(){$(\"#search\").val(\"\");var txt=$(\"#state\").val();if($.trim(txt)!=\"\"){$(\".title\").hide().filter(\":contains('\"+txt+\"')\").show();} else {$(\".title\").show();}});$(\"#export\").click(function(){$(\".history_table\").table2excel({exclude: \".noExl\",name: \"[title]\",filename: \"[title]\",bootstrap: false});})})</script><style>.history_table {width: 100%;}.title {cursor: pointer;text-align: center;background: #bdbdbd;}.no_public {background-color:bisque;}.content {display: none;text-align: center;}</style>"
replace:
- "title"
- "table_head"
- "class_one"
- "info_one"
- "info_two"
- "info_two_title"
- "info_two_title"
planlogjs:
filename: ./log/planlog/js
filetype:

+ 1
- 1
main.go View File

@ -137,6 +137,6 @@ func imain() {
// 开启自动创建功能
go createVersion.CreateVersionTask()
//启动监听端口
app.Run(iris.Addr(":9001"), iris.WithConfiguration(conf.C))
app.Run(iris.Addr(":9003"), iris.WithConfiguration(conf.C))
}

+ 1
- 0
models/ap/CustDemandVerHead.model.go View File

@ -50,6 +50,7 @@ type CustDemandVerHead struct {
PublishNumber string `xorm:"nvarchar(255) 'PublishNumber'" json:"AP_CustDemandVerHead-PublishNumber"`
PublishStatus int `xorm:"int 'PublishStatus'" json:"AP_CustDemandVerHead-PublishStatus"`
MpsStatus int `xorm:"int 'MpsStatus'" json:"AP_CustDemandVerHead-MpsStatus"`
UserName string `xorm:"-" json:"AP_CustDemandVerHead-UserName"`
}
/******************************************************************************


+ 63
- 10
services/ap/implments/Balance.service.impl.go View File

@ -292,8 +292,35 @@ func (impl *BalanceServiceImplement) GetCustomerArticleDemandHtml(user *global.U
messageHead := make(map[string]string)
messageHead["title"] = versionId
tableHead := ""
for _, _v := range CustArtStockaLL.SortKeys {
tableHead += "<th>" + _v + "</th>"
for k, _v := range CustArtStockaLL.SortKeys {
switch _v {
case "AP_ArticleDemand-ArtId":
tableHead += "<th>物料Id</th>"
break
case "AP_ArticleDemand-State":
tableHead += "<th>发布状态</th>"
break
case "AP_ArticleDemand-Descr1":
tableHead += "<th>中文描述</th>"
break
case "AP_ArticleDemand-FGStock":
tableHead += "<th>成品库存</th>"
break
case "AP_ArticleDemand-WIPStock":
tableHead += "<th>成品在制</th>"
break
case "AP_ArticleDemand-PUCStock":
tableHead += "<th>采购量</th>"
break
default:
tableHead += "<th>" + _v + "</th>"
break
}
if k == 5 {
tableHead += "<th>项目名</th>"
}
}
messageHead["table_head"] = tableHead
//渲染表头
@ -303,32 +330,58 @@ func (impl *BalanceServiceImplement) GetCustomerArticleDemandHtml(user *global.U
messageTwo := make(map[string]string)
var infoOne string
var infoTwo string
i := len(CustArtStockaLL.SortKeys)
var classOne string
i := 12
titleArr := map[int]string{
12: "净生产量",
11: "预测需求",
10: "订单需求",
9: "外购需求",
8: "独立需求",
7: "在制量",
6: "委外量",
5: "采购量",
4: "期初库存",
3: "目标库存",
2: "最低库存",
1: "期末库存",
}
for _, v := range CustArtStockaLL.ItemLst {
infoOne = ""
classOne = ""
infoTwo = ""
for _, _v := range CustArtStockaLL.SortKeys {
if i == len(CustArtStockaLL.SortKeys) {
for _k, _v := range CustArtStockaLL.SortKeys {
if i == 12 {
if _k == 0 && v["AP_ArticleDemand-State"] == "未发布" {
classOne = "no_public"
}
infoOne += "<td>" + v[_v] + "</td>"
} else {
infoTwo += "<td>" + v[_v] + "</td>"
}
if _v == "AP_ArticleDemand-PUCStock" {
if i == 12 {
infoOne += "<td>" + titleArr[i] + "</td>"
} else {
infoTwo += "<td>" + titleArr[i] + "</td>"
}
}
}
if i == len(CustArtStockaLL.SortKeys) {
if i == 12 {
messageOne["class_one"] = classOne
messageOne["info_one"] = infoOne
logUtils.Write("planlog", messageOne, versionId, "info")
} else {
messageTwo["info_two"] = infoOne
messageTwo["info_two"] = infoTwo
messageTwo["info_two_title"] = v["AP_ArticleDemand-ArtId"]
logUtils.Write("planlog", messageTwo, versionId, "info_two")
}
i--
i = i - 1
if i == 0 {
i = len(CustArtStockaLL.SortKeys)
i = 12
}
}
logUtils.WriteFileBottom("planlog", messageHead, versionId)
}
// 显示计划列表


+ 21
- 2
services/ap/implments/CustDemandVerHead.service.impl.go View File

@ -802,23 +802,42 @@ func (impl *CustDemandVerHeadServiceImplement) SelectData(user *global.User, url
if err != nil {
return grmi.EmptyPagingResult, err
}
userMap := make(map[string]string)
userDao := basedal.NewUserDAO(session, user.PlantNr, user.UserId)
resultInfo, ok := result.Records.([]model.CustDemandVerHead)
for k, v := range resultInfo {
if _, ok := userMap[v.LastUser]; !ok {
_user, err := userDao.SelectOne(v.LastUser)
if err != nil {
return grmi.PagingResult{}, err
}
if _user == nil {
userMap[v.LastUser] = _user.LastUser
} else {
userMap[v.LastUser] = _user.Name
}
}
resultInfo[k].UserName = userMap[v.LastUser]
}
if len(list) > 0 {
var versionId string
for _, v := range list {
versionId = v.VersionId
}
resultInfo, ok := result.Records.([]model.CustDemandVerHead)
if ok {
for k, v := range resultInfo {
if versionId == v.VersionId {
resultInfo[k].Valid = true
}
}
result.Records = resultInfo
}
}
result.Records = resultInfo
return result, nil
}


Loading…
Cancel
Save