From 541486c20ad74c2bcbb2e42137a116981b313787 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期一, 25 九月 2023 10:18:06 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- controllers/operation.go | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 8eca517..872fb4c 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -7,6 +7,7 @@ "github.com/shopspring/decimal" "gorm.io/gorm" "strconv" + "time" "wms/constvar" "wms/extend/code" "wms/extend/util" @@ -47,6 +48,7 @@ } params.Status = constvar.OperationStatus_Ready + params.Number = strconv.FormatInt(time.Now().Unix(), 10) if err := models.NewOperationSearch().Create(¶ms); err != nil { logx.Errorf("Operation create err: %v", err) util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) @@ -113,9 +115,9 @@ if v.ProductId == "" { return errors.New("productID涓虹┖") } - if v.ProductName == "" { - return errors.New("浜у搧鍚嶇О寮傚父") - } + //if v.ProductName == "" { + // return errors.New("浜у搧鍚嶇О寮傚父") + //} if v.Amount.IsNegative() { return errors.New("浜у搧鏁伴噺鍑洪敊") } @@ -156,7 +158,6 @@ } util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) - } func (slf OperationController) CheckListParams(params *request.OperationList) error { @@ -318,7 +319,7 @@ if value, ok := mapProdt[v.ID]; !ok { return errors.New("浜у搧绉嶇被寮傚父") } else { - listProdt[k].Amount.Add(value) + listProdt[k].Amount = listProdt[k].Amount.Add(value) if err := tx.Save(listProdt[k]).Error; err != nil { return err } @@ -333,7 +334,7 @@ if v.Amount.LessThan(value) { return errors.New(fmt.Sprintf("浜у搧锛�%v,搴撳瓨锛�%v,鍑哄簱锛�%v,鏁伴噺涓嶅锛屾棤娉曞畬鎴愬嚭搴撴搷浣�", v.Name, v.Amount.String(), value.String())) } - listProdt[k].Amount.Sub(value) + listProdt[k].Amount = listProdt[k].Amount.Sub(value) if err := tx.Save(listProdt[k]).Error; err != nil { return err } @@ -381,7 +382,5 @@ util.ResponseFormat(c, code.RequestError, "鏌ユ壘澶辫触:"+err.Error()) return } - util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) - } -- Gitblit v1.8.0