Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
photo_taking
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
685e2142
authored
Sep 03, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加不同情景判断
parent
cf22a880
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
internal/server/http/server.go
internal/service/param_handle.go
internal/server/http/server.go
View file @
685e2142
...
@@ -148,7 +148,7 @@ func addOrderImage(c *bm.Context) {
...
@@ -148,7 +148,7 @@ func addOrderImage(c *bm.Context) {
scan_str
:=
c
.
Request
.
PostFormValue
(
"scan_str"
)
scan_str
:=
c
.
Request
.
PostFormValue
(
"scan_str"
)
image_src
:=
c
.
Request
.
PostFormValue
(
"image_src"
)
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
()
db
,
close
,
err
:=
dao
.
NewDB
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -171,13 +171,16 @@ func addOrderImage(c *bm.Context) {
...
@@ -171,13 +171,16 @@ func addOrderImage(c *bm.Context) {
_
,
err
=
db
.
Exec
(
c
,
"update `lie_erp_order` set scanqty = ? where id = ?"
,
scanqty
,
id
)
_
,
err
=
db
.
Exec
(
c
,
"update `lie_erp_order` set scanqty = ? where id = ?"
,
scanqty
,
id
)
imageArr
:=
strings
.
Split
(
image_src
,
","
)
for
_
,
image_val
:=
range
imageArr
{
if
image_src
!=
""
{
_
,
err
=
db
.
Exec
(
c
,
"INSERT INTO `lie_order_goods_img` (`issuebillid`, `issueentryid`, `image_src`)VALUES(?,?,?)"
,
issuebillid
,
issueentryid
,
image_val
)
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
()
close
()
c
.
JSON
(
"添加成功"
,
err
)
c
.
JSON
(
"添加成功"
,
nil
)
}
}
...
@@ -259,7 +262,7 @@ func getOrderDetailId(c *bm.Context) {
...
@@ -259,7 +262,7 @@ func getOrderDetailId(c *bm.Context) {
var
id
int64
var
id
int64
num
,
materialno
:=
service
.
StoreErWeiMaGetData
(
scan_str
)
num
,
materialno
:=
service
.
StoreErWeiMaGetData
(
c
,
scan_str
)
db
,
close
,
err
:=
dao
.
NewDB
()
db
,
close
,
err
:=
dao
.
NewDB
()
...
...
internal/service/param_handle.go
View file @
685e2142
package
service
package
service
import
(
import
(
"fmt"
"strconv"
"strconv"
"strings"
"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
,
"|"
)
paramArr
:=
strings
.
Split
(
erweima
,
"|"
)
if
len
(
paramArr
)
<
5
{
ErrorReturn
(
c
,
"二维码参数不正常"
)
}
returnNum
,
_
:=
strconv
.
ParseInt
(
paramArr
[
3
],
10
,
64
)
returnNum
,
_
:=
strconv
.
ParseInt
(
paramArr
[
3
],
10
,
64
)
fmt
.
Println
(
paramArr
)
return
returnNum
,
paramArr
[
4
]
return
returnNum
,
paramArr
[
4
]
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment