| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /**
- * 登记相关
- *
- * 采购 - 待点价 - 点价登记
- * 采购 - 履约交收 - (交收登记, 款项登记, 发票登记, 入库登记)
- *
- */
- import {
- ErmcpContractOperateApplyReq,
- FundsReq,
- InvoiceReq,
- SettlementReq,
- SomePriceReq
- } from "@/services/proto/contract/interface";
- import {operationContractReq} from "@/services/proto/contract";
- import Long from "long";
- import {commonResultInfo, getRequestResultInfo} from "@/common/methods/request";
- import {purchaseStateSign} from "@/views/business/purchase/setup";
- import {hedgePlanReq} from "@/services/proto/hedgeplan";
- import {Ref} from "vue";
- import {objectToUint8Array} from "@/utils/objHandle";
- import {ermcpInOutStockApplyReq} from "@/services/proto/warehouse";
- import {ERMCPAreaInOutStockApplyReq} from "@/services/proto/warehouse/interface";
- /**
- * 这里负责 点价登记, 交收登记, 款项登记, 发票登记, 入库登记
- */
- /**
- * 点价登记
- * @param spotcontractid 合同id
- * @param req 点价价格以及数量
- */
- export function somePriceReq(spotcontractid: string, req: SomePriceReq, loading: Ref<boolean>): Promise<string> {
- return operationContractRsp(1,
- operationContractReqBuilder(req, spotcontractid, 1),
- loading)
- }
- /**
- * 交收登记
- */
- export function settlementReq(spotcontractid: string, req: SettlementReq, loading: Ref<boolean>): Promise<string> {
- return operationContractRsp(2,
- operationContractReqBuilder(req, spotcontractid, 2),
- loading)
- }
- /**
- * 款项登记
- */
- export function fundsReq(spotcontractid: string, req: FundsReq, loading: Ref<boolean>,Remark:String): Promise<string> {
- return operationContractRsp(3,
- operationContractReqBuilder(req, spotcontractid, 3),
- loading)
- }
- /**
- * 发票登记
- */
- export function invoiceReq(spotcontractid: string, req: InvoiceReq, loading: Ref<boolean>): Promise<string> {
- return operationContractRsp(4,
- operationContractReqBuilder(req, spotcontractid, 4),
- loading)
- }
- /**
- * 入库登记
- */
- export function storageReq(req: ERMCPAreaInOutStockApplyReq, loading: Ref<boolean>): Promise<string>{
- const sign = getRequestResultInfo(purchaseStateSign, 5) // 接口请求后的返回提示 这里统一进行管理
- const result = ermcpInOutStockApplyReq(req)
- return commonResultInfo(result, sign, loading)
- }
- /**
- * 请求报文组装
- * @param req 特定的请求包结构
- * @param id 操作的合同id
- * @param type 操作类型
- */
- export function operationContractReqBuilder(req: Object, id: string, type: number,Remark?:String): ErmcpContractOperateApplyReq {
- return {
- OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
- Remark:'',
- Info: {
- OperateApplyType: type, // uint32 操作申请类型-1:点价2:结算3:款项4:发票
- RelatedID: Long.fromString(id), // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
- DetailJson: objectToUint8Array(req), // bytes 明细JSON {}
- },
- } as ErmcpContractOperateApplyReq
- }
- /**
- * 登记返回处理
- * @param type 登记类型
- * @param req 请求数据
- * @param loading
- */
- export function operationContractRsp(type: number, req: ErmcpContractOperateApplyReq, loading: Ref<boolean>): Promise<string> {
- const sign = getRequestResultInfo(purchaseStateSign, type) // 接口请求后的返回提示 这里统一进行管理
- const result = operationContractReq(req)
- return commonResultInfo(result, sign, loading)
- }
|