package tqq9.lc123.cloud.app.plugin.form.result; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.form.control.events.ItemClickEvent; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.util.StringUtils; import tqq9.lc123.cloud.app.plugin.utils.BillCloseCancelUtils; import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; import java.util.EventObject; //收货通知单(单据取消) public class PmReceiptNoticeFormPlugin extends AbstractBillPlugIn { @Override public void registerListener(EventObject e) { super.registerListener(e); this.addItemClickListeners("tbmain"); //标准单据列表模板为bos_list,需使用该模板中的控件标识(如工具栏标识toolbarap)进行监听。 // 列表插件继承AbstractListPlugin时,底层已默认注册工具栏监听,无需重复注册 } //order.cancel // // //仓库编码, string (50),必填 ,统仓统配等无需ERP指定仓储编码的情况填OTHER //货主编码, string (50) //单据编码, string (50) ,必填 //仓储系统单据编码, string (50) ,条件必填 //单据类型, JYCK= 一般交易出库单,HHCK= 换货出库 ,BFCK= 补发出库 PTCK=普通出库单,DBCK=调拨出库 ,B2BRK=B2B入库,B2BCK=B2B出库,QTCK=其他出库, SCRK=生产入库,LYRK=领用入库,CCRK=残次品入库,CGRK=采购入库 ,DBRK= 调拨入库 ,QTRK= 其他入库 ,XTRK= 销退入库,THRK=退货入库,HHRK= 换货入库 ,CNJG= 仓内加工单 ,CGTH=采购退货出库单 //取消原因, string (500) // @Override public void itemClick(ItemClickEvent evt) { super.itemClick(evt); String itemKey = evt.getItemKey(); if ("tqq9_close".equals(itemKey)) { String billNo = (String) this.getModel().getValue("billno"); // String method = null;//接口方法名 String message = null; DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse,tqq9_isclose,tqq9_cancelresult,tqq9_cancelresult_tag", new QFilter[]{new QFilter("billno", QCP.equals, billNo)}); DynamicObject receiveorg = dataEntity.getDynamicObject("receiveorg");//收货组织 if (null != receiveorg) { String number = receiveorg.getString("number"); if ("SHLC".equals(number)) { DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry"); String warehouseCode = null; for (DynamicObject dynamicObject : billentry) { DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse"); if (null != warehouse) { warehouseCode = warehouse.getString("number"); } } String orderType = "CGRK"; message = BillCloseCancelUtils.wmsCancel(orderType, warehouseCode, billNo); this.getView().showMessage(message); } else if ("BJLC".equals(number)) { String BJ_URL = ConfigUtils.getThirdConfigByNumber("BJ_POSTURL"); message = BillCloseCancelUtils.BGPurOrderCancel(billNo, BJ_URL); } else if ("GZLC".equals(number)) { String GZURL = ConfigUtils.getThirdConfigByNumber("GZ_POSTURL"); message = BillCloseCancelUtils.BGPurOrderCancel(billNo, GZURL); } if (StringUtils.isNotEmpty(message)) { this.getView().showMessage(String.valueOf(message)); dataEntity.set("tqq9_cancelresult", message); dataEntity.set("tqq9_cancelresult_tag", message); if (message.contains("成功") || message.equalsIgnoreCase("success")) { dataEntity.set("tqq9_isclose", true); } else { dataEntity.set("tqq9_isclose", false); } SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } } } } }