| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import APP from "@/services";
- import { Callback } from "@/utils/websocket";
- import { getSelectedAccountId, getUserId } from "@/services/bus/account";
- import {
- AreaInOutApplyAuditPassReq, AuditERMCPAreaInOutStockApplyReq,
- WarehouseApplyReq,
- WarehouseStateChangeReq
- } from "@/services/proto/warehouse/interface";
- import {getUUID} from "@/utils/qt/common";
- import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
- /**
- * 新增 / 修改 仓库信息请求 修改需要传仓库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 userid = getUserId();
- const accountid = getSelectedAccountId()
- const params = {
- protobufName: 'WarehouseApplyReq',
- funCodeName: 'WarehouseApplyReq',
- reqParams: Object.assign(param, { userid, accountid }),
- msgHeadParams: {
- AccountID: 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);
- });
- }
- /**
- * 出入库审核 审核通过
- * @param param
- */
- export const inOutStockApplyReq = (param: AreaInOutApplyAuditPassReq): Promise<any> => {
- param.ClientTicket = getUUID()
- param.AuditSrc = 2
- return new Promise((resolve, reject) => {
- const params = {
- protobufName: 'AreaInOutApplyAuditPassReq',
- funCodeName: 'AreaInOutApplyAuditPassReq',
- reqParams: param,
- msgHeadParams: {
- AccountID: getSelectedAccountId(),
- MarketID: 18,
- GoodsID: 0,
- }
- };
- const package50 = buildProtoReq50(params);
- APP.sendTradingServer(package50, undefined, {
- onSuccess: (res) => {
- const { isSuccess, result } = parseProtoRsp50(res, 'AreaInOutApplyAuditPassRsp');
- if (isSuccess) {
- resolve(result);
- } else {
- reject(result);
- }
- },
- onFail: (err) => reject(err.message),
- } as Callback);
- });
- }
- /**
- * 出入库审核 审核拒绝 & 撤回
- * @param param
- */
- export const refuseStockApplyReq = (param: AuditERMCPAreaInOutStockApplyReq): Promise<any> => {
- return new Promise((resolve, reject) => {
- const params = {
- protobufName: 'AuditERMCPAreaInOutStockApplyReq',
- funCodeName: 'AuditERMCPAreaInOutStockApplyReq',
- reqParams: param,
- msgHeadParams: {
- AccountID: getSelectedAccountId(),
- MarketID: 18,
- GoodsID: 0,
- }
- };
- const package50 = buildProtoReq50(params);
- APP.sendTradingServer(package50, undefined, {
- onSuccess: (res) => {
- const { isSuccess, result } = parseProtoRsp50(res, 'AuditERMCPAreaInOutStockApplyRsp');
- if (isSuccess) {
- resolve(result);
- } else {
- reject(result);
- }
- },
- onFail: (err) => reject(err.message),
- } as Callback);
- });
- }
|