优化系统

This commit is contained in:
hoteas 2021-12-27 18:21:41 +08:00
parent b84bd7e16f
commit f24de2562a
8 changed files with 39 additions and 3575 deletions

View File

@ -60,7 +60,7 @@ var ColumnNameType = []ColumnShow{
{"parent_id", true, true, true, false, "", true}, {"parent_id", true, true, true, false, "", true},
//"sn"{true,true,true,""}, //"sn"{true,true,true,""},
{"status", true, true, true, false, "select", false}, {"status", true, true, true, false, "select", false},
{"state", false, true, true, false, "select", false}, {"state", true, true, true, false, "select", false},
{"sex", true, true, true, false, "select", false}, {"sex", true, true, true, false, "select", false},
{"delete", false, false, false, false, "", false}, {"delete", false, false, false, false, "", false},

View File

@ -593,10 +593,12 @@ func (that *MakeCode) Add(table string, req *http.Request) Map {
} }
} }
if v.GetString("name") == "create_time" { if v.GetString("name") == "create_time" {
data[v.GetString("name")] = time.Now().Unix() data[v.GetString("name")] = time.Now().Unix()
continue continue
} }
if v.GetString("name") == "modify_time" { if v.GetString("name") == "modify_time" {
data[v.GetString("name")] = time.Now().Unix() data[v.GetString("name")] = time.Now().Unix()
} }

View File

@ -5,7 +5,7 @@ import (
. "../../../hotime/common" . "../../../hotime/common"
) )
var ID = "a549346388b58195866106b5f2072b26" var ID = "61161bc80c283839d95c99900b8dbb35"
// Project 管理端项目 // Project 管理端项目
var Project = Proj{ var Project = Proj{
@ -20,7 +20,6 @@ var Project = Proj{
"produce_material": produce_materialCtr, "produce_material": produce_materialCtr,
"produce_product": produce_productCtr, "produce_product": produce_productCtr,
"product": productCtr, "product": productCtr,
"product_check": product_checkCtr,
"product_line": product_lineCtr, "product_line": product_lineCtr,
"product_spot_check": product_spot_checkCtr, "product_spot_check": product_spot_checkCtr,
"role": roleCtr, "role": roleCtr,

View File

@ -67,8 +67,13 @@ var material_inoutCtr = Ctr{
"admin_id": adminID, "admin_id": adminID,
"material_id": materialId}) "material_id": materialId})
} }
if state == 0 {
that.Db.Update("material", Map{"count[#]": "count+" + ObjToStr(count), "saved[#]": "saved+" + ObjToStr(count)}, Map{"id": materialId})
} else {
that.Db.Update("material", Map{"count[#]": "count" + ObjToStr(count), "used[#]": "used+" + ObjToStr(-count)}, Map{"id": materialId})
}
that.Db.Update("material", Map{"count[#]": "count+" + ObjToStr(count), "saved[#]": "saved+" + ObjToStr(count)}, Map{"id": materialId})
material := that.Db.Get("material", "*", Map{"id": materialId}) material := that.Db.Get("material", "*", Map{"id": materialId})
data := Map{ data := Map{
"img": img, "img": img,

View File

@ -56,10 +56,10 @@ var produce_productCtr = Ctr{
product_id := ObjToInt(that.Req.FormValue("product_id")) product_id := ObjToInt(that.Req.FormValue("product_id"))
produce_id := ObjToInt(that.Req.FormValue("produce_id")) produce_id := ObjToInt(that.Req.FormValue("produce_id"))
product_line_id := ObjToInt(that.Req.FormValue("product_line_id")) product_line_id := ObjToInt(that.Req.FormValue("product_line_id"))
state := ObjToInt(that.Req.FormValue("state")) //state := ObjToInt(that.Req.FormValue("state"))
rule_check := that.Req.FormValue("rule_check") //rule_check := that.Req.FormValue("rule_check")
description := that.Req.FormValue("description") //description := that.Req.FormValue("description")
if sn == "" || rule_check == "" { if sn == "" {
that.Display(3, "参数不足,请补充参数") that.Display(3, "参数不足,请补充参数")
return return
} }
@ -82,15 +82,15 @@ var produce_productCtr = Ctr{
} }
//data["id"] = id //data["id"] = id
data["rule"] = rule_check //data["rule"] = rule_check
data["produce_product_id"] = id //data["produce_product_id"] = id
data["state"] = state //data["state"] = state
data["description"] = description //data["description"] = description
id = that.Db.Insert("product_check", data) //id = that.Db.Insert("product_check", data)
if id == 0 { //if id == 0 {
that.Display(4, "添加质检失败,请重新添加") // that.Display(4, "添加质检失败,请重新添加")
return // return
} //}
that.Display(0, data) that.Display(0, data)
}, },
} }

View File

@ -58,14 +58,21 @@ var product_spot_checkCtr = Ctr{
} }
produceProduct := that.Db.Get("produce_product", "*", Map{"id": produceProductId}) produceProduct := that.Db.Get("produce_product", "*", Map{"id": produceProductId})
if produceProduct == nil {
that.Display(4, "找不到成品记录,无法进行抽检")
return
}
//判断是否已经抽检了
alreadyCheck := that.Db.Get("product_spot_check", "id", Map{"produce_product_id": produceProductId})
that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+1", if alreadyCheck == nil {
"spot_check_saved[#]": "spot_check_saved+1"},
Map{"id": produceProduct.GetCeilInt("product_id")})
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1", that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+1"},
"spot_check_saved[#]": "spot_check_saved+1"}, Map{"id": produceProduct.GetCeilInt("product_id")})
Map{"id": produceProduct.GetCeilInt("produce_id")})
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1"},
Map{"id": produceProduct.GetCeilInt("produce_id")})
}
data := Map{ data := Map{
"sn": sn, "sn": sn,

File diff suppressed because it is too large Load Diff

View File

@ -331,6 +331,9 @@ func Process(conn net.Conn, appIns *hotime.Application) {
fmt.Println(client, sn, "添加新成品失败,请重新添加") // 读到了n个数据 fmt.Println(client, sn, "添加新成品失败,请重新添加") // 读到了n个数据
continue continue
} }
appIns.Db.Update("product", common.Map{"count[#]": "`count`+1"}, common.Map{"id": produce.GetCeilInt("product_id")})
appIns.Db.Update("produce", common.Map{"now[#]": "`now`+1"}, common.Map{"id": produce.GetCeilInt("id")})
} }
} }