2025-11-03 10:25:45 +00:00
|
|
|
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.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");
|
|
|
|
|
|
2025-11-04 09:22:20 +00:00
|
|
|
}
|
2025-11-03 10:25:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@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;
|
2025-11-04 09:22:20 +00:00
|
|
|
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
|
2025-11-03 10:25:45 +00:00
|
|
|
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
|
|
|
|
|
2025-11-04 09:22:20 +00:00
|
|
|
String entityType = "pm_receiptnotice";
|
|
|
|
|
String entityName;
|
2025-11-04 09:41:04 +00:00
|
|
|
String label = "tqq9_isclose";
|
2025-11-03 10:25:45 +00:00
|
|
|
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";
|
2025-11-04 09:22:20 +00:00
|
|
|
entityName = "WMS-SH-收货通知单取消";
|
|
|
|
|
message = BillCloseCancelUtils.wmsCancel(orderType, warehouseCode, billNo, entityType, entityName, label);
|
2025-11-03 10:25:45 +00:00
|
|
|
} else if ("BJLC".equals(number)) {
|
|
|
|
|
String BJ_URL = ConfigUtils.getThirdConfigByNumber("BJ_POSTURL");
|
2025-11-04 09:22:20 +00:00
|
|
|
entityName = "WMS-BJ-收货通知单取消";
|
|
|
|
|
message = BillCloseCancelUtils.BGPurOrderCancel(billNo, BJ_URL, entityType, entityName, label);
|
2025-11-03 10:25:45 +00:00
|
|
|
|
|
|
|
|
} else if ("GZLC".equals(number)) {
|
|
|
|
|
String GZURL = ConfigUtils.getThirdConfigByNumber("GZ_POSTURL");
|
2025-11-04 09:22:20 +00:00
|
|
|
entityName = "WMS-GZ-收货通知单取消";
|
|
|
|
|
message = BillCloseCancelUtils.BGPurOrderCancel(billNo, GZURL, entityType, entityName, label);
|
2025-11-03 10:25:45 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(message)) {
|
|
|
|
|
this.getView().showMessage(String.valueOf(message));
|
2025-11-04 09:22:20 +00:00
|
|
|
|
2025-11-03 10:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|