出入库完成

This commit is contained in:
hoteas
2021-12-15 09:24:41 +08:00
parent ac66331535
commit 62cbf28b87
7 changed files with 307 additions and 32 deletions
+69 -3
View File
@@ -115,7 +115,73 @@ var produceCtr = Ctr{
}
that.Display(0, "删除成功")
},
"check": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
data := ObjToMap(that.Req.FormValue("data"))
texts := data.GetSlice("text")
textData := []Map{}
for k, _ := range texts {
v := texts.GetString(k)
if len(v) < 3 {
continue
}
vs := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, "produce.name,produce.id,produce.product_id,product.name AS product_name,product.rule_check,product.rule_spot_check", Map{"produce.sn[~]": v[:len(v)/2+1]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
add := true
for _, vt1 := range textData {
if vt1.GetCeilInt("id") == v1.GetCeilInt("id") {
add = false
break
}
}
if add {
v1["count"] = 1
textData = append(textData, v1)
}
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
qrcode := data.GetSlice("qrcode")
for k, _ := range qrcode {
v := qrcode.GetString(k)
if len(v) < 3 {
continue
}
vs := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, "produce.name,produce.id,produce.product_id,product.name AS product_name,product.rule_check,product.rule_spot_check", Map{"produce.sn[~]": v[:len(v)/2+1]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
v1["count"] = 1
textData = append(textData, v1)
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
that.Display(0, textData)
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
@@ -125,10 +191,10 @@ var produceCtr = Ctr{
return
}
columnStr := "produce.id,produce.sn,produce.name,produce.state"
where := Map{"state": 0, "ORDER": "modify_time DESC"}
columnStr := "produce.id,produce.sn,produce.name,produce.state,produce.product_id,product.name AS product_name"
where := Map{"produce.state": 0, "ORDER": "produce.modify_time DESC"}
reData := that.Db.Select("produce", columnStr, where)
reData := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, columnStr, where)
that.Display(0, reData)
},