Commit 685e2142 by Joneq

增加不同情景判断

parent cf22a880
......@@ -148,7 +148,7 @@ func addOrderImage(c *bm.Context) {
scan_str := c.Request.PostFormValue("scan_str")
image_src := c.Request.PostFormValue("image_src")
num,materialno := service.StoreErWeiMaGetData(scan_str)
num,materialno := service.StoreErWeiMaGetData(c,scan_str)
db,close,err := dao.NewDB()
if err != nil {
......@@ -171,13 +171,16 @@ func addOrderImage(c *bm.Context) {
_,err = db.Exec(c,"update `lie_erp_order` set scanqty = ? where id = ?",scanqty,id)
if image_src != "" {
imageArr := strings.Split(image_src,",")
for _,image_val := range imageArr {
_,err = db.Exec(c,"INSERT INTO `lie_order_goods_img` (`issuebillid`, `issueentryid`, `image_src`)VALUES(?,?,?)",issuebillid,issueentryid,image_val)
}
}
close()
c.JSON("添加成功",err)
c.JSON("添加成功",nil)
}
......@@ -259,7 +262,7 @@ func getOrderDetailId(c *bm.Context) {
var id int64
num,materialno := service.StoreErWeiMaGetData(scan_str)
num,materialno := service.StoreErWeiMaGetData(c,scan_str)
db,close,err := dao.NewDB()
......
package service
import (
"fmt"
"strconv"
"strings"
bm "github.com/go-kratos/kratos/pkg/net/http/blademaster"
)
//通过二维码字符串获取数量和物料编码
func StoreErWeiMaGetData(erweima string) (num int64,materialno string) {
func StoreErWeiMaGetData(c *bm.Context,erweima string) (num int64,materialno string) {
paramArr := strings.Split(erweima, "|")
if len(paramArr) < 5 {
ErrorReturn(c,"二维码参数不正常")
}
returnNum,_ :=strconv.ParseInt(paramArr[3], 10, 64)
fmt.Println(paramArr)
return returnNum,paramArr[4]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment