diff --git a/lc123/cloud/app/plugin/form/result/OtherOutApplyFormPlugin.java b/lc123/cloud/app/plugin/form/result/OtherOutApplyFormPlugin.java new file mode 100644 index 0000000..b5f1db2 --- /dev/null +++ b/lc123/cloud/app/plugin/form/result/OtherOutApplyFormPlugin.java @@ -0,0 +1,97 @@ +package tqq9.lc123.cloud.app.plugin.form.result; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +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.util.StringUtils; +import tqq9.lc123.cloud.app.plugin.utils.BillCloseCancelUtils; +import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; + +import java.util.EventObject; + +//其他出库申请单(单据取消) + +public class OtherOutApplyFormPlugin extends AbstractBillPlugIn { + + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + this.addItemClickListeners("tbmain"); + + } + + + @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 message = null; + DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", + "id,billno,org,tqq9_biztype,tqq9_ckck,tqq9_bsckfl", + new QFilter[]{new QFilter("billno", QCP.equals, billNo)}); + + String entityType = "tqq9_otheroutapply"; + String entityName; + String label = "tqq9_isclose"; + DynamicObject org = dataEntity.getDynamicObject("org");//组织 + if (null != org) { + String number = org.getString("number"); + String tqq9_bsckfl = dataEntity.getString("tqq9_bsckfl");//报损出库分类 + String orderType = null;// + DynamicObject biztype = dataEntity.getDynamicObject("tqq9_biztype"); + String biztypeNumber = biztype.getString("number"); + switch (biztypeNumber) { + case "351": + orderType = "PKCK";//盘亏出库 + break; + case "612": + orderType = "DBCK";//调拨出库 + break; + case "616": + orderType = "YPCK";//样品出库 + break; + case "613"://礼品领用 + case "614"://展会领用 + case "615"://拍照领用 + orderType = "TZCK";//调整出库 + break; + } + + if ("617".equals(biztypeNumber)) { + //报损出库分类=过期报损 + if (tqq9_bsckfl.equals("C")) { + orderType = "GQCK";//过期出库 + } else { + orderType = "BSCK";//报损出库 + } + } + + if ("SHLC".equals(number)) { + DynamicObject tqq9_ckck = dataEntity.getDynamicObject("tqq9_ckck"); + String warehouseCode = tqq9_ckck != null ? tqq9_ckck.getString("number") : ""; + entityName = "WMS-SH-其他出库申请单取消"; + message = BillCloseCancelUtils.wmsCancel(orderType, warehouseCode, billNo, entityType, entityName, label); + } else if ("BJLC".equals(number)) { + String BJ_URL = ConfigUtils.getThirdConfigByNumber("BJ_POSTURL"); + entityName = "WMS-BJ-其他出库申请单取消"; + message = BillCloseCancelUtils.BGCloseOtherVouchOut(billNo, BJ_URL, entityType, entityName, label, orderType); + } else if ("GZLC".equals(number)) { + String GZURL = ConfigUtils.getThirdConfigByNumber("GZ_POSTURL"); + entityName = "WMS-GZ-其他出库申请单取消"; + message = BillCloseCancelUtils.BGCloseOtherVouchOut(billNo, GZURL, entityType, entityName, label, orderType); + } + if (StringUtils.isNotEmpty(message)) { + this.getView().showMessage(String.valueOf(message)); + } + + } + + } + } +} diff --git a/lc123/cloud/app/plugin/form/result/OtherOutApplyListPlugin.java b/lc123/cloud/app/plugin/form/result/OtherOutApplyListPlugin.java new file mode 100644 index 0000000..782c7ab --- /dev/null +++ b/lc123/cloud/app/plugin/form/result/OtherOutApplyListPlugin.java @@ -0,0 +1,106 @@ +package tqq9.lc123.cloud.app.plugin.form.result; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.datamodel.ListSelectedRow; +import kd.bos.entity.datamodel.ListSelectedRowCollection; +import kd.bos.form.control.events.ItemClickEvent; +import kd.bos.list.BillList; +import kd.bos.list.plugin.AbstractListPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +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; +import java.util.List; +import java.util.stream.Collectors; + +//其他出库申请单(单据取消) + +public class OtherOutApplyListPlugin extends AbstractListPlugin { + + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + //标准单据列表模板为bos_list,需使用该模板中的控件标识(如工具栏标识toolbarap)进行监听。 + // 列表插件继承AbstractListPlugin时,底层已默认注册工具栏监听,无需重复注册 + } + + + @Override + public void itemClick(ItemClickEvent evt) { + super.itemClick(evt); + String itemKey = evt.getItemKey(); + if ("tqq9_close".equals(itemKey)) { + BillList billList = this.getControl("billlistap"); + ListSelectedRowCollection selectedRows = billList.getSelectedRows(); + List billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList()); + for (String billNo : billnoList) { + String message = null; + DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", "id,billno,org,tqq9_biztype,tqq9_ckck,tqq9_bsckfl", + new QFilter[]{new QFilter("billno", QCP.equals, billNo)}); + + String entityType = "tqq9_otheroutapply"; + String entityName; + String label = "tqq9_isclose"; + DynamicObject org = dataEntity.getDynamicObject("org");//组织 + if (null != org) { + String number = org.getString("number"); + String tqq9_bsckfl = dataEntity.getString("tqq9_bsckfl");//报损出库分类 + String orderType = null;// + DynamicObject biztype = dataEntity.getDynamicObject("tqq9_biztype"); + String biztypeNumber = biztype.getString("number"); + switch (biztypeNumber) { + case "351": + orderType = "PKCK";//盘亏出库 + break; + case "612": + orderType = "DBCK";//调拨出库 + break; + case "616": + orderType = "YPCK";//样品出库 + break; + case "613"://礼品领用 + case "614"://展会领用 + case "615"://拍照领用 + orderType = "TZCK";//调整出库 + break; + } + + if ("617".equals(biztypeNumber)) { + //报损出库分类=过期报损 + if (tqq9_bsckfl.equals("C")) { + orderType = "GQCK";//过期出库 + } else { + orderType = "BSCK";//报损出库 + } + } + + if ("SHLC".equals(number)) { + DynamicObject tqq9_ckck = dataEntity.getDynamicObject("tqq9_ckck"); + String warehouseCode = tqq9_ckck != null ? tqq9_ckck.getString("number") : ""; + entityName = "WMS-SH-其他出库申请单取消"; + message = BillCloseCancelUtils.wmsCancel(orderType, warehouseCode, billNo, entityType, entityName, label); + } else if ("BJLC".equals(number)) { + String BJ_URL = ConfigUtils.getThirdConfigByNumber("BJ_POSTURL"); + entityName = "WMS-BJ-其他出库申请单取消"; + message = BillCloseCancelUtils.BGCloseOtherVouchOut(billNo, BJ_URL, entityType, entityName, label, orderType); + } else if ("GZLC".equals(number)) { + String GZURL = ConfigUtils.getThirdConfigByNumber("GZ_POSTURL"); + entityName = "WMS-GZ-其他出库申请单取消"; + message = BillCloseCancelUtils.BGCloseOtherVouchOut(billNo, GZURL, entityType, entityName, label, orderType); + } + if (StringUtils.isNotEmpty(message)) { + this.getView().showMessage(String.valueOf(message)); + } + + } + + } + + } + } +}