Commit ea7b4b9e by Joneq

提交代码

parent 7af016ed
Showing with 46 additions and 2 deletions
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"photo_taking/internal/dao" "photo_taking/internal/dao"
"photo_taking/internal/model" "photo_taking/internal/model"
"photo_taking/internal/service" "photo_taking/internal/service"
"strconv"
"strings" "strings"
) )
...@@ -45,6 +46,10 @@ func initRouter(e *bm.Engine) { ...@@ -45,6 +46,10 @@ func initRouter(e *bm.Engine) {
//获取订单信息 //获取订单信息
g.GET("/get_order_info/:order_id", getOrderInfo) g.GET("/get_order_info/:order_id", getOrderInfo)
//获取订单信息
g.POST("/cancel_order/:order_id", cancelOrder)
//提交明细信息 //提交明细信息
g.POST("/scan_order_detail",getOrderDetailId) g.POST("/scan_order_detail",getOrderDetailId)
//增加订单图片 //增加订单图片
...@@ -149,13 +154,52 @@ func getOrderInfo(c *bm.Context) { ...@@ -149,13 +154,52 @@ func getOrderInfo(c *bm.Context) {
} }
//取消订单
func cancelOrder(c *bm.Context) {
orderId,_ := c.Params.Get("order_id")
if orderId == "" {
service.ErrorReturn(c,"订单号不能为空")
}
db,close,err := dao.NewDB()
if err != nil {
service.ErrorReturn(c,err.Error())
}
_,err = db.Exec(c,"update lie_erp_order set scanqty = 0 where ordersn = ?",orderId)
if err != nil {
service.ErrorReturn(c,err.Error())
}
//查询数据库里面是否有该数据
orderAllInfo := service.SelectOrderInfoFromOrderId(c,orderId)
for _,v := range orderAllInfo {
_,err = db.Exec(c,"delete from lie_order_goods_img where issuebillid = ? and issueentryid = ? ",v.OrderInfo.Issuebillid,v.OrderInfo.Issueentryid)
}
if err != nil {
service.ErrorReturn(c,err.Error())
}
close()
c.JSON("取消成功",nil)
}
//增加订单图片 //增加订单图片
func addOrderImage(c *bm.Context) { func addOrderImage(c *bm.Context) {
id := c.Request.PostFormValue("id") id := c.Request.PostFormValue("id")
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(c,scan_str) var num int64
paramArr := strings.Split(scan_str, "|")
if len(paramArr) < 5 {
num = 0
}else{
num,_ =strconv.ParseInt(paramArr[3], 10, 64)
}
db,close,err := dao.NewDB() db,close,err := dao.NewDB()
if err != nil { if err != nil {
...@@ -167,7 +211,7 @@ func addOrderImage(c *bm.Context) { ...@@ -167,7 +211,7 @@ func addOrderImage(c *bm.Context) {
scanqty int64 scanqty int64
) )
err = db.QueryRow(c, "select scanqty,issuebillid,issueentryid from lie_erp_order where id = ? and materialno = ? ", id,materialno).Scan(&scanqty,&issuebillid,&issueentryid) err = db.QueryRow(c, "select scanqty,issuebillid,issueentryid from lie_erp_order where id = ? ", id).Scan(&scanqty,&issuebillid,&issueentryid)
if issuebillid == "" { if issuebillid == "" {
close() close()
......
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