li.shaoyi 4 anos atrás
pai
commit
740a8d93e9

+ 19 - 1
src/services/go/ermcp/goodsInfo/index.ts

@@ -14,7 +14,8 @@ import {
     Goods,
     Ermcp3MiddleGoodsDetail2
 } from './interface';
-import {Ermcp3MiddleGoodsDetail} from './interface/middlegoodsdetail'
+import { Ermcp3MiddleGoodsDetail } from './interface/middlegoodsdetail'
+import { Ermcp3DeliveryGoodsDetailReq, Ermcp3DeliveryGoodsDetail } from './interface/deliverygoodsdetail'
 
 /**
  * 查询现货商品 /Ermcp3/QueryDeliveryGoods
@@ -56,6 +57,23 @@ export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
 
 /**
  * 查询现货商品详情 /Ermcp3/QueryDeliveryGoodsDetail
+ * @constructor
+ */
+export function GetDeliveryGoodsDetail(deliverygoodsid?: number): Promise<Ermcp3DeliveryGoodsDetail[]> {
+    const param: Ermcp3DeliveryGoodsDetailReq = {
+        userid: getUserId(),
+        usertype: getUserAccountType(),
+    }
+    if (deliverygoodsid) {
+        param.deliverygoodsid = deliverygoodsid;
+    }
+    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', param).catch((err) => {
+        throw new Error(`查询现货商品详情: ${err}`);
+    });
+}
+
+/**
+ * 查询现货商品详情 /Ermcp3/QueryDeliveryGoodsDetail ----------------------------------- 待优化废弃
  * @param deliverygoodsid 现货商品id
  * @constructor
  */

+ 55 - 49
src/services/go/ermcp/goodsInfo/interface/deliverygoodsdetail.ts

@@ -1,79 +1,85 @@
+export interface Ermcp3DeliveryGoodsDetailReq {
+    userid: number//用户id
+    usertype: number//用户类型 2-机构 7-企业成员
+    deliverygoodsid?: number//现货商品id
+}
+
 /**
  * 查询现货商品详情
  */
- export interface Ermcp3DeliveryGoodsDetail {
-    areauserid:number//所属机构
-    bdlst:XHBRAND[]//品牌列表
-    deliverygoodscode:string//现货品种代码
-    deliverygoodsid:number//现货品种ID(SEQ_DELIVERYGOODS)
-    deliverygoodsname:string//现货品种名称
-    dgstatus:number//品种状态 - 作废 - 0:未激活 1:正常
-    isvalid:number//是否有效 - 0:无效 1:有效
-    remark:string//备注
-    unitid:number//单位id(目前看,数据库中是空值)
-    wdlst:XHWrstandard[]//品类(现货商品)列表
+export interface Ermcp3DeliveryGoodsDetail {
+    areauserid: number//所属机构
+    bdlst: XHBRAND[]//品牌列表
+    deliverygoodscode: string//现货品种代码
+    deliverygoodsid: number//现货品种ID(SEQ_DELIVERYGOODS)
+    deliverygoodsname: string//现货品种名称
+    dgstatus: number//品种状态 - 作废 - 0:未激活 1:正常
+    isvalid: number//是否有效 - 0:无效 1:有效
+    remark: string//备注
+    unitid: number//单位id(目前看,数据库中是空值)
+    wdlst: XHWrstandard[]//品类(现货商品)列表
 }
 
 
 /**
  * 品牌列表
  */
-interface XHBRAND{
-    brandid:number//品牌id
-    brandname:string//品牌名称
-    isvalid:number//是否有效 0-无效 1-有效
+export interface XHBRAND {
+    brandid: number//品牌id
+    brandname: string//品牌名称
+    isvalid: number//是否有效 0-无效 1-有效
 }
 
 /**
  * 品类(现货商品)列表
  */
-interface XHWrstandard{
-    deliverygoodsid:number//品种ID
-    enumdicnam:string//单位名称
-    mglst:XHMiddleGoods[]//套保品列表
-    unitid:number//单位id
-    vatrate:number//增值税率
-    wrstandardcode:string//现货商品代码
-    wrstandardid:number//现货商品ID(SEQ_WRSTANDARD)
-    wrstandardname:string//现货商品名称
+export interface XHWrstandard {
+    deliverygoodsid: number//品种ID
+    enumdicnam: string//单位名称
+    mglst: XHMiddleGoods[]//套保品列表
+    unitid: number//单位id
+    vatrate: number//增值税率
+    wrstandardcode: string//现货商品代码
+    wrstandardid: number//现货商品ID(SEQ_WRSTANDARD)
+    wrstandardname: string//现货商品名称
 }
 
 /**
  * 套保品列表
  */
-interface XHMiddleGoods{
-    convertratio:number//拆算系数
-    costratio:number//成本权重
-    deliverygoodsid:number//现货商品id
-    enumdicname:string//单位名称
-    gplst:TBGoodsGroup[]//期货品种列表
-    middlegoodscode:string//套保品种代码
-    middlegoodsid:number//套保品种id
-    middlegoodsname:string//套保品种名称
-    unitid:number//单位id
+export interface XHMiddleGoods {
+    convertratio: number//拆算系数
+    costratio: number//成本权重
+    deliverygoodsid: number//现货商品id
+    enumdicname: string//单位名称
+    GPLST: TBGoodsGroup[]//期货品种列表
+    middlegoodscode: string//套保品种代码
+    middlegoodsid: number//套保品种id
+    middlegoodsname: string//套保品种名称
+    unitid: number//单位id
 }
 
 /**
  *期货品种列表
  */
-interface TBGoodsGroup{
-    convertratio:number//折算系数
-    enumdicname:string//单位名称
-    exexchangecode:string//交易所代码
-    exexchangename:string//交易所名称
-    gdlst:TBGoods[]//商品列表
-    goodsgroupid:number//商品组ID(自增ID)
-    goodsgroupname:string//商品组名称
-    goodunitid:number//报价单位ID
+export interface TBGoodsGroup {
+    convertratio: number//折算系数
+    enumdicname: string//单位名称
+    exexchangecode: string//交易所代码
+    exexchangename: string//交易所名称
+    GDLST: TBGoods[]//商品列表
+    goodsgroupid: number//商品组ID(自增ID)
+    goodsgroupname: string//商品组名称
+    goodunitid: number//报价单位ID
 }
 
 /**
  *商品列表
  */
-interface TBGoods{
-    agreeunit:number//合约乘数
-    enumdicname:string//单位名称
-    goodscode:string//商品代码(内部)
-    goodsid:number//商品ID(自增ID SEQ_GOODS)
-    goodsname:string//商品名称
+export interface TBGoods {
+    agreeunit: number//合约乘数
+    enumdicname: string//单位名称
+    goodscode: string//商品代码(内部)
+    goodsid: number//商品ID(自增ID SEQ_GOODS)
+    goodsname: string//商品名称
 }

+ 17 - 9
src/views/information/spot-contract/components/add/index.vue

@@ -72,8 +72,12 @@
                         </a-form-item>
                     </a-col>
                     <a-col :span="12">
-                        <a-form-item label="交易主体" name="subjecttype">
-                            <a-input class="subjecttype" style="width: 200px" v-model:value="formState.ContractNo" placeholder="请输入交易主体" />
+                        <a-form-item label="交易主体" name="SubjectID">
+                            <a-select class="inlineFormSelect" style="width: 200px" v-model:value="formState.SubjectID" placeholder="请选择主体">
+                                <a-select-option :value="item.subjectid" v-for="item in subjectList" :key="item.subjectid">
+                                    {{ item.subjectname }}
+                                </a-select-option>
+                            </a-select>
                         </a-form-item>
                     </a-col>
                 </a-row>
@@ -242,9 +246,7 @@
 <script lang="ts">
 import { defineComponent, PropType, ref } from 'vue';
 import { addContractReq } from './setup';
-import { getAreaUserName, getRootUserInfo, getUserName, getUserId } from '@/services/bus/user';
-import { getGoodsList } from '@/services/bus/goods';
-import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
+import { getRootUserInfo, getUserName, getUserId } from '@/services/bus/user';
 import { FormState } from '../interface';
 import { formatTime } from '@/common/methods/format';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
@@ -252,6 +254,8 @@ import { Moment } from 'moment';
 import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
 import { validateAction } from '@/common/setup/form';
 import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
+import { Ermcp3SubjectRsp } from '@/services/go/ermcp/subject/interface';
+import { QueryPaAreaSubject } from '@/services/go/ermcp/subject';
 import { handlerManagerList } from '@/common/setup/user';
 import { getUploadImg } from '@/common/setup/upload';
 import UploadImg from '@/common/components/uploadImg/index.vue';
@@ -280,7 +284,7 @@ export default defineComponent({
         const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
 
         //  处理现货商品
-        const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
+        const { deliveryGoodsList,goodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
         // 价格信息
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
         // 日期
@@ -294,14 +298,17 @@ export default defineComponent({
         const businesserList = ref<ErmcpLoginUser[]>([]);
         // 跟单员
         const merchandiserList = ref<ErmcpLoginUser[]>([]);
-        // 现货商品列表
-        const goodsList = ref<Goods[]>([]);
         const { getFirstImg, uploadImgAction } = getUploadImg();
 
+        // 交易主体列表
+        const subjectList = ref<Ermcp3SubjectRsp[]>([]);
+        QueryPaAreaSubject().then((res) => {
+            subjectList.value = res;
+        });
+
         queryCustomList();
         getDeliveryGoods();
         queryTradeManager();
-        goodsList.value = getGoodsList();
         queryBusinessManager().then(() => {
             businesserList.value = getBusinesserOrMerchandiser('22');
             merchandiserList.value = getBusinesserOrMerchandiser('23');
@@ -380,6 +387,7 @@ export default defineComponent({
             merchandiserList,
             uploadImgAction,
             getRootUserInfo,
+            subjectList,
         };
     },
 });

+ 4 - 4
src/views/information/spot-contract/components/add/setup.ts

@@ -46,10 +46,10 @@ export function addContractReq() {
             Amount: [1, 3].includes(form.PriceType) ? Number(form.Price) * Number(form.Qty) : 0, //    金额
             PriceMove: Number(form.PriceMove as number), //  升贴水
 
-            StartDate: form.StartDate, //                       点价开始时间
-            EndDate: form.EndDate, //                           点价结束时间
-            DeliveryStartDate: form.DeliveryStartDate,//        交收期开始
-            DeliveryEndDate: form.DeliveryEndDate, //           交收期结束
+            StartDate: form.StartDate === '--' ? '' : form.StartDate, //                       点价开始时间
+            EndDate: form.EndDate === '--' ? '' : form.EndDate, //                           点价结束时间
+            DeliveryStartDate: form.DeliveryStartDate === '--' ? '' : form.DeliveryStartDate,//        交收期开始
+            DeliveryEndDate: form.DeliveryEndDate === '--' ? '' : form.DeliveryEndDate, //           交收期结束
 
             GoodsID: form.GoodsID as number, //               点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
 

+ 1 - 1
src/views/information/spot-contract/components/interface.ts

@@ -36,5 +36,5 @@ export interface FormState {
     BizType: number // uint32 业务类型 - 1:套保 2:套利
     CurrencyID: number | undefined // 结算币种ID
     SpotContractID: string;//现货合同ID
-    SubjectID: number // 交易主体ID
+    SubjectID: number | undefined // 交易主体ID
 }

+ 2 - 8
src/views/information/spot-contract/components/modify/index.vue

@@ -74,7 +74,7 @@
                         <a-form-item label="交易主体" name="SubjectID">
                             <a-select class="inlineFormSelect" style="width: 200px" v-model:value="formState.SubjectID" placeholder="请选择主体">
                                 <a-select-option :value="item.subjectid" v-for="item in subjectList" :key="item.subjectid">
-                                    {{ item.subjectid }}
+                                    {{ item.subjectname }}
                                 </a-select-option>
                             </a-select>
                         </a-form-item>
@@ -248,8 +248,6 @@
 <script lang="ts">
 import { defineComponent, PropType, ref } from 'vue';
 import { getUserName, getUserId } from '@/services/bus/user';
-import { getGoodsList } from '@/services/bus/goods';
-import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import { FormState } from '../interface';
 import { formatTime } from '@/common/methods/format';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
@@ -289,7 +287,7 @@ export default defineComponent({
         const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
 
         //  处理现货商品
-        const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
+        const { deliveryGoodsList, goodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
         // 价格信息
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
         // 日期
@@ -309,10 +307,6 @@ export default defineComponent({
             merchandiserList.value = getBusinesserOrMerchandiser('23');
         });
 
-        // 现货商品列表
-        const goodsList = ref<Goods[]>([]);
-        goodsList.value = getGoodsList().filter((el) => el.goodsid === props.selectedRow.goodsid);
-
         // 交易主体列表
         const subjectList = ref<Ermcp3SubjectRsp[]>([]);
         QueryPaAreaSubject().then((res) => {

+ 28 - 3
src/views/information/spot-contract/components/setup.ts

@@ -5,7 +5,8 @@ import { validateCommon } from "@/common/setup/validate";
 import APP from '@/services';
 import { QueryCustomInfo } from "@/services/go/ermcp/customInfo";
 import { QueryCustomInfoType } from "@/services/go/ermcp/customInfo/interface";
-import { QueryDeliveryGoods } from "@/services/go/ermcp/goodsInfo";
+import { QueryDeliveryGoods, GetDeliveryGoodsDetail } from "@/services/go/ermcp/goodsInfo";
+import { TBGoods } from "@/services/go/ermcp/goodsInfo/interface/deliverygoodsdetail";
 import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx, ErmcpDeliveryGoodsRsp } from "@/services/go/ermcp/goodsInfo/interface";
 import { orderContract, spotContractStatus } from "@/services/proto/spotcontract";
 import {
@@ -100,7 +101,7 @@ export function handleFromState() {
             EndDate: '', //                           点价结束时间
             TradeUserID: undefined, //           交易员ID
             SpotContractID: '0',//现货合同ID
-            SubjectID: 0,// 交易主体ID
+            SubjectID: undefined,// 交易主体ID
         }
     }
     const formState: UnwrapRef<FormState> = reactive(initFormData())
@@ -252,6 +253,8 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
     const gblist = ref<Ermcp3Brand[]>([])
     // 品类列表
     const gmlist = ref<Ermcp3Wrstandard[]>([])
+    // 合约列表
+    const goodsList = ref<TBGoods[]>([]);
 
     // 查询现货商品
     function getDeliveryGoods() {
@@ -263,6 +266,26 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
         })
     }
 
+    // 查询商品列表
+    function getGoodsList(deliverygoodsid: number, wrstandardid: number) {
+        goodsList.value.length = 0;
+        GetDeliveryGoodsDetail(deliverygoodsid).then((res) => {
+            res.forEach((deliverygoods) => {
+                // 查询现货商品
+                const wrstandard = deliverygoods.wdlst.find((e) => e.wrstandardid === wrstandardid);
+                if (wrstandard) {
+                    // 套保品种列表
+                    wrstandard.mglst.forEach((middlegoods) => {
+                        // 期货品种列表
+                        middlegoods.GPLST.forEach((item) => {
+                            goodsList.value.push(...item.GDLST);
+                        })
+                    })
+                }
+            })
+        })
+    }
+
     // 切换现货商品
     function deliveryGoodsChange(value: number | undefined) {
         if (value !== undefined) {
@@ -294,7 +317,8 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
             //标仓系数
             formState.ConvertFactor = obj.convertfactor;
             // 单位
-            numberUnit.value = getGoodsUnitEnumItemName(obj.unitid)
+            numberUnit.value = getGoodsUnitEnumItemName(obj.unitid);
+            getGoodsList(obj.deliverygoodsid, obj.wrstandardid);
         }
     }
 
@@ -302,6 +326,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
         deliveryGoodsList,
         gblist,
         gmlist,
+        goodsList,
         numberUnit,
         WrStandardChange,
         getDeliveryGoods,