出入库完成

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
+27 -9
View File
@@ -73,17 +73,35 @@ var productCtr = Ctr{
}
id := ObjToInt(that.Req.FormValue("id"))
//抽检更新
ruleSpotCheck := that.Req.FormValue("rule_spot_check")
if id == 0 || ruleSpotCheck == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
if ruleSpotCheck != "" {
spotCheckPercentage := ObjToInt(that.Req.FormValue("spot_check_percentage"))
if id == 0 || ruleSpotCheck == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Update("product", Map{"rule_spot_check": ruleSpotCheck, "spot_check_percentage": spotCheckPercentage, "modify_time": time.Now().Unix()}, Map{"id": id})
if re == 0 {
that.Display(4, "更新失败,无法更新抽检参数")
return
}
} else {
//质检更新
ruleCheck := that.Req.FormValue("rule_check")
if id == 0 || ruleCheck == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Update("product", Map{"rule_check": ruleCheck, "modify_time": time.Now().Unix()}, Map{"id": id})
if re == 0 {
that.Display(4, "更新失败,无法更新质检参数")
return
}
re := that.Db.Update("product", Map{"rule_spot_check": ruleSpotCheck, "modify_time": time.Now().Unix()}, Map{"id": id})
if re == 0 {
that.Display(4, "更新失败,无法更新抽检参数")
return
}
that.Display(0, "更新成功")