浏览代码

commit 提交新增现货商品信息

xkwg 4 年之前
父节点
当前提交
35b839ff3e

+ 10 - 0
public/proto/mtp.proto

@@ -725,6 +725,16 @@ message DeliveryGoodsApplyReq {
 	repeated GLDDGFactoryItemEx glddgfactoryItems = 12; // GLDDGFactoryItemEx 现货商品品牌数据
 	repeated WRSConvertDetailEx wrsconvertdetails = 13; // WRSConvertDetailEx 现货商品折算配置明细数据
 }
+
+// 现货品种申请响应 0 29 128
+message DeliveryGoodsApplyRsp {
+	optional MessageHead Header = 1; // MessageHead 消息头
+	optional int32 RetCode = 2; // int32 返回码
+	optional string RetDesc = 3; // string 描述信息
+	optional uint64 wrstandardid = 4; // uint64 现货商品ID
+	optional uint64 deliverygoodsid = 5; // uint64 现货品种ID
+}
+
 // 现货商品型号数据 0 29 172
 message GLDWRStandardEx {
 		optional uint64 wrstandardid = 1; // uint64 型号ID(修改时有值)

+ 3 - 4
src/services/proto/delivery/index.ts

@@ -13,16 +13,15 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
     return new Promise((resolve, reject) => {
         const req = {
             version: "3.2",
-            accountid: getSelectedAccountId(),
             userid: getUserId(),
-            loginid: getLongTypeLoginID(),
+            loginid: getLongTypeLoginID() ,
         };
         const params = {
             protobufName: 'DeliveryGoodsApplyReq',
             funCodeName: 'DeliveryGoodsApplyReq',
             reqParams: Object.assign(req, param),
             msgHeadParams: {
-                AccountID: getSelectedAccountId(),
+                AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
                 MarketID: 18,   // 目前写死
                 GoodsID: 0, // 目前写死
             }
@@ -30,7 +29,7 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'DelUserReceiveInfoRsp');
+                const { isSuccess, result } = parseProtoRsp50(res, 'DeliveryGoodsApplyRsp');
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 0 - 3
src/services/proto/delivery/interface.ts

@@ -1,8 +1,5 @@
 // 现货品种申请请求 0 29 124
 export interface DeliveryGoodsApplyReq {
-    // accountid: string  // header 需要用到
-    // userid: number // uint64 用户ID
-    // loginid: number // uint64 登录ID
     deliverygoodscode?: string // string 交割商品代码(新增时有值)
     deliverygoodsname?: string // string 交割商品名称(新增时有值)
     deliverygoodsid?: number// uint64 交割商品id(修改时有值)

+ 5 - 5
src/services/request/serviceURL.ts

@@ -73,10 +73,10 @@ export const commonSearchUrl = (url: string): string => {
 export const setServiceURL = (config: URL): void => {
     console.log('URL', config);
     // 外网环境(175),外包同事使用
-    // if (process.env.NODE_ENV === 'development') {
-    //     serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
-    //     serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
-    //     serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
-    // }
+    if (process.env.NODE_ENV === 'development') {
+        serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
+        serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
+        serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
+    }
     serviceURL = config;
 };

+ 0 - 1
src/services/socket/account/index.ts

@@ -41,7 +41,6 @@ export const queryAccountInfo = (QueryItem: string | number): Promise<string> =>
                     const accountList = TAAccountList.map((el: any) => {
                         return el.TaAccountInfo;
                     });
-
                     // 数据中心存入资金账号列表
                     APP.set('accountList', accountList);
                     // 时间戳集合

+ 1 - 0
src/views/information/goods/components/add/index.vue

@@ -527,6 +527,7 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
+                    addAction(param);
                     console.log('param', param);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {

+ 35 - 5
src/views/information/goods/components/add/setup.ts

@@ -2,7 +2,7 @@ import { getItemEnum } from '@/services/bus/allEnum';
 import { QueryGoodsfGroup } from '@/services/go/ermcp/goodsInfo';
 import { Ermcp3GoodsGroup } from '@/services/go/ermcp/goodsInfo/interface';
 import { addDeliveryGoodsApply } from '@/services/proto/delivery';
-import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
+import {DeliveryGoodsApplyReq, GLDWRStandardEx} from '@/services/proto/delivery/interface';
 import { message } from 'ant-design-vue';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from './interface';
@@ -13,9 +13,39 @@ import { FormState } from './interface';
  */
 export function handleAdd() {
     const loading = ref<boolean>(false);
-    function addAction(param: DeliveryGoodsApplyReq) {
+    function addAction(param: FormState) {
+        const unitid = param.unitid === undefined ? 0 : param.unitid
+        const reqParam :DeliveryGoodsApplyReq = {
+            deliverygoodscode: param.deliverygoodscode,
+            deliverygoodsname: param.deliverygoodsname,
+            deliverygoodsid:   param.deliverygoodsid,
+            unitid: unitid,
+            type: 1,
+            remark: param.remark,
+            gldwrstandards: param.gldwrstandards.map(value => {
+                let gldunitid = value.unitid === undefined ? 0 : value.unitid
+                let convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
+                return {
+                    wrstandardid: value.wrstandardid,
+                    wrstandardname: value.wrstandardname,
+                    unitid: gldunitid,
+                    convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
+                }
+            }),
+            glddgfactoryItems: param.glddgfactoryItems,
+            wrsconvertdetails: param.wrsconvertdetails.map(value => {
+                let middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
+                let convertratio: any = value.convertratio === null ? 0 : value.convertratio
+                let wrsunitid = value.unitid === null ? 0 : value.unitid
+                return {
+                    middlegoodsid: middlegoodsid,
+                    convertratio:  (convertratio as string) ? Number(convertratio) : convertratio,
+                    unitid: wrsunitid
+                }
+            })
+        }
         loading.value = true;
-        addDeliveryGoodsApply(param).then(() => {
+        addDeliveryGoodsApply(reqParam).then(() => {
             message.success('新增现货品种成功!')
         }).catch(err => {
             message.error(err.message)
@@ -31,7 +61,7 @@ export function handleAdd() {
 export function handleFromState() {
     const formState: UnwrapRef<FormState> = reactive({
         deliverygoodscode: '', // string 交割商品代码(新增时有值)
-        deliverygoodsname: '', // string 交割商品名称(新增时有值)
+        deliverygoodsname: '', // string 交割商品名称(新增时有值) // 可能没值  有值不能为中文
         deliverygoodsid: 0,// uint64 交割商品id(修改时有值)
         unitid: undefined, // uint64 单位ID
         type: 1,// int32 类型 1 新增 2 修改
@@ -96,4 +126,4 @@ export function handleGoodsGroup() {
 export function getGoodsUnit(unit: number): string {
     const obj = getItemEnum('goodsunit').find(e => e.enumitemname === unit);
     return obj ? obj.enumdicname : '--'
-}
+}