From c4e6bf4b1fdb872ba514ab03efa3c53333d1a120 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 18 三月 2024 10:11:03 +0800
Subject: [PATCH] 确认发货
---
service/salesDetails.go | 4
constvar/salesDetails.go | 2
api/v1/salesDetails.go | 31 +++
model/request/salesDetails.go | 12 +
model/response/salesDetails.go | 26 +-
router/salesDetails.go | 1
docs/swagger.yaml | 114 ++++++++++--
docs/docs.go | 166 +++++++++++++++---
docs/swagger.json | 166 +++++++++++++++---
9 files changed, 434 insertions(+), 88 deletions(-)
diff --git a/api/v1/salesDetails.go b/api/v1/salesDetails.go
index b57b78d..6d60f95 100644
--- a/api/v1/salesDetails.go
+++ b/api/v1/salesDetails.go
@@ -376,6 +376,37 @@
ctx.OkWithDetailed(storeList)
}
+// ConfirmOutput
+// @Tags SalesDetails
+// @Summary 纭鍙戣揣
+// @Produce application/json
+// @Param object body request.ConfirmOutput true "鏄庣粏缂栫爜"
+// @Success 200 {object} response.ListResponse
+// @Router /api/salesDetails/confirmOutput [post]
+func (s *SalesDetailsApi) ConfirmOutput(c *gin.Context) {
+ var params request.ConfirmOutput
+ ctx, ok := contextx.NewContext(c, ¶ms)
+ if !ok {
+ return
+ }
+ if len(params.Products) == 0 || params.SaleDetailNumber == "" {
+ ctx.FailWithMsg(ecode.ParamsErr, "鍙傛暟缂哄け")
+ return
+ }
+ var flag bool
+ for _, p := range params.Products {
+ if p.OutputAmount.GreaterThan(decimal.Zero) {
+ flag = true
+ }
+ }
+ if !flag {
+ ctx.FailWithMsg(ecode.ParamsErr, "鍙戣揣鏁伴噺缂哄け")
+ return
+ }
+
+ ctx.OkWithDetailed(nil)
+}
+
// GetDeliveryList
// @Tags SalesDetails
// @Summary 鍙戣揣鏄庣粏
diff --git a/constvar/salesDetails.go b/constvar/salesDetails.go
index 667a72d..0c2d613 100644
--- a/constvar/salesDetails.go
+++ b/constvar/salesDetails.go
@@ -22,5 +22,5 @@
)
func (s SalesDetailsStatus) Valid() bool {
- return s == WaitConfirmed || s == WaitOutbound || s == OverOutbound || s == OverCLose
+ return s == WaitConfirmed || s == WaitOutbound || s == OverOutbound || s == OverCLose || s == WaitDecompose || s == InStock
}
diff --git a/docs/docs.go b/docs/docs.go
index 35d02d0..e2c9bbf 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -7008,6 +7008,36 @@
}
}
},
+ "/api/salesDetails/confirmOutput": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SalesDetails"
+ ],
+ "summary": "纭鍙戣揣",
+ "parameters": [
+ {
+ "description": "鏄庣粏缂栫爜",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.ConfirmOutput"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/response.ListResponse"
+ }
+ }
+ }
+ }
+ },
"/api/salesDetails/delete": {
"delete": {
"produces": [
@@ -7154,34 +7184,6 @@
"SalesDetails"
],
"summary": "鑾峰彇浜у搧鍙戣揣淇℃伅",
- "parameters": [
- {
- "type": "string",
- "description": "鏄庣粏缂栫爜",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/response.ListResponse"
- }
- }
- }
- }
- },
- "/api/salesDetails/getSalesDetailsProductInfo/{number}": {
- "get": {
- "produces": [
- "application/json"
- ],
- "tags": [
- "SalesDetails"
- ],
- "summary": "鑾峰彇閿�鍞槑缁嗕骇鍝佷俊鎭�",
"parameters": [
{
"type": "string",
@@ -15533,6 +15535,33 @@
}
}
},
+ "request.ConfirmOutput": {
+ "type": "object",
+ "properties": {
+ "products": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/request.ConfirmOutputProducts"
+ }
+ },
+ "saleDetailNumber": {
+ "type": "string"
+ }
+ }
+ },
+ "request.ConfirmOutputProducts": {
+ "type": "object",
+ "properties": {
+ "number": {
+ "description": "浜у搧缂栧彿",
+ "type": "string"
+ },
+ "outputAmount": {
+ "description": "鏈鍙戣揣鏁伴噺",
+ "type": "number"
+ }
+ }
+ },
"request.Contact": {
"type": "object",
"properties": {
@@ -19430,6 +19459,12 @@
"$ref": "#/definitions/response.OutsourcingInfo"
}
},
+ "productInfo": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.SalesDetailsProductInfo"
+ }
+ },
"purchaseInfo": {
"type": "array",
"items": {
@@ -19785,6 +19820,81 @@
}
}
},
+ "response.SalesDetailsProductInfo": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "璁㈠崟鏁伴噺",
+ "type": "number"
+ },
+ "cost": {
+ "description": "浜у搧鎴愭湰",
+ "type": "string"
+ },
+ "deliveryAmount": {
+ "description": "鍙戣揣鏁伴噺",
+ "type": "integer"
+ },
+ "finishAmount": {
+ "description": "瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "makeAmount": {
+ "description": "鍒堕�犳暟閲�",
+ "type": "integer"
+ },
+ "makeFinishAmount": {
+ "description": "鍒堕�犲畬鎴愭暟閲�",
+ "type": "integer"
+ },
+ "margin": {
+ "description": "姣涘埄鐜�",
+ "type": "string"
+ },
+ "outsourcingAmount": {
+ "description": "濮斿鏁伴噺",
+ "type": "integer"
+ },
+ "outsourcingFinishAmount": {
+ "description": "濮斿瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "price": {
+ "description": "浜у搧浠锋牸",
+ "type": "number"
+ },
+ "productId": {
+ "type": "string"
+ },
+ "productName": {
+ "type": "string"
+ },
+ "profit": {
+ "description": "姣涘埄",
+ "type": "string"
+ },
+ "purchaseAmount": {
+ "description": "閲囪喘鏁伴噺",
+ "type": "integer"
+ },
+ "purchaseFinishAmount": {
+ "description": "閲囪喘瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "specs": {
+ "description": "鐗╂枡瑙勬牸",
+ "type": "string"
+ },
+ "total": {
+ "description": "浜у搧鎬讳环",
+ "type": "number"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
"response.SalesDetailsResponse": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 857484f..8309fa6 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -6996,6 +6996,36 @@
}
}
},
+ "/api/salesDetails/confirmOutput": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SalesDetails"
+ ],
+ "summary": "纭鍙戣揣",
+ "parameters": [
+ {
+ "description": "鏄庣粏缂栫爜",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.ConfirmOutput"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/response.ListResponse"
+ }
+ }
+ }
+ }
+ },
"/api/salesDetails/delete": {
"delete": {
"produces": [
@@ -7142,34 +7172,6 @@
"SalesDetails"
],
"summary": "鑾峰彇浜у搧鍙戣揣淇℃伅",
- "parameters": [
- {
- "type": "string",
- "description": "鏄庣粏缂栫爜",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/response.ListResponse"
- }
- }
- }
- }
- },
- "/api/salesDetails/getSalesDetailsProductInfo/{number}": {
- "get": {
- "produces": [
- "application/json"
- ],
- "tags": [
- "SalesDetails"
- ],
- "summary": "鑾峰彇閿�鍞槑缁嗕骇鍝佷俊鎭�",
"parameters": [
{
"type": "string",
@@ -15521,6 +15523,33 @@
}
}
},
+ "request.ConfirmOutput": {
+ "type": "object",
+ "properties": {
+ "products": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/request.ConfirmOutputProducts"
+ }
+ },
+ "saleDetailNumber": {
+ "type": "string"
+ }
+ }
+ },
+ "request.ConfirmOutputProducts": {
+ "type": "object",
+ "properties": {
+ "number": {
+ "description": "浜у搧缂栧彿",
+ "type": "string"
+ },
+ "outputAmount": {
+ "description": "鏈鍙戣揣鏁伴噺",
+ "type": "number"
+ }
+ }
+ },
"request.Contact": {
"type": "object",
"properties": {
@@ -19418,6 +19447,12 @@
"$ref": "#/definitions/response.OutsourcingInfo"
}
},
+ "productInfo": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.SalesDetailsProductInfo"
+ }
+ },
"purchaseInfo": {
"type": "array",
"items": {
@@ -19773,6 +19808,81 @@
}
}
},
+ "response.SalesDetailsProductInfo": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "璁㈠崟鏁伴噺",
+ "type": "number"
+ },
+ "cost": {
+ "description": "浜у搧鎴愭湰",
+ "type": "string"
+ },
+ "deliveryAmount": {
+ "description": "鍙戣揣鏁伴噺",
+ "type": "integer"
+ },
+ "finishAmount": {
+ "description": "瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "makeAmount": {
+ "description": "鍒堕�犳暟閲�",
+ "type": "integer"
+ },
+ "makeFinishAmount": {
+ "description": "鍒堕�犲畬鎴愭暟閲�",
+ "type": "integer"
+ },
+ "margin": {
+ "description": "姣涘埄鐜�",
+ "type": "string"
+ },
+ "outsourcingAmount": {
+ "description": "濮斿鏁伴噺",
+ "type": "integer"
+ },
+ "outsourcingFinishAmount": {
+ "description": "濮斿瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "price": {
+ "description": "浜у搧浠锋牸",
+ "type": "number"
+ },
+ "productId": {
+ "type": "string"
+ },
+ "productName": {
+ "type": "string"
+ },
+ "profit": {
+ "description": "姣涘埄",
+ "type": "string"
+ },
+ "purchaseAmount": {
+ "description": "閲囪喘鏁伴噺",
+ "type": "integer"
+ },
+ "purchaseFinishAmount": {
+ "description": "閲囪喘瀹屾垚鏁伴噺",
+ "type": "integer"
+ },
+ "specs": {
+ "description": "鐗╂枡瑙勬牸",
+ "type": "string"
+ },
+ "total": {
+ "description": "浜у搧鎬讳环",
+ "type": "number"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
"response.SalesDetailsResponse": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 9f0261d..4980a47 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -3457,6 +3457,24 @@
required:
- ids
type: object
+ request.ConfirmOutput:
+ properties:
+ products:
+ items:
+ $ref: '#/definitions/request.ConfirmOutputProducts'
+ type: array
+ saleDetailNumber:
+ type: string
+ type: object
+ request.ConfirmOutputProducts:
+ properties:
+ number:
+ description: 浜у搧缂栧彿
+ type: string
+ outputAmount:
+ description: 鏈鍙戣揣鏁伴噺
+ type: number
+ type: object
request.Contact:
properties:
birthday:
@@ -6117,6 +6135,10 @@
items:
$ref: '#/definitions/response.OutsourcingInfo'
type: array
+ productInfo:
+ items:
+ $ref: '#/definitions/response.SalesDetailsProductInfo'
+ type: array
purchaseInfo:
items:
$ref: '#/definitions/response.Purchase'
@@ -6348,6 +6370,61 @@
items:
$ref: '#/definitions/model.SaleType'
type: array
+ type: object
+ response.SalesDetailsProductInfo:
+ properties:
+ amount:
+ description: 璁㈠崟鏁伴噺
+ type: number
+ cost:
+ description: 浜у搧鎴愭湰
+ type: string
+ deliveryAmount:
+ description: 鍙戣揣鏁伴噺
+ type: integer
+ finishAmount:
+ description: 瀹屾垚鏁伴噺
+ type: integer
+ makeAmount:
+ description: 鍒堕�犳暟閲�
+ type: integer
+ makeFinishAmount:
+ description: 鍒堕�犲畬鎴愭暟閲�
+ type: integer
+ margin:
+ description: 姣涘埄鐜�
+ type: string
+ outsourcingAmount:
+ description: 濮斿鏁伴噺
+ type: integer
+ outsourcingFinishAmount:
+ description: 濮斿瀹屾垚鏁伴噺
+ type: integer
+ price:
+ description: 浜у搧浠锋牸
+ type: number
+ productId:
+ type: string
+ productName:
+ type: string
+ profit:
+ description: 姣涘埄
+ type: string
+ purchaseAmount:
+ description: 閲囪喘鏁伴噺
+ type: integer
+ purchaseFinishAmount:
+ description: 閲囪喘瀹屾垚鏁伴噺
+ type: integer
+ specs:
+ description: 鐗╂枡瑙勬牸
+ type: string
+ total:
+ description: 浜у搧鎬讳环
+ type: number
+ unit:
+ description: 鍗曚綅
+ type: string
type: object
response.SalesDetailsResponse:
properties:
@@ -10808,6 +10885,25 @@
summary: 娣诲姞閿�鍞槑缁�
tags:
- SalesDetails
+ /api/salesDetails/confirmOutput:
+ post:
+ parameters:
+ - description: 鏄庣粏缂栫爜
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.ConfirmOutput'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/response.ListResponse'
+ summary: 纭鍙戣揣
+ tags:
+ - SalesDetails
/api/salesDetails/delete:
delete:
parameters:
@@ -10911,24 +11007,6 @@
schema:
$ref: '#/definitions/response.ListResponse'
summary: 鑾峰彇浜у搧鍙戣揣淇℃伅
- tags:
- - SalesDetails
- /api/salesDetails/getSalesDetailsProductInfo/{number}:
- get:
- parameters:
- - description: 鏄庣粏缂栫爜
- in: path
- name: number
- required: true
- type: string
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/response.ListResponse'
- summary: 鑾峰彇閿�鍞槑缁嗕骇鍝佷俊鎭�
tags:
- SalesDetails
/api/salesDetails/list:
diff --git a/model/request/salesDetails.go b/model/request/salesDetails.go
index ed2b4b6..29f6fb2 100644
--- a/model/request/salesDetails.go
+++ b/model/request/salesDetails.go
@@ -3,6 +3,7 @@
import (
"aps_crm/constvar"
"aps_crm/model"
+ "github.com/shopspring/decimal"
)
type AddSalesDetails struct {
@@ -55,3 +56,14 @@
ClientId int `json:"clientId"` //瀹㈡埛id
Number string `json:"number"` //閿�鍞槑缁嗗崟鍙�
}
+
+// ConfirmOutput 鍙戣揣
+type ConfirmOutput struct {
+ SaleDetailNumber string `json:"saleDetailNumber"`
+ Products []ConfirmOutputProducts `json:"products"`
+}
+
+type ConfirmOutputProducts struct {
+ Number string `json:"number"` //浜у搧缂栧彿
+ OutputAmount decimal.Decimal `json:"outputAmount"` //鏈鍙戣揣鏁伴噺
+}
diff --git a/model/response/salesDetails.go b/model/response/salesDetails.go
index 515af69..8644c04 100644
--- a/model/response/salesDetails.go
+++ b/model/response/salesDetails.go
@@ -69,20 +69,20 @@
AvailableNumber string `json:"availableNumber"` //鍙敤搴撳瓨
}
type OutputInfo struct {
- Number string `json:"number"`
- Name string `json:"name"`
+ Number string `json:"number"` //浜у搧缂栫爜
+ Name string `json:"name"` //浜у搧鍚嶇О
OrderAmount string `json:"orderAmount"` //璁㈠崟鏁伴噺
- Unit string `json:"unit"`
- Invoice string `json:"invoice"` //鍙戣揣鍗�
- Carrier string `json:"carrier"` //鎵胯繍鍟�
- Waybill string `json:"waybill"` //杩愬崟鍙�
- SalePrice string `json:"salePrice"` //閿�鍞崟浠�
- Valorem string `json:"valorem"` //浠风◣鍚堣
- Warehouse string `json:"warehouse"`
- Amount string `json:"amount"` //鍦ㄥ簱鏁伴噺
- Status int `json:"status"` //0灏辩华 1瀹屾垚
- Specs string `json:"specs"` //瑙勬牸
- CreateTime string `json:"createTime"` //鍒涘缓鏃堕棿
+ Unit string `json:"unit"` //鍗曚綅
+ Invoice string `json:"invoice"` //鍙戣揣鍗�
+ Carrier string `json:"carrier"` //鎵胯繍鍟�
+ Waybill string `json:"waybill"` //杩愬崟鍙�
+ SalePrice string `json:"salePrice"` //閿�鍞崟浠�
+ Valorem string `json:"valorem"` //浠风◣鍚堣
+ Warehouse string `json:"warehouse"` //浠撳簱鍚嶇О
+ Amount string `json:"amount"` //鍙戣揣鏁伴噺
+ Status int `json:"status"` //0灏辩华 1瀹屾垚
+ Specs string `json:"specs"` //瑙勬牸
+ CreateTime string `json:"createTime"` //鍒涘缓鏃堕棿
}
type StoreInfo struct {
diff --git a/router/salesDetails.go b/router/salesDetails.go
index e50ac57..75e32aa 100644
--- a/router/salesDetails.go
+++ b/router/salesDetails.go
@@ -24,6 +24,7 @@
salesDetailsRouter.POST("getDeliveryPrepareInfo", salesDetailsApi.GetDeliveryPrepareInfo) // 鍙戣揣鍑嗗
salesDetailsRouter.POST("getDeliveryList", salesDetailsApi.GetDeliveryList) // 鍙戣揣鏄庣粏
+ salesDetailsRouter.POST("confirmOutput", salesDetailsApi.ConfirmOutput) // 纭鍙戣揣
}
}
diff --git a/service/salesDetails.go b/service/salesDetails.go
index eb7933f..d49170c 100644
--- a/service/salesDetails.go
+++ b/service/salesDetails.go
@@ -137,6 +137,10 @@
return model.NewSalesDetailsSearch().SetId(saleDetailID).SetPreload(true).First()
}
+func (SalesDetailsService) GetSalesDetailsByNumber(number string) (*model.SalesDetails, error) {
+ return model.NewSalesDetailsSearch().SetNumber(number).SetPreload(true).First()
+}
+
func (SalesDetailsService) GetDeliveryOrder(saleDetailID int) ([]*model.DeliveryOrder, error) {
// get contact list
orders, err := model.NewDeliveryOrderSearch().SetSalesDetailsID(saleDetailID).FindAll()
--
Gitblit v1.8.0