lc/lc123/cloud/app/plugin/form/pm/PurRefundApplyBillPlugin.java

142 lines
7.6 KiB
Java

package tqq9.lc123.cloud.app.plugin.form.pm;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.form.field.BasedataEdit;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import java.util.EventObject;
/**
* 采购退货界面插件
*/
public class PurRefundApplyBillPlugin extends AbstractBillPlugIn {
private final static Log logger = LogFactory.getLog(PurorderEntryIntroPaybillPlugin.class);
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
this.addItemClickListeners("tbmain");
BasedataEdit tqq9_ph = this.getControl("tqq9_ph");
// tqq9_ph.addBeforeF7SelectListener(this);
}
// @Override
// public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
// super.closedCallBack(closedCallBackEvent);
// String actionId = closedCallBackEvent.getActionId();
// Object returnData = closedCallBackEvent.getReturnData();
// if (StringUtils.equals("tqq9_otheroutapply", actionId) && returnData != null) {
// String billno = ((HashMap) returnData).get("billno").toString();
// DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
// this.getModel().setValue("tqq9_yythbillno", tqq9_otheroutapply);
// SaveServiceHelper.save(new DynamicObject[]{this.getModel().getDataEntity(true)});
// this.getView().updateView();
// }
// }
// /**
// * 异地退货返回事件
// */
//
//
// @Override
// public void beforeDoOperation(BeforeDoOperationEventArgs args) {
// super.beforeDoOperation(args);
// FormOperate Operate = (FormOperate) args.getSource();
// Boolean tqq9_isydth = (Boolean) this.getModel().getValue("tqq9_isydth");//是否异地退货
// DynamicObject tqq9_yythbillno = (DynamicObject) this.getModel().getValue("tqq9_yythbillno");//异地退货单号
// String tqq9_ydthno = null;
// if (tqq9_yythbillno != null) {
// tqq9_ydthno = tqq9_yythbillno.getString("billno");
// }
// if (StringUtils.equals("save", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isBlank(tqq9_ydthno)) {
// BillShowParameter param = new BillShowParameter();
// param.setFormId("tqq9_otheroutapply");
// param.setCustomParam("tqq9_otheroutapplybillno", this.getModel().getValue("billno"));//采购退货申请单号
// param.setCloseCallBack(new CloseCallBack(this, "tqq9_otheroutapply"));
// param.getOpenStyle().setShowType(ShowType.Modal);
// this.getView().showForm(param);
// } else if (StringUtils.equals("submit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)) {
// DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
// if (StringUtils.equals(tqq9_otheroutapply.getString("billstatus"), "A")) {
// args.setCancel(true);
// String billno = this.getModel().getValue("billno").toString();
// this.getView().showErrorNotification("采购退货单:" + billno + ",对应的异地退货单号:" + tqq9_ydthno + "未提交");
// }
// } else if (StringUtils.equals("audit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)) {
// DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
// String billstatus = tqq9_otheroutapply.getString("billstatus");
// if (StringUtils.equals("B", billstatus)) {
// OperateOption operateOption = OperateOption.create();
// OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, "tqq9_otheroutapply", new DynamicObject[]{tqq9_otheroutapply}, operateOption);
// if (auditResult.isSuccess()) {
// this.getView().showMessage("异地退货审核成功");
// }
// }
// }
// }
// /**
// * 出库批号根据了做筛选
// */
//
// @Override
// public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
// String name = beforeF7SelectEvent.getProperty().getName();
// if (StringUtils.equals("tqq9_ph", name)) {
// int index = this.getModel().getEntryCurrentRowIndex("billentry");
// DynamicObjectCollection entryentity = this.getModel().getDataEntity(true).getDynamicObjectCollection("billentry");
// DynamicObject dynamicObject = entryentity.get(index);
// DynamicObject material = dynamicObject.getDynamicObject("material");//物料采购信息
// if (material == null) {
// beforeF7SelectEvent.setCancel(true);
// this.getView().showMessage("请先填物料信息");
// } else {
// DynamicObject masterid = material.getDynamicObject("masterid");//物料
// DynamicObject bd_materialinventoryinfo = BusinessDataServiceHelper.loadSingle("bd_materialinventoryinfo", new QFilter[]{new QFilter("masterid", QCP.equals, masterid.getLong("id"))});
//
// Boolean enablelot = bd_materialinventoryinfo.getBoolean("enablelot");//是否启用批号管理
// if (enablelot) {
// ListShowParameter param = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
// QFilter qF1 = new QFilter("material.number", QCP.equals, masterid.getString("number"));
// param.getListFilterParameter().getQFilters().add(qF1);
//
// } else {
// beforeF7SelectEvent.setCancel(true);
// this.getView().showMessage("该物料未启用批号管理");
// }
// }
// }
// }
// @Override
// public void propertyChanged(PropertyChangedArgs e) {
// super.propertyChanged(e);
// String name = e.getProperty().getName();
// if (StringUtils.equals("tqq9_ph", name)) {
// ChangeData changeData = e.getChangeSet()[0];
// int rowIndex = changeData.getRowIndex();
// IDataModel model = this.getModel();
// DynamicObject material = (DynamicObject) model.getValue("material", rowIndex);//物料采购信息
// DynamicObject tqq9_ph = (DynamicObject) model.getValue("tqq9_ph", rowIndex);//批号
// if (material != null && tqq9_ph != null) {
// DynamicObject masterid = material.getDynamicObject("masterid");//物料
// if (masterid != null) {
// String id = masterid.getString("id");
// String tqq9_phno = tqq9_ph.getString("number");//批号
// String sql = "/*dialect*/ select sum(fbaseqty) useqty from t_im_inv_realbalance where fmaterialid ='" + id + "' and flotnum ='" + tqq9_phno + "'";
// DataSet pzDataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("scm"), sql);
// DataSet copy = pzDataSet.copy();
// DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
// if (dynamicObjects.size() > 0) {
// BigDecimal useqty = dynamicObjects.get(0).getBigDecimal("useqty");
// model.setValue("tqq9_pckyamount", useqty, rowIndex);
// this.getView().updateView();
// }
// }
// }
// }
// }
}