package com.app.hxqh.assetdispo;

import psdi.mbo.*;
import psdi.server.MXServer;
import psdi.util.MXException;

import java.rmi.RemoteException;

/**
 * 变卖收入币种-填写数值后，自动触发
 * createby liuxq 2023-6-17
 */
public class FldSELLSR extends MboValueAdapter {

    public FldSELLSR(MboValue mbv) throws MXException,RemoteException {
        super(mbv);
    }

    public void init() throws RemoteException, MXException {
        super.init();
    }
    public void action() throws RemoteException, MXException {
        //获取对象
        super.action();
        MboRemote mbo=getMboValue().getMbo();
        String appname=mbo.getThisMboSet().getApp();
        Double SELLSR = mbo.getDouble("SELLSR");//变卖收入金额（变卖币种）
        String COIN = mbo.getString("COIN");//货币
        String COINRATE = mbo.getString("COINRATE");//货币
        Double rate = Double.parseDouble(COINRATE);
       /* if(COIN!=null && !"".equals(COIN)){
            MboSetRemote coinrateSet = MXServer.getMXServer().getMboSet("COINRATE",MXServer.getMXServer().getSystemUserInfo());
            coinrateSet.setWhere("coinnum='"+COIN+"'");
            coinrateSet.setOrderBy(" DESCRIPTION DESC");
            MboRemote coinMbo = coinrateSet.getMbo(0);
            rate = coinMbo.getDouble("RATE");
        }*/
        Double SELLSRCNY = SELLSR / rate;
        mbo.setValue("SELLSRCNY",SELLSRCNY,2L);//变卖收入金额（CNY）
    }

    public MboSetRemote getList() throws RemoteException, MXException {
        MboRemote mbo = getMboValue().getMbo();
        //设置 where 后面的条件，直接写查询条件
        String sql = " 1=1 ";
        return super.getList();
    }
}