优化系统
This commit is contained in:
@@ -67,8 +67,13 @@ var material_inoutCtr = Ctr{
|
||||
"admin_id": adminID,
|
||||
"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})
|
||||
data := Map{
|
||||
"img": img,
|
||||
|
||||
@@ -56,10 +56,10 @@ var produce_productCtr = Ctr{
|
||||
product_id := ObjToInt(that.Req.FormValue("product_id"))
|
||||
produce_id := ObjToInt(that.Req.FormValue("produce_id"))
|
||||
product_line_id := ObjToInt(that.Req.FormValue("product_line_id"))
|
||||
state := ObjToInt(that.Req.FormValue("state"))
|
||||
rule_check := that.Req.FormValue("rule_check")
|
||||
description := that.Req.FormValue("description")
|
||||
if sn == "" || rule_check == "" {
|
||||
//state := ObjToInt(that.Req.FormValue("state"))
|
||||
//rule_check := that.Req.FormValue("rule_check")
|
||||
//description := that.Req.FormValue("description")
|
||||
if sn == "" {
|
||||
that.Display(3, "参数不足,请补充参数")
|
||||
return
|
||||
}
|
||||
@@ -82,15 +82,15 @@ var produce_productCtr = Ctr{
|
||||
}
|
||||
|
||||
//data["id"] = id
|
||||
data["rule"] = rule_check
|
||||
data["produce_product_id"] = id
|
||||
data["state"] = state
|
||||
data["description"] = description
|
||||
id = that.Db.Insert("product_check", data)
|
||||
if id == 0 {
|
||||
that.Display(4, "添加质检失败,请重新添加")
|
||||
return
|
||||
}
|
||||
//data["rule"] = rule_check
|
||||
//data["produce_product_id"] = id
|
||||
//data["state"] = state
|
||||
//data["description"] = description
|
||||
//id = that.Db.Insert("product_check", data)
|
||||
//if id == 0 {
|
||||
// that.Display(4, "添加质检失败,请重新添加")
|
||||
// return
|
||||
//}
|
||||
that.Display(0, data)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -58,14 +58,21 @@ var product_spot_checkCtr = Ctr{
|
||||
}
|
||||
|
||||
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",
|
||||
"spot_check_saved[#]": "spot_check_saved+1"},
|
||||
Map{"id": produceProduct.GetCeilInt("product_id")})
|
||||
if alreadyCheck == nil {
|
||||
|
||||
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1",
|
||||
"spot_check_saved[#]": "spot_check_saved+1"},
|
||||
Map{"id": produceProduct.GetCeilInt("produce_id")})
|
||||
that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+1"},
|
||||
Map{"id": produceProduct.GetCeilInt("product_id")})
|
||||
|
||||
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1"},
|
||||
Map{"id": produceProduct.GetCeilInt("produce_id")})
|
||||
}
|
||||
|
||||
data := Map{
|
||||
"sn": sn,
|
||||
|
||||
Reference in New Issue
Block a user