出入库完成
This commit is contained in:
parent
7a649fd652
commit
166eeee64c
@ -5,7 +5,7 @@ import (
|
|||||||
. "../../../hotime/common"
|
. "../../../hotime/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ID = "ea99a21b92f2b639eaaceae31dfd8499"
|
var ID = "7b1c0ebec5cc5b407bcd243c54d45d10"
|
||||||
|
|
||||||
// Project 管理端项目
|
// Project 管理端项目
|
||||||
var Project = Proj{
|
var Project = Proj{
|
||||||
|
@ -167,6 +167,9 @@ var materialCtr = Ctr{
|
|||||||
}
|
}
|
||||||
vs := that.Db.Select("material", "name,id,content,rule,num", Map{"content[~]": v[:len(v)/2]})
|
vs := that.Db.Select("material", "name,id,content,rule,num", Map{"content[~]": v[:len(v)/2]})
|
||||||
for _, v1 := range vs {
|
for _, v1 := range vs {
|
||||||
|
if len(textData) == 0 {
|
||||||
|
textData = append(textData, v1)
|
||||||
|
}
|
||||||
for _, vt := range textData {
|
for _, vt := range textData {
|
||||||
if v1.GetString("id") != vt.GetString("id") {
|
if v1.GetString("id") != vt.GetString("id") {
|
||||||
v1["count"] = 1
|
v1["count"] = 1
|
||||||
|
@ -115,7 +115,73 @@ var produceCtr = Ctr{
|
|||||||
}
|
}
|
||||||
that.Display(0, "删除成功")
|
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) {
|
"search": func(that *Context) {
|
||||||
|
|
||||||
adminID := that.Session("id").ToInt()
|
adminID := that.Session("id").ToInt()
|
||||||
@ -125,10 +191,10 @@ var produceCtr = Ctr{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
columnStr := "produce.id,produce.sn,produce.name,produce.state"
|
columnStr := "produce.id,produce.sn,produce.name,produce.state,produce.product_id,product.name AS product_name"
|
||||||
where := Map{"state": 0, "ORDER": "modify_time DESC"}
|
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)
|
that.Display(0, reData)
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,7 @@ package app
|
|||||||
import (
|
import (
|
||||||
. "../../../hotime"
|
. "../../../hotime"
|
||||||
. "../../../hotime/common"
|
. "../../../hotime/common"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var produce_productCtr = Ctr{
|
var produce_productCtr = Ctr{
|
||||||
@ -23,18 +24,18 @@ var produce_productCtr = Ctr{
|
|||||||
|
|
||||||
where := Map{}
|
where := Map{}
|
||||||
if id != 0 {
|
if id != 0 {
|
||||||
where["id"] = id
|
where["produce_product.id"] = id
|
||||||
} else {
|
} else {
|
||||||
where["sn"] = sn
|
where["produce_product.sn"] = sn
|
||||||
}
|
}
|
||||||
|
|
||||||
re := that.Db.Get("produce_product",
|
re := that.Db.Get("produce_product",
|
||||||
|
|
||||||
Map{"[><]product": "product_spot_check.product_id=product.id",
|
Map{"[><]product": "produce_product.product_id=product.id",
|
||||||
"[><]produce": "product_spot_check.produce_id=produce.id",
|
"[><]produce": "produce_product.produce_id=produce.id",
|
||||||
},
|
},
|
||||||
"id,img,product_id,product.name AS product_name,admin_id,"+
|
"produce_product.id,produce_product.product_id,product.name AS product_name,produce_product.admin_id,"+
|
||||||
"modify_time,state,rule,produce_id,produce.name AS produce_name", where)
|
"produce_product.modify_time,produce_product.state,product.rule_spot_check,produce_product.produce_id,produce.name AS produce_name", where)
|
||||||
|
|
||||||
if re == nil {
|
if re == nil {
|
||||||
that.Display(4, "找不到对应信息")
|
that.Display(4, "找不到对应信息")
|
||||||
@ -43,4 +44,51 @@ var produce_productCtr = Ctr{
|
|||||||
|
|
||||||
that.Display(0, re)
|
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)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -73,18 +73,36 @@ var productCtr = Ctr{
|
|||||||
}
|
}
|
||||||
|
|
||||||
id := ObjToInt(that.Req.FormValue("id"))
|
id := ObjToInt(that.Req.FormValue("id"))
|
||||||
|
//抽检更新
|
||||||
ruleSpotCheck := that.Req.FormValue("rule_spot_check")
|
ruleSpotCheck := that.Req.FormValue("rule_spot_check")
|
||||||
|
if ruleSpotCheck != "" {
|
||||||
|
spotCheckPercentage := ObjToInt(that.Req.FormValue("spot_check_percentage"))
|
||||||
if id == 0 || ruleSpotCheck == "" {
|
if id == 0 || ruleSpotCheck == "" {
|
||||||
that.Display(3, "请求参数不足,请检查参数")
|
that.Display(3, "请求参数不足,请检查参数")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
re := that.Db.Update("product", Map{"rule_spot_check": ruleSpotCheck, "modify_time": time.Now().Unix()}, Map{"id": id})
|
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 {
|
if re == 0 {
|
||||||
that.Display(4, "更新失败,无法更新抽检参数")
|
that.Display(4, "更新失败,无法更新抽检参数")
|
||||||
return
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
that.Display(0, "更新成功")
|
that.Display(0, "更新成功")
|
||||||
},
|
},
|
||||||
|
@ -44,37 +44,39 @@ var product_spot_checkCtr = Ctr{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
img := that.Req.FormValue("img")
|
//img := that.Req.FormValue("img")
|
||||||
rule := that.Req.FormValue("rule")
|
sn := that.Req.FormValue("sn")
|
||||||
|
rule := that.Req.FormValue("rule_spot_check")
|
||||||
|
description := that.Req.FormValue("description")
|
||||||
produceProductId := ObjToInt(that.Req.FormValue("produce_product_id"))
|
produceProductId := ObjToInt(that.Req.FormValue("produce_product_id"))
|
||||||
|
|
||||||
count := ObjToInt(that.Req.FormValue("count"))
|
//count := ObjToInt(that.Req.FormValue("count"))
|
||||||
state := ObjToInt(that.Req.FormValue("state"))
|
state := ObjToInt(that.Req.FormValue("state"))
|
||||||
if rule == "" || produceProductId == 0 || count == 0 {
|
if rule == "" || produceProductId == 0 {
|
||||||
that.Display(3, "参数不足,请补充参数")
|
that.Display(3, "参数不足,请补充参数")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if state > 0 {
|
|
||||||
count = -count
|
|
||||||
}
|
|
||||||
produceProduct := that.Db.Get("produce_product", "*", Map{"id": produceProductId})
|
produceProduct := that.Db.Get("produce_product", "*", Map{"id": produceProductId})
|
||||||
|
|
||||||
that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+" + ObjToStr(count),
|
that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+1",
|
||||||
"spot_check_saved[#]": "spot_check_saved+" + ObjToStr(count)},
|
"spot_check_saved[#]": "spot_check_saved+1"},
|
||||||
Map{"id": produceProduct.GetCeilInt("product_id")})
|
Map{"id": produceProduct.GetCeilInt("product_id")})
|
||||||
|
|
||||||
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+" + ObjToStr(count),
|
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1",
|
||||||
"spot_check_saved[#]": "spot_check_saved+" + ObjToStr(count)},
|
"spot_check_saved[#]": "spot_check_saved+1"},
|
||||||
Map{"id": produceProduct.GetCeilInt("produce_id")})
|
Map{"id": produceProduct.GetCeilInt("produce_id")})
|
||||||
|
|
||||||
data := Map{
|
data := Map{
|
||||||
"img": img,
|
"sn": sn,
|
||||||
"rule": rule,
|
"rule": rule,
|
||||||
"admin_id": adminID,
|
"admin_id": adminID,
|
||||||
"create_time": time.Now().Unix(),
|
"create_time": time.Now().Unix(),
|
||||||
"modify_time": time.Now().Unix(),
|
"modify_time": time.Now().Unix(),
|
||||||
|
"product_id": produceProduct.GetCeilInt("product_id"),
|
||||||
"produce_id": produceProduct.GetCeilInt("produce_id"),
|
"produce_id": produceProduct.GetCeilInt("produce_id"),
|
||||||
"produce_product_id": produceProductId,
|
"produce_product_id": produceProductId,
|
||||||
|
"description": description,
|
||||||
"state": state,
|
"state": state,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id": "ea99a21b92f2b639eaaceae31dfd8499",
|
"id": "7b1c0ebec5cc5b407bcd243c54d45d10",
|
||||||
"label": "HoTime管理平台",
|
"label": "HoTime管理平台",
|
||||||
"menus": [
|
"menus": [
|
||||||
{
|
{
|
||||||
@ -59,6 +59,42 @@
|
|||||||
"label": "原材料管理",
|
"label": "原材料管理",
|
||||||
"table": "material"
|
"table": "material"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "原材料管理",
|
||||||
|
"table": "material"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "原材料管理",
|
"label": "原材料管理",
|
||||||
"table": "material"
|
"table": "material"
|
||||||
@ -122,6 +158,42 @@
|
|||||||
"label": "生产计划",
|
"label": "生产计划",
|
||||||
"table": "produce"
|
"table": "produce"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "生产计划",
|
||||||
|
"table": "produce"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "生产计划",
|
"label": "生产计划",
|
||||||
"table": "produce"
|
"table": "produce"
|
||||||
@ -189,6 +261,42 @@
|
|||||||
"label": "成品管理",
|
"label": "成品管理",
|
||||||
"table": "product"
|
"table": "product"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "成品管理",
|
||||||
|
"table": "product"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "成品管理",
|
"label": "成品管理",
|
||||||
"table": "product"
|
"table": "product"
|
||||||
@ -1639,6 +1747,14 @@
|
|||||||
"sortable": true,
|
"sortable": true,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"value": "name"
|
"value": "name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "经办人",
|
||||||
|
"link": "admin",
|
||||||
|
"name": "admin_id",
|
||||||
|
"sortable": true,
|
||||||
|
"type": "number",
|
||||||
|
"value": "name"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"label": "生产成品",
|
"label": "生产成品",
|
||||||
@ -1836,6 +1952,14 @@
|
|||||||
"sortable": true,
|
"sortable": true,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"value": "name"
|
"value": "name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "抽检百分比",
|
||||||
|
"list": false,
|
||||||
|
"must": false,
|
||||||
|
"name": "spot_check_percentage",
|
||||||
|
"sortable": true,
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"label": "成品管理",
|
"label": "成品管理",
|
||||||
@ -1990,6 +2114,13 @@
|
|||||||
"sortable": true,
|
"sortable": true,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"value": "name"
|
"value": "name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "备注信息",
|
||||||
|
"list": false,
|
||||||
|
"must": false,
|
||||||
|
"name": "description",
|
||||||
|
"type": "text"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"label": "质检管理",
|
"label": "质检管理",
|
||||||
@ -2254,6 +2385,13 @@
|
|||||||
"sortable": true,
|
"sortable": true,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"value": "sn"
|
"value": "sn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "备注信息",
|
||||||
|
"list": false,
|
||||||
|
"must": false,
|
||||||
|
"name": "description",
|
||||||
|
"type": "text"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"label": "抽检管理",
|
"label": "抽检管理",
|
||||||
|
BIN
example/myhs.exe
BIN
example/myhs.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user