From a06efe5575d6c66f9fc6dca991ae40621cf3cfff Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期一, 13 十一月 2023 11:16:26 +0800 Subject: [PATCH] 修改文件服务器端口号 --- controllers/operation.go | 40 +++++++++++++++++++++++++++++++++++----- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 6ac7bae..ed353ff 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -1,11 +1,13 @@ package controllers import ( + "encoding/json" "errors" "fmt" "github.com/gin-gonic/gin" "github.com/shopspring/decimal" "gorm.io/gorm" + "os" "sort" "strconv" "time" @@ -13,6 +15,7 @@ "wms/extend/code" "wms/extend/util" "wms/models" + "wms/opa" "wms/pkg/logx" "wms/pkg/structx" "wms/request" @@ -254,7 +257,7 @@ util.ResponseFormat(c, code.Success, "淇敼鎴愬姛") } -// DeleteDevice +// Delete // // @Tags 鍏ュ簱/鍑哄簱 // @Summary 鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅 @@ -296,7 +299,7 @@ util.ResponseFormat(c, code.Success, "鍒犻櫎鎴愬姛") } -// DeleteDevice +// Finish // // @Tags 鍏ュ簱/鍑哄簱 // @Summary 鏇存敼璁板綍鐘舵�� @@ -489,8 +492,20 @@ if !ok { return errors.New("浜у搧绉嶇被寮傚父") } - if v.Amount.LessThan(value) { - return errors.New(fmt.Sprintf("浜у搧锛�%v,搴撳瓨锛�%v,鍑哄簱锛�%v,鏁伴噺涓嶅锛屾棤娉曞畬鎴愬嚭搴撴搷浣�", v.Name, v.Amount.String(), value.String())) + //todo 婕旂ず娴嬭瘯鏁版嵁 + data, err := os.ReadFile("conf/input.json") + if err != nil { + return errors.New("鏂囦欢璇诲彇澶辫触") + } + m := make(map[string]interface{}) + err = json.Unmarshal(data, &m) + if err != nil { + return errors.New("鏍煎紡杞崲澶辫触") + } + if opa.OpaCheck(c, m, "operation") { + if v.Amount.LessThan(value) { + return errors.New(fmt.Sprintf("浜у搧锛�%v,搴撳瓨锛�%v,鍑哄簱锛�%v,鏁伴噺涓嶅锛屾棤娉曞畬鎴愬嚭搴撴搷浣�", v.Name, v.Amount.String(), value.String())) + } } listProdt[k].Amount = listProdt[k].Amount.Sub(value) if err := tx.Save(listProdt[k]).Error; err != nil { @@ -667,7 +682,7 @@ util.ResponseFormat(c, code.Success, "鎿嶄綔鎴愬姛") } -// listTransfer +// ListTransfer // @Tags 鍏ュ簱/鍑哄簱 // @Summary 搴撳瓨璋冩嫧鍒楄〃 // @Produce application/json @@ -697,3 +712,18 @@ } util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) } + +// GetLogisticCompanyList +// @Tags 鍏ュ簱/鍑哄簱 +// @Summary 鑾峰彇鐗╂祦鍏徃鍒楄〃 +// @Produce application/json +// @Success 200 {object} util.ResponseList{data=[]models.LogisticCompany} "鎴愬姛" +// @Router /api-wms/v1/operation/getLogisticCompanyList [get] +func (slf OperationController) GetLogisticCompanyList(c *gin.Context) { + companies, err := models.NewLogisticCompanySearch().FindNotTotal() + if err != nil { + util.ResponseFormat(c, code.RequestError, "鏌ユ壘澶辫触:"+err.Error()) + return + } + util.ResponseFormat(c, code.Success, companies) +} -- Gitblit v1.8.0