From f64d02a1759906df7ea637913df1f4eec93811c7 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期五, 24 十一月 2023 14:57:58 +0800
Subject: [PATCH] 查询指定操作详情

---
 controllers/operation.go |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index 143c959..aafdf87 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -29,6 +29,7 @@
 	"wms/proto/purchase_wms"
 	"wms/proto/supplier"
 	"wms/request"
+	"wms/service"
 	"wms/utils/http"
 	"wms/utils/upload"
 )
@@ -169,6 +170,29 @@
 	}
 
 	return nil
+}
+
+// GetOperationInfo
+// @Tags      鍏ュ簱/鍑哄簱
+// @Summary   鍏ュ簱/鍑哄簱鍒楄〃
+// @Produce   application/json
+//
+//	@Param		number	path		string			true	"鍗曞彿"
+//
+// @Success   200 {object} util.Response	"鎴愬姛"
+// @Router    /api-wms/v1/operation/getOperationInfo/{number} [post]
+func (slf OperationController) GetOperationInfo(c *gin.Context) {
+	number := c.Param("number")
+	if number == "" {
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屽弬鏁颁笉鑳戒负绌�")
+		return
+	}
+	operation, err := models.NewOperationSearch().SetNumber(number).SetPreload(true).First()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, err.Error())
+		return
+	}
+	util.ResponseFormat(c, code.Success, operation)
 }
 
 // List
@@ -716,6 +740,7 @@
 				OperationTypeId:   operation.OperationTypeId,
 				OperationTypeName: operation.OperationTypeName,
 				OperationId:       operation.Id,
+				ProductId:         v.ProductId,
 				ProductName:       v.Product.Name,
 				Amount:            v.Amount,
 				Unit:              v.Product.Unit,
@@ -731,6 +756,9 @@
 	if err := db.Model(&models.MoveHistory{}).Create(&histories).Error; err != nil {
 		return err
 	}
+	for _, history := range histories {
+		service.AddNewHistoryReportRecord(history.Id)
+	}
 	return nil
 }
 

--
Gitblit v1.8.0