| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
- import APP from "@/services";
- import {Callback} from "@/utils/websocket";
- import {WarehouseApplyReq, WarehouseStateChangeReq} from "@/protoService/warehouse/interface";
- /**
- * 新增 / 修改 仓库信息请求 修改需要传仓库id
- * @param param.type (必填) 类型 1 新增 2 修改
- * @param param.warehousecode (必填) 仓库代码
- * @param param.warehousename (必填) 仓库名称
- * @param param.warehousetype (必填) 仓库类型
- */
- export const addWarehouseApply = (param: WarehouseApplyReq): Promise<any> => {
- return new Promise((resolve, reject) => {
- const params = {
- protobufName: 'WareHouseApplyReq',
- funCodeName: 'WareHouseApplyReq',
- reqParams: param,
- msgHeadParams: {
- AccountID: param.accountid,
- MarketID: 18,
- GoodsID: 0,
- }
- };
- const package50 = buildProtoReq50(params);
- APP.sendTradingServer(package50, undefined, {
- onSuccess: (res) => {
- const { isSuccess, result } = parseProtoRsp50(res, 'WareHouseApplyRsp');
- if (isSuccess) {
- resolve(result);
- } else {
- reject(result);
- }
- },
- onFail: (err) => reject(err.message),
- } as Callback);
- });
- }
- /**
- * 仓库状态修改请求
- * @param param.warehouseid 仓库ID
- * @param param.warehousestatus 仓库状态 - 1:正常 2:注销 3:待审核 4:审核拒绝
- */
- export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise<any> => {
- return new Promise((resolve, reject) => {
- const params = {
- protobufName: 'WareHouseStateChangeReq',
- funCodeName: 'WareHouseStateChangeReq',
- reqParams: param,
- msgHeadParams: {
- AccountID: param.accountid,
- MarketID: 18,
- GoodsID: 0,
- }
- };
- const package50 = buildProtoReq50(params);
- APP.sendTradingServer(package50, undefined, {
- onSuccess: (res) => {
- const { isSuccess, result } = parseProtoRsp50(res, 'WareHouseStateChangeRsp');
- if (isSuccess) {
- resolve(result);
- } else {
- reject(result);
- }
- },
- onFail: (err) => reject(err.message),
- } as Callback);
- });
- }
|