package com.yem.wm.es.shippingdetails.form;

import com.yem.wm.es.Util.PJUtils;
import com.yem.wm.es.Util.TotalUtil;
import com.yem.wm.es.Util.ZJUtils;
import com.yem.wm.im.clientdemand.utils.ClientUtils;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.IFormView;

/**
 * @author 张立攀
 * @version 1.0
 * @description    出运明细单-配件
 * @date 2023-08-16 17:51
 */
public class ShippingDetailsPJFormPlugin extends AbstractBillPlugIn {
    @Override
    public void propertyChanged(PropertyChangedArgs e) {
        IFormView view = this.getView();
        IDataModel model = this.getModel();
        ChangeData changeData = e.getChangeSet()[0];
        String name = e.getProperty().getName();
        int rowIndex = changeData.getRowIndex();
        switch(name){
            case "yem_reccondition" :
                ZJUtils.setSalesContracZJ(model);//选择收款条件时带出收款计划分录
                break;
            case "yem_qty" :
                PJUtils.countOrderSumNumberPJ(model);
                TotalUtil.setGiftGiving(model);
                ClientUtils.addSaAmountTk(model,rowIndex);//销售金额（价格条款）结算币别
                break;
            case "yem_lenghtunit" ://长度单位
            case "yem_vol" ://体积
                TotalUtil.countVolM3(model,rowIndex,"yem_lenghtunit","yem_vol","yem_volm3");;
                break;
        }

    }
}
