98 lines
4.0 KiB
Java
98 lines
4.0 KiB
Java
|
|
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 OtherInApplyFormPlugin 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_otherinapply",
|
||
|
|
"id,billno,org,billentry.warehouse,biztype",
|
||
|
|
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||
|
|
|
||
|
|
String entityType = "tqq9_otherinapply";
|
||
|
|
String entityName;
|
||
|
|
String label = "";
|
||
|
|
DynamicObject org = dataEntity.getDynamicObject("org");//库存组织
|
||
|
|
if (null != org) {
|
||
|
|
String number = org.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;//
|
||
|
|
DynamicObject biztype = dataEntity.getDynamicObject("biztype");
|
||
|
|
String biztypeNumber = biztype.getString("number");
|
||
|
|
switch (biztypeNumber) {
|
||
|
|
case "350":
|
||
|
|
orderType = "PYRK";
|
||
|
|
break;
|
||
|
|
case "605":
|
||
|
|
orderType = "DBRK";
|
||
|
|
break;
|
||
|
|
case "606":
|
||
|
|
orderType = "ZPRK";
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
orderType = "TZRK";
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
label = "tqq9_isclosesh";
|
||
|
|
entityName = "WMS-SH-其他入库申请单取消";
|
||
|
|
message = BillCloseCancelUtils.wmsCancel(orderType, warehouseCode, billNo, entityType, entityName, label);
|
||
|
|
} else if ("BJLC".equals(number)) {
|
||
|
|
String BJ_URL = ConfigUtils.getThirdConfigByNumber("BJ_POSTURL");
|
||
|
|
label = "tqq9_isclosebj";
|
||
|
|
entityName = "WMS-BJ-其他入库申请单取消";
|
||
|
|
message = BillCloseCancelUtils.BGCloseOtherVouchIn(billNo, BJ_URL, entityType, entityName, label);
|
||
|
|
|
||
|
|
} else if ("GZLC".equals(number)) {
|
||
|
|
String GZURL = ConfigUtils.getThirdConfigByNumber("GZ_POSTURL");
|
||
|
|
label = "tqq9_isclosegz";
|
||
|
|
entityName = "WMS-GZ-其他入库申请单取消";
|
||
|
|
message = BillCloseCancelUtils.BGCloseOtherVouchIn(billNo, GZURL, entityType, entityName, label);
|
||
|
|
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotEmpty(message)) {
|
||
|
|
this.getView().showMessage(String.valueOf(message));
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|