Explorar el Código

查采购/销售合同修改

zou.yingbin hace 4 años
padre
commit
5667aa7267
Se han modificado 4 ficheros con 38 adiciones y 13 borrados
  1. 5 1
      docs/docs.go
  2. 5 1
      docs/swagger.json
  3. 4 1
      docs/swagger.yaml
  4. 24 10
      models/ermcp3.go

+ 5 - 1
docs/docs.go

@@ -14702,6 +14702,10 @@ var doc = `{
                     "description": "保证金",
                     "type": "number"
                 },
+                "nickname": {
+                    "description": "账户昵称",
+                    "type": "string"
+                },
                 "payamount": {
                     "description": "已收付额(收款或付款)",
                     "type": "number"
@@ -15739,7 +15743,7 @@ var doc = `{
                     "description": "品类列表(仓单标准)",
                     "type": "array",
                     "items": {
-                        "$ref": "#/definitions/models.ErmcpWrstandard"
+                        "$ref": "#/definitions/models.Ermcp3Wrstandard"
                     }
                 },
                 "goodslist": {

+ 5 - 1
docs/swagger.json

@@ -14686,6 +14686,10 @@
                     "description": "保证金",
                     "type": "number"
                 },
+                "nickname": {
+                    "description": "账户昵称",
+                    "type": "string"
+                },
                 "payamount": {
                     "description": "已收付额(收款或付款)",
                     "type": "number"
@@ -15723,7 +15727,7 @@
                     "description": "品类列表(仓单标准)",
                     "type": "array",
                     "items": {
-                        "$ref": "#/definitions/models.ErmcpWrstandard"
+                        "$ref": "#/definitions/models.Ermcp3Wrstandard"
                     }
                 },
                 "goodslist": {

+ 4 - 1
docs/swagger.yaml

@@ -4140,6 +4140,9 @@ definitions:
       margin:
         description: 保证金
         type: number
+      nickname:
+        description: 账户昵称
+        type: string
       payamount:
         description: 已收付额(收款或付款)
         type: number
@@ -4906,7 +4909,7 @@ definitions:
       gmlist:
         description: 品类列表(仓单标准)
         items:
-          $ref: '#/definitions/models.ErmcpWrstandard'
+          $ref: '#/definitions/models.Ermcp3Wrstandard'
         type: array
       goodslist:
         description: 关联交易商品列表

+ 24 - 10
models/ermcp3.go

@@ -202,7 +202,7 @@ func (r *ErmcpRelatedGoods) GetData() ([]ErmcpRelatedGoods, error) {
 // ErmcpDeliveryGoodsDetail 现货商品详情
 type ErmcpDeliveryGoodsDetail struct {
 	Data      ErmcpDeliveryGoods  `json:"data"`      // 现货商品基本信息(交割品种)
-	GmList    []ErmcpWrstandard   `json:"gmlist"`    // 品类列表(仓单标准)
+	GmList    []Ermcp3Wrstandard  `json:"gmlist"`    // 品类列表(仓单标准)
 	GbList    []Ermcp3Brand       `json:"gblist"`    // 品牌列表
 	WrsList   []WRSConverTDetail  `json:"wrslist"`   // 套保信息列表
 	GoodsList []ErmcpRelatedGoods `json:"goodslist"` // 关联交易商品列表
@@ -210,7 +210,7 @@ type ErmcpDeliveryGoodsDetail struct {
 	QryTradeGoods int32 `json:"-"` // 是否查询关联交易商品 1-查询
 }
 
-func (r *ErmcpDeliveryGoodsDetail) addGmList(lst []ErmcpWrstandard) {
+func (r *ErmcpDeliveryGoodsDetail) addGmList(lst []Ermcp3Wrstandard) {
 	for i := range lst {
 		if lst[i].DELIVERYGOODSID == r.Data.DELIVERYGOODSID {
 			r.GmList = append(r.GmList, lst[i])
@@ -256,16 +256,16 @@ func (r *ErmcpDeliveryGoodsDetail) GetDataEx() (interface{}, error) {
 	// 基本信息
 	for i := range data {
 		val := ErmcpDeliveryGoodsDetail{Data: data[i],
-			GmList: make([]ErmcpWrstandard, 0), GbList: make([]Ermcp3Brand, 0),
+			GmList: make([]Ermcp3Wrstandard, 0), GbList: make([]Ermcp3Brand, 0),
 			WrsList: make([]WRSConverTDetail, 0), GoodsList: make([]ErmcpRelatedGoods, 0),
 		}
 		sData = append(sData, val)
 	}
 	//品类/品牌/套保信息
-	gm := ErmcpWrstandard{AREAUSERID: int(r.Data.AREAUSERID), DELIVERYGOODSID: r.Data.DELIVERYGOODSID, ISVALID: 1}
+	gm := Ermcp3Wrstandard{AREAUSERID: int(r.Data.AREAUSERID), DELIVERYGOODSID: r.Data.DELIVERYGOODSID, ISVALID: 1}
 	gb := Ermcp3Brand{DELIVERYGOODSID: r.Data.DELIVERYGOODSID}
 	WrsC := WRSConverTDetail{DELIVERYGOODSID: r.Data.DELIVERYGOODSID}
-	gmLst, _ := gm.GetData()
+	gmLst, _ := gm.GetDataEx()
 	gbLst, _ := gb.GetData()
 	wrsLst, _ := WrsC.GetData()
 	var goodLst []ErmcpRelatedGoods
@@ -275,7 +275,7 @@ func (r *ErmcpDeliveryGoodsDetail) GetDataEx() (interface{}, error) {
 	}
 
 	for i := range sData {
-		sData[i].addGmList(gmLst)
+		sData[i].addGmList(gmLst.([]Ermcp3Wrstandard))
 		sData[i].addGbList(gbLst)
 		sData[i].addWrsList(wrsLst)
 		sData[i].addGoodsList(goodLst)
@@ -505,6 +505,7 @@ type Ermcp3SellBuyContract struct {
 	WRSTANDARDID       int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`             // 品类ID
 	WRSTANDARDNAME     string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`         // 品类名称
 	WRSTANDARDCODE     string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`         // 品类代码
+	NICKNAME           string  `json:"nickname"`                                        // 账户昵称
 
 	// 筛选条件
 	QryType   int32 `json:"-"` // 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
@@ -519,10 +520,10 @@ func (r *Ermcp3SellBuyContract) calc() {
 	r.PreInvoiceAmount = r.InvoiceAmount - r.TotalAmount
 	if r.Contracttype == 1 {
 		//采购合同, 取销售方名称
-		r.AccountName = mtpcache.GetUserNameByUserId(r.SELLUSERID)
+		r.AccountName, r.NICKNAME = mtpcache.GetUserNameAndNickName(r.SELLUSERID)
 	} else {
 		//销售合同, 取采购方名称
-		r.AccountName = mtpcache.GetUserNameByUserId(r.BUYUSERID)
+		r.AccountName, r.NICKNAME = mtpcache.GetUserNameAndNickName(r.BUYUSERID)
 	}
 }
 
@@ -608,11 +609,24 @@ func (r *Ermcp3SellBuyContract) buildSql() string {
 		// 企业成员
 		sqlId.Join(fmt.Sprintf(" and %v in(t.saleuserid, t.tradeuserid, t.meruserid)", r.OwnUserId))
 	}
-	var tmp = Ermcp3Contract{QryType: r.QryType}
-	status := tmp.getQryTypeStatus()
+
+	var status string
+	nQueryType := r.QryType
+	if 1 == nQueryType {
+		// 全部
+		status = "2,3"
+	} else if 2 == nQueryType {
+		// 待点价
+		status = "2"
+	} else {
+		// 履约
+		status = "2"
+	}
+
 	if len(status) > 0 {
 		sqlId.Join(fmt.Sprintf(" and t.contractstatus in (%v)", status))
 	}
+	sqlId.JoinEx(r.QryType == 2, " and t.qty - t.pricedqty > 0 and t.pricetype !=1")
 	return sqlId.String()
 }