出入库完成
This commit is contained in:
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
. "../../../hotime"
|
||||
. "../../../hotime/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
var produce_productCtr = Ctr{
|
||||
@@ -23,18 +24,18 @@ var produce_productCtr = Ctr{
|
||||
|
||||
where := Map{}
|
||||
if id != 0 {
|
||||
where["id"] = id
|
||||
where["produce_product.id"] = id
|
||||
} else {
|
||||
where["sn"] = sn
|
||||
where["produce_product.sn"] = sn
|
||||
}
|
||||
|
||||
re := that.Db.Get("produce_product",
|
||||
|
||||
Map{"[><]product": "product_spot_check.product_id=product.id",
|
||||
"[><]produce": "product_spot_check.produce_id=produce.id",
|
||||
Map{"[><]product": "produce_product.product_id=product.id",
|
||||
"[><]produce": "produce_product.produce_id=produce.id",
|
||||
},
|
||||
"id,img,product_id,product.name AS product_name,admin_id,"+
|
||||
"modify_time,state,rule,produce_id,produce.name AS produce_name", where)
|
||||
"produce_product.id,produce_product.product_id,product.name AS product_name,produce_product.admin_id,"+
|
||||
"produce_product.modify_time,produce_product.state,product.rule_spot_check,produce_product.produce_id,produce.name AS produce_name", where)
|
||||
|
||||
if re == nil {
|
||||
that.Display(4, "找不到对应信息")
|
||||
@@ -43,4 +44,51 @@ var produce_productCtr = Ctr{
|
||||
|
||||
that.Display(0, re)
|
||||
},
|
||||
"add": func(that *Context) {
|
||||
adminID := that.Session("id").ToInt()
|
||||
|
||||
if adminID == 0 {
|
||||
that.Display(2, "登录失效,请重新登录")
|
||||
return
|
||||
}
|
||||
|
||||
sn := that.Req.FormValue("sn")
|
||||
product_id := ObjToInt(that.Req.FormValue("product_id"))
|
||||
produce_id := ObjToInt(that.Req.FormValue("produce_id"))
|
||||
state := ObjToInt(that.Req.FormValue("state"))
|
||||
rule_check := that.Req.FormValue("rule_check")
|
||||
description := that.Req.FormValue("description")
|
||||
if sn == "" || rule_check == "" {
|
||||
that.Display(3, "参数不足,请补充参数")
|
||||
return
|
||||
}
|
||||
|
||||
data := Map{
|
||||
|
||||
"admin_id": adminID,
|
||||
"sn": sn,
|
||||
"product_id": product_id,
|
||||
"produce_id": produce_id,
|
||||
"create_time": time.Now().Unix(),
|
||||
"modify_time": time.Now().Unix(),
|
||||
}
|
||||
|
||||
id := that.Db.Insert("produce_product", data)
|
||||
if id == 0 {
|
||||
that.Display(4, "添加新成品失败,请重新添加")
|
||||
return
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
that.Display(0, data)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user