Procházet zdrojové kódy

1.增加查询履约详情接口
2.联调问题修改

zou.yingbin před 4 roky
rodič
revize
31896ec7ec
7 změnil soubory, kde provedl 690 přidání a 9 odebrání
  1. 17 0
      controllers/wrTrade2/qryWrTrade.go
  2. 198 1
      docs/docs.go
  3. 198 1
      docs/swagger.json
  4. 145 1
      docs/swagger.yaml
  5. 122 6
      models/wrTrade2.go
  6. 1 0
      routers/router.go
  7. 9 0
      utils/sqlUtils.go

+ 17 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -25,6 +25,7 @@ import (
 // @Param dgitemname query string false "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm"
 // @Param warehouseid query int false "仓库id(筛选条件)"
 // @Param deliverygoodsid query int false "品种id"
+// @Param wrstandardid query int false "品类id"
 // @Param wrfactortypeid query int false "仓单要素id"
 // @Param deliverymonth query string false "交收月(yyyy-mm) 仓单预售填写"
 // @Success 200 {array} models.WrOrderQuote
@@ -293,3 +294,19 @@ func QueryWrStandardFactoryItem(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryWrPerformancePlanStep
+// @Summary 查询履约信息详情
+// @Produce json
+// @Security ApiKeyAuth
+// @Param planid query int true "履约计划id(performanceplanid)"
+// @Success 200 {array} models.WrPerformancePlanStep
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryPerformancePlanStep [get]
+// @Tags 仓单贸易v2
+func QueryWrPerformancePlanStep(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrPerformancePlanStep{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 198 - 1
docs/docs.go

@@ -11180,6 +11180,12 @@ var doc = `{
                     },
                     {
                         "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"
@@ -11352,6 +11358,48 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryPerformancePlanStep": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询履约信息详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "履约计划id(performanceplanid)",
+                        "name": "planid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrPerformancePlanStep"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrFactorTypeInfo": {
             "get": {
                 "security": [
@@ -30563,7 +30611,7 @@ var doc = `{
                 },
                 "performanceplanid": {
                     "description": "履约计划ID(130+yyMMddHHmmss+xxxx)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "performancestatus": {
                     "description": "履约状态 -  1:初始化 2:正常 3:处理错误 4:违约待处理 5:违约处理中 6:完成 7.违约已完成 8:释放冻结失败 9:超时待处理 10:超时关闭",
@@ -30655,6 +30703,155 @@ var doc = `{
                 }
             }
         },
+        "models.WrPerformancePlanStep": {
+            "type": "object",
+            "properties": {
+                "delaydays": {
+                    "description": "延期申请天数",
+                    "type": "integer"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "结束日期",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "executeside": {
+                    "description": "步骤执行方 - 1:买方 2:卖方",
+                    "type": "integer"
+                },
+                "handlestatus": {
+                    "description": "处理状态 - 1:开始 2:结束 3:冻结请求 4:冻结返回成功 5:冻结返回失败 6:扣款请求 7:扣款返回成功 8:扣款返回失败 9:仓单转移请求 10:仓单转移返回成功 11:仓单转移返回失败 12:加钱请求 13:加钱返回成功 14:加钱返回失败 15:解冻仓单头寸请求 16:解冻仓单头寸返回成功 17:解冻仓单头寸返回失败 18:解冻库位请求 19:解冻库位返回成功 20:解冻库位返回失败",
+                    "type": "integer"
+                },
+                "isauto": {
+                    "description": "是否自动 - 0:不自动 1:自动",
+                    "type": "integer"
+                },
+                "islastreceivestep": {
+                    "description": "是否最后收款步骤 - 0:不是 1:是    (暂时不用,由服务自己判断是否为最后一步付款或收款)",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "现货商品最小变动值",
+                    "type": "integer"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "performancestepid": {
+                    "description": "履约步骤ID(131+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "planid": {
+                    "description": "所属履约计划ID",
+                    "type": "string"
+                },
+                "realamount": {
+                    "description": "实际完成金额",
+                    "type": "number"
+                },
+                "relatedorderid": {
+                    "description": "关联单号",
+                    "type": "string"
+                },
+                "remaindays": {
+                    "description": "剩余天数",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "错误备注",
+                    "type": "string"
+                },
+                "starttime": {
+                    "description": "开始日期",
+                    "type": "string"
+                },
+                "stepamount": {
+                    "description": "步骤金额",
+                    "type": "number"
+                },
+                "stepdays": {
+                    "description": "距离上一步天数(分钟)",
+                    "type": "integer"
+                },
+                "stepindex": {
+                    "description": "步骤序号",
+                    "type": "integer"
+                },
+                "steplanchtype": {
+                    "description": "步骤启动类型 - 1:系统自动 2:手动",
+                    "type": "integer"
+                },
+                "stepremark": {
+                    "description": "步骤备注",
+                    "type": "string"
+                },
+                "stepstatus": {
+                    "description": "步骤状态 -  1:待开始 2:进行中 3:已完成 4:延期(进行中) 5:失败 6:自动完成 7:超时关闭",
+                    "type": "integer"
+                },
+                "steptypeid": {
+                    "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
+                    "type": "integer"
+                },
+                "steptypename": {
+                    "description": "步骤名称",
+                    "type": "string"
+                },
+                "stepvalue": {
+                    "description": "步骤值",
+                    "type": "number"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrPosition": {
             "type": "object",
             "properties": {

+ 198 - 1
docs/swagger.json

@@ -11164,6 +11164,12 @@
                     },
                     {
                         "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"
@@ -11336,6 +11342,48 @@
                 }
             }
         },
+        "/WrTrade2/QueryPerformancePlanStep": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询履约信息详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "履约计划id(performanceplanid)",
+                        "name": "planid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrPerformancePlanStep"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrFactorTypeInfo": {
             "get": {
                 "security": [
@@ -30547,7 +30595,7 @@
                 },
                 "performanceplanid": {
                     "description": "履约计划ID(130+yyMMddHHmmss+xxxx)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "performancestatus": {
                     "description": "履约状态 -  1:初始化 2:正常 3:处理错误 4:违约待处理 5:违约处理中 6:完成 7.违约已完成 8:释放冻结失败 9:超时待处理 10:超时关闭",
@@ -30639,6 +30687,155 @@
                 }
             }
         },
+        "models.WrPerformancePlanStep": {
+            "type": "object",
+            "properties": {
+                "delaydays": {
+                    "description": "延期申请天数",
+                    "type": "integer"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "结束日期",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "executeside": {
+                    "description": "步骤执行方 - 1:买方 2:卖方",
+                    "type": "integer"
+                },
+                "handlestatus": {
+                    "description": "处理状态 - 1:开始 2:结束 3:冻结请求 4:冻结返回成功 5:冻结返回失败 6:扣款请求 7:扣款返回成功 8:扣款返回失败 9:仓单转移请求 10:仓单转移返回成功 11:仓单转移返回失败 12:加钱请求 13:加钱返回成功 14:加钱返回失败 15:解冻仓单头寸请求 16:解冻仓单头寸返回成功 17:解冻仓单头寸返回失败 18:解冻库位请求 19:解冻库位返回成功 20:解冻库位返回失败",
+                    "type": "integer"
+                },
+                "isauto": {
+                    "description": "是否自动 - 0:不自动 1:自动",
+                    "type": "integer"
+                },
+                "islastreceivestep": {
+                    "description": "是否最后收款步骤 - 0:不是 1:是    (暂时不用,由服务自己判断是否为最后一步付款或收款)",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "现货商品最小变动值",
+                    "type": "integer"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "performancestepid": {
+                    "description": "履约步骤ID(131+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "planid": {
+                    "description": "所属履约计划ID",
+                    "type": "string"
+                },
+                "realamount": {
+                    "description": "实际完成金额",
+                    "type": "number"
+                },
+                "relatedorderid": {
+                    "description": "关联单号",
+                    "type": "string"
+                },
+                "remaindays": {
+                    "description": "剩余天数",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "错误备注",
+                    "type": "string"
+                },
+                "starttime": {
+                    "description": "开始日期",
+                    "type": "string"
+                },
+                "stepamount": {
+                    "description": "步骤金额",
+                    "type": "number"
+                },
+                "stepdays": {
+                    "description": "距离上一步天数(分钟)",
+                    "type": "integer"
+                },
+                "stepindex": {
+                    "description": "步骤序号",
+                    "type": "integer"
+                },
+                "steplanchtype": {
+                    "description": "步骤启动类型 - 1:系统自动 2:手动",
+                    "type": "integer"
+                },
+                "stepremark": {
+                    "description": "步骤备注",
+                    "type": "string"
+                },
+                "stepstatus": {
+                    "description": "步骤状态 -  1:待开始 2:进行中 3:已完成 4:延期(进行中) 5:失败 6:自动完成 7:超时关闭",
+                    "type": "integer"
+                },
+                "steptypeid": {
+                    "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
+                    "type": "integer"
+                },
+                "steptypename": {
+                    "description": "步骤名称",
+                    "type": "string"
+                },
+                "stepvalue": {
+                    "description": "步骤值",
+                    "type": "number"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrPosition": {
             "type": "object",
             "properties": {

+ 145 - 1
docs/swagger.yaml

@@ -13988,7 +13988,7 @@ definitions:
         type: integer
       performanceplanid:
         description: 履约计划ID(130+yyMMddHHmmss+xxxx)
-        type: integer
+        type: string
       performancestatus:
         description: 履约状态 -  1:初始化 2:正常 3:处理错误 4:违约待处理 5:违约处理中 6:完成 7.违约已完成 8:释放冻结失败
           9:超时待处理 10:超时关闭
@@ -14060,6 +14060,120 @@ definitions:
     required:
     - userid
     type: object
+  models.WrPerformancePlanStep:
+    properties:
+      delaydays:
+        description: 延期申请天数
+        type: integer
+      deliverygoodscode:
+        description: 品种代码
+        type: string
+      deliverygoodsid:
+        description: 品种ID
+        type: integer
+      deliverygoodsname:
+        description: 品种名称
+        type: string
+      endtime:
+        description: 结束日期
+        type: string
+      enumdicname:
+        description: 单位名称
+        type: string
+      executeside:
+        description: 步骤执行方 - 1:买方 2:卖方
+        type: integer
+      handlestatus:
+        description: 处理状态 - 1:开始 2:结束 3:冻结请求 4:冻结返回成功 5:冻结返回失败 6:扣款请求 7:扣款返回成功 8:扣款返回失败
+          9:仓单转移请求 10:仓单转移返回成功 11:仓单转移返回失败 12:加钱请求 13:加钱返回成功 14:加钱返回失败 15:解冻仓单头寸请求
+          16:解冻仓单头寸返回成功 17:解冻仓单头寸返回失败 18:解冻库位请求 19:解冻库位返回成功 20:解冻库位返回失败
+        type: integer
+      isauto:
+        description: 是否自动 - 0:不自动 1:自动
+        type: integer
+      islastreceivestep:
+        description: 是否最后收款步骤 - 0:不是 1:是    (暂时不用,由服务自己判断是否为最后一步付款或收款)
+        type: integer
+      minivalue:
+        description: 现货商品最小变动值
+        type: integer
+      optioncompare:
+        description: 选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较
+        type: string
+      performancestepid:
+        description: 履约步骤ID(131+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      planid:
+        description: 所属履约计划ID
+        type: string
+      realamount:
+        description: 实际完成金额
+        type: number
+      relatedorderid:
+        description: 关联单号
+        type: string
+      remaindays:
+        description: 剩余天数
+        type: integer
+      remark:
+        description: 错误备注
+        type: string
+      starttime:
+        description: 开始日期
+        type: string
+      stepamount:
+        description: 步骤金额
+        type: number
+      stepdays:
+        description: 距离上一步天数(分钟)
+        type: integer
+      stepindex:
+        description: 步骤序号
+        type: integer
+      steplanchtype:
+        description: 步骤启动类型 - 1:系统自动 2:手动
+        type: integer
+      stepremark:
+        description: 步骤备注
+        type: string
+      stepstatus:
+        description: 步骤状态 -  1:待开始 2:进行中 3:已完成 4:延期(进行中) 5:失败 6:自动完成 7:超时关闭
+        type: integer
+      steptypeid:
+        description: 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票
+          8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“
+        type: integer
+      steptypename:
+        description: 步骤名称
+        type: string
+      stepvalue:
+        description: 步骤值
+        type: number
+      warehouseid:
+        description: 仓库ID
+        type: integer
+      warehousename:
+        description: 仓库名称
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      wrfactortypename:
+        description: 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
+        type: string
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 商品名称
+        type: string
+      wrtypename:
+        description: 商品
+        type: string
+    type: object
   models.WrPosition:
     properties:
       accountid:
@@ -23399,6 +23513,10 @@ paths:
         in: query
         name: deliverygoodsid
         type: integer
+      - description: 品类id
+        in: query
+        name: wrstandardid
+        type: integer
       - description: 仓单要素id
         in: query
         name: wrfactortypeid
@@ -23517,6 +23635,32 @@ paths:
       summary: 查询履约信息
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryPerformancePlanStep:
+    get:
+      parameters:
+      - description: 履约计划id(performanceplanid)
+        in: query
+        name: planid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrPerformancePlanStep'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询履约信息详情
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrFactorTypeInfo:
     get:
       parameters:

+ 122 - 6
models/wrTrade2.go

@@ -22,7 +22,7 @@ type WrOrderQuote struct {
 	SELLQTY           float64          `json:"sellqty"  xorm:"'SELLQTY'"`                                     // 卖量
 	WRFACTORTYPENAME  string           `json:"wrfactortypename"  xorm:"'WRFACTORTYPENAME'"`                   // 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
 	DELIVERYGOODSID   int32            `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                     // 品种id
-	WRSTANDARDID      int32            `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                           // 商品id
+	WRSTANDARDID      int32            `json:"wrstandardid"  xorm:"'WRSTANDARDID'" form:"wrstandardid"`       // 商品id
 	WAREHOUSEID       int32            `json:"warehouseid"  xorm:"'WAREHOUSEID'" form:"warehouseid"`          // 仓库id
 	DELIVERYGOODSNAME string           `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                 // 品种名称
 	DELIVERYGOODSCODE string           `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`                 // 品种代码
@@ -44,12 +44,24 @@ type WrOrderQuote struct {
 	WrPriceType int32  `json:"-" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
 	MarketId    int32  `json:"-" form:"marketid"`    // 市场id
 	BRANDNAME   string `json:"-" form:"brandname"`   // 品牌名称
+	DGITEMNAME  string `json:"-" form:"dgitemname"`  // 筛选项
 }
 
 func (r *WrOrderQuote) calc() {
 	r.WRGOODSNAME = strings.ReplaceAll(r.WRGOODSNAME, ",", "-")
 }
 
+func (r *WrOrderQuote) ftItemName() ([]string, bool) {
+	if len(r.DGITEMNAME) < 2 {
+		return nil, false
+	}
+	sItem := strings.Split(r.DGITEMNAME, ",")
+	if len(sItem) > 0 {
+		return sItem, true
+	}
+	return nil, false
+}
+
 // buildSqlFixedPrice 一口价
 func (r *WrOrderQuote) buildSqlFixedPrice() string {
 	var sqlId utils.SQLVal = "with buyQuote as" +
@@ -128,8 +140,10 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
 	param.AndEx("t.wrfactortypeid", r.WRFACTORTYPEID, len(r.WRFACTORTYPEID) > 0)
 	param.AndEx("t.deliverymonth", r.DELIVERYMONTH, len(r.DELIVERYMONTH) > 1)
 
-	param2.AndLike("w.wrfactortypename", r.WRSTANDARDNAME)
-	param2.AndLike("w.wrfactortypename", r.BRANDNAME)
+	if d, ok := r.ftItemName(); ok {
+		param2.AndLikes("w.wrfactortypename", d...)
+	}
+	param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
 	param2.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
 	param2.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	sqlId.FormatParam(param.String(), param.String(), param2.String())
@@ -234,9 +248,12 @@ func (r *WrOrderQuote) buildSqlPriceMove() string {
 	param.AndEx("t.wrfactortypeid", r.WRFACTORTYPEID, len(r.WRFACTORTYPEID) > 0)
 	param.AndEx("t.deliverymonth", r.DELIVERYMONTH, len(r.DELIVERYMONTH) > 1)
 
-	param2.AndLike("w.wrfactortypename", r.WRSTANDARDNAME)
-	param2.AndLike("w.wrfactortypename", r.BRANDNAME)
+	if d, ok := r.ftItemName(); ok {
+		param2.AndLikes("w.wrfactortypename", d...)
+	}
+	param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
 	param2.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
+	param2.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	sqlId.FormatParam(param.String(), param.String(), param2.String())
 
 	sqlId.Page(r.Page, r.PageSize)
@@ -1069,7 +1086,7 @@ func (r *WrGoodsInfo) GetDataEx() (interface{}, error) {
 
 // WrPerformancePlan 履约信息(履约计划)
 type WrPerformancePlan struct {
-	PERFORMANCEPLANID        int64   `json:"performanceplanid"  xorm:"PERFORMANCEPLANID" form:"performanceplanid"` // 履约计划ID(130+yyMMddHHmmss+xxxx)
+	PERFORMANCEPLANID        string  `json:"performanceplanid"  xorm:"PERFORMANCEPLANID" form:"performanceplanid"` // 履约计划ID(130+yyMMddHHmmss+xxxx)
 	PERFORMANCETYPE          int32   `json:"performancetype"  xorm:"PERFORMANCETYPE" form:"performancetype"`       // 履约类型 - 0:通用 1:交割 2:仓单贸易 3:预售集采 4:竞拍-降价式 (无仓单) 5:挂牌期权 6:竞拍-降价式 7:竞拍-竞价式 8:竞拍-大宗式 9:荷兰式 10:法币C2C 11:报价系统 12:挂牌系统
 	RELATEDORDERID           string  `json:"relatedorderid"  xorm:"RELATEDORDERID" form:"relatedorderid"`          // 关联单号(履约类型的关联单号)
 	AMOUNT                   float64 `json:"amount"  xorm:"AMOUNT" form:"amount"`                                  // 履约金额(总金额)
@@ -1783,3 +1800,102 @@ func (r *WrStandardFactoryItemEx) GetDataEx() (interface{}, error) {
 	}
 	return sData, nil
 }
+
+// WrPerformancePlanStep 履约计划详情
+type WrPerformancePlanStep struct {
+	PERFORMANCESTEPID string  `json:"performancestepid"  xorm:"PERFORMANCESTEPID"`              // 履约步骤ID(131+Unix秒时间戳(10位)+xxxxxx)
+	PLANID            string  `json:"planid"  xorm:"PLANID" form:"planid"`                      // 所属履约计划ID
+	STEPINDEX         int32   `json:"stepindex"  xorm:"STEPINDEX" form:"stepindex"`             // 步骤序号
+	STEPDAYS          int32   `json:"stepdays"  xorm:"STEPDAYS" form:"stepdays"`                // 距离上一步天数(分钟)
+	STEPTYPEID        int32   `json:"steptypeid"  xorm:"STEPTYPEID" form:"steptypeid"`          // 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“
+	STEPVALUE         float64 `json:"stepvalue"  xorm:"STEPVALUE" form:"stepvalue"`             // 步骤值
+	STEPAMOUNT        float64 `json:"stepamount"  xorm:"STEPAMOUNT" form:"stepamount"`          // 步骤金额
+	REALAMOUNT        float64 `json:"realamount"  xorm:"REALAMOUNT" form:"realamount"`          // 实际完成金额
+	REMAINDAYS        int32   `json:"remaindays"  xorm:"REMAINDAYS" form:"remaindays"`          // 剩余天数
+	DELAYDAYS         int32   `json:"delaydays"  xorm:"DELAYDAYS" form:"delaydays"`             // 延期申请天数
+	ISAUTO            int32   `json:"isauto"  xorm:"ISAUTO" form:"isauto"`                      // 是否自动 - 0:不自动 1:自动
+	ISLASTRECEIVESTEP int32   `json:"islastreceivestep"  xorm:"ISLASTRECEIVESTEP"`              // 是否最后收款步骤 - 0:不是 1:是    (暂时不用,由服务自己判断是否为最后一步付款或收款)
+	STEPSTATUS        int32   `json:"stepstatus"  xorm:"STEPSTATUS" form:"stepstatus"`          // 步骤状态 -  1:待开始 2:进行中 3:已完成 4:延期(进行中) 5:失败 6:自动完成 7:超时关闭
+	HANDLESTATUS      int32   `json:"handlestatus"  xorm:"HANDLESTATUS" form:"handlestatus"`    // 处理状态 - 1:开始 2:结束 3:冻结请求 4:冻结返回成功 5:冻结返回失败 6:扣款请求 7:扣款返回成功 8:扣款返回失败 9:仓单转移请求 10:仓单转移返回成功 11:仓单转移返回失败 12:加钱请求 13:加钱返回成功 14:加钱返回失败 15:解冻仓单头寸请求 16:解冻仓单头寸返回成功 17:解冻仓单头寸返回失败 18:解冻库位请求 19:解冻库位返回成功 20:解冻库位返回失败
+	STEPLANCHTYPE     int32   `json:"steplanchtype"  xorm:"STEPLANCHTYPE" form:"steplanchtype"` // 步骤启动类型 - 1:系统自动 2:手动
+	EXECUTESIDE       int32   `json:"executeside"  xorm:"EXECUTESIDE" form:"executeside"`       // 步骤执行方 - 1:买方 2:卖方
+	STARTTIME         string  `json:"starttime"  xorm:"STARTTIME" form:"starttime"`             // 开始日期
+	ENDTIME           string  `json:"endtime"  xorm:"ENDTIME" form:"endtime"`                   // 结束日期
+	REMARK            string  `json:"remark"  xorm:"REMARK" form:"remark"`                      // 错误备注
+	STEPREMARK        string  `json:"stepremark"  xorm:"STEPREMARK" form:"stepremark"`          // 步骤备注
+	STEPTYPENAME      string  `json:"steptypename"  xorm:"'STEPTYPENAME'"`                      // 步骤名称
+	RELATEDORDERID    string  `json:"relatedorderid"  xorm:"'RELATEDORDERID'"`                  // 关联单号
+	Wr2FactorType     `xorm:"extends"`
+}
+
+func (r *WrPerformancePlanStep) calc() {
+	r.Wr2FactorType.Calc()
+}
+
+func (r *WrPerformancePlanStep) buildSql() string {
+	var sqlId utils.SQLVal = "with tmp as" +
+		" (select to_char(t.wrfactortypeid) wrfactortypeid," +
+		"         t.wrfactortypename2 wrfactortypename," +
+		"         t.wrstandardid," +
+		"         t.deliverygoodsid," +
+		"         g.deliverygoodscode," +
+		"         g.deliverygoodsname," +
+		"         w.wrstandardcode," +
+		"         w.wrstandardname," +
+		"         h.warehousecode," +
+		"         h.warehousename," +
+		"         e.enumdicname," +
+		"         w.wrstandardname || t.wrfactortypename2 as wrtypename" +
+		"    from wrfactortype t" +
+		"    left join deliverygoods g" +
+		"      on t.deliverygoodsid = g.deliverygoodsid" +
+		"    left join wrstandard w" +
+		"      on t.wrstandardid = w.wrstandardid" +
+		"    left join warehouseinfo h" +
+		"      on t.warehouseid = h.autoid" +
+		"    left join enumdicitem e" +
+		"      on w.unitid = e.enumitemname" +
+		"     and e.enumdiccode = 'goodsunit')" +
+		"SELECT to_char(t.PERFORMANCESTEPID) PERFORMANCESTEPID," +
+		"       to_char(t.PLANID) PLANID," +
+		"       t.STEPINDEX," +
+		"       t.STEPDAYS," +
+		"       t.STEPTYPEID," +
+		"       t.STEPVALUE," +
+		"       t.STEPAMOUNT," +
+		"       t.REALAMOUNT," +
+		"       t.REMAINDAYS," +
+		"       t.DELAYDAYS," +
+		"       t.ISAUTO," +
+		"       t.ISLASTRECEIVESTEP," +
+		"       t.STEPSTATUS," +
+		"       t.HANDLESTATUS," +
+		"       t.STEPLANCHTYPE," +
+		"       t.EXECUTESIDE," +
+		"       to_char(t.STARTTIME, 'yyyy-mm-dd hh24:mi:ss') STARTTIME," +
+		"       to_char(t.ENDTIME, 'yyyy-mm-dd hh24:mi:ss') ENDTIME," +
+		"       t.REMARK," +
+		"       t.STEPREMARK," +
+		"       s.steptypename," +
+		"       to_char(p.relatedorderid) relatedorderid," +
+		"       k.*" +
+		"  FROM PERFORMANCESTEP t" +
+		"  LEFT JOIN PERFORMANCESTEPTYPE s on t.steptypeid=s.steptypeid" +
+		"  LEFT JOIN PERFORMANCEPLAN p on t.planid=p.performanceplanid" +
+		"  LEFT JOIN PERFORMANCEPLANWR pr on p.performanceplanid=pr.performanceplanid" +
+		"  LEFT JOIN tmp k on pr.wrfactortypeid=k.wrfactortypeid" +
+		" WHERE 1 = 1"
+	sqlId.And("t.PLANID", r.PLANID)
+	sqlId.Join(" order by t.stepindex")
+	return sqlId.String()
+}
+
+// GetDataEx 获取履约计划详情
+func (r *WrPerformancePlanStep) GetDataEx() (interface{}, error) {
+	sData := make([]WrPerformancePlanStep, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

@@ -533,6 +533,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrMarketTradeConfig", wrTrade2.QueryWrMarketTradeConfig)
 		wrTrade2R.GET("QueryFtDeliveryGoods", wrTrade2.QueryFtDeliveryGoods)
 		wrTrade2R.GET("QueryWrStandardFactoryItem", wrTrade2.QueryWrStandardFactoryItem)
+		wrTrade2R.GET("QueryWrPerformancePlanStep", wrTrade2.QueryWrPerformancePlanStep)
 	}
 
 	return r

+ 9 - 0
utils/sqlUtils.go

@@ -91,6 +91,15 @@ func (r *SQLVal) AndLike(fieldName string, val string) {
 	}
 }
 
+// AndLikes 模糊匹配, 参数 param 为空时不进行匹配
+func (r *SQLVal) AndLikes(fieldName string, param ...string) {
+	if len(param) > 0 {
+		for _, val := range param {
+			*r += SQLVal(fmt.Sprintf(" and %v like '%%%v%%'", fieldName, val))
+		}
+	}
+}
+
 // Page 分页查询 pageNum-页码 第几页, pageSize-每页大小
 func (r *SQLVal) Page(pageNum int, pageSize int) {
 	if pageNum <= 0 || pageSize <= 0 {