关闭拦截
This commit is contained in:
parent
1781ae1913
commit
8fe054087c
|
|
@ -22,7 +22,7 @@ public class CloneBill extends AbstractOperationServicePlugIn {
|
|||
private final static Log logger = LogFactory.getLog(CloneBill.class);
|
||||
|
||||
|
||||
public static String cloneOperation(DynamicObject dynamicObject, String entityName,String sourceEntityNumber) {
|
||||
public static String cloneOperation(DynamicObject dynamicObject, String entityName, String sourceEntityNumber) {
|
||||
String entityNumber = dynamicObject.getDataEntityType().getName();
|
||||
StringBuilder billnoSet = new StringBuilder();
|
||||
//找直接上游单据,将上游单据编号存在复制的单据上面
|
||||
|
|
@ -48,19 +48,23 @@ public class CloneBill extends AbstractOperationServicePlugIn {
|
|||
}
|
||||
}
|
||||
dynamicObject = BusinessDataServiceHelper.loadSingle(entityNumber, new QFilter[]{new QFilter("id", QCP.equals, dynamicObject.getLong("id"))});
|
||||
DynamicObject newData = (DynamicObject) new CloneUtils(false, true).clone(dynamicObject);
|
||||
newData.set("billno", dynamicObject.getString("billno"));
|
||||
newData.set("billstatus", "C");
|
||||
newData.set("tqq9_sourcebillno", billnoSet);
|
||||
SaveServiceHelper.save(new DynamicObject[]{newData});
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
OperationResult unauditResult = OperationServiceHelper.executeOperate("unaudit", entityNumber, new DynamicObject[]{dynamicObject}, OperateOption.create());
|
||||
if (unauditResult.isSuccess()) {
|
||||
OperationResult deleteResult = OperationServiceHelper.executeOperate("delete", entityNumber, new DynamicObject[]{dynamicObject}, OperateOption.create());
|
||||
|
||||
deleteResult.getAllErrorOrValidateInfo().forEach((error) -> {
|
||||
message.append(error.getMessage());
|
||||
});
|
||||
if (!deleteResult.isSuccess()) {
|
||||
deleteResult.getAllErrorOrValidateInfo().forEach((error) -> {
|
||||
message.append(error.getMessage());
|
||||
});
|
||||
}else {
|
||||
DynamicObject newData = (DynamicObject) new CloneUtils(false, true).clone(dynamicObject);
|
||||
newData.set("billno", dynamicObject.getString("billno"));
|
||||
newData.set("billstatus", "C");
|
||||
newData.set("tqq9_sourcebillno", billnoSet);
|
||||
SaveServiceHelper.save(new DynamicObject[]{newData});
|
||||
}
|
||||
|
||||
logger.info(entityName + dynamicObject.getString("billno") + "删除失败:" + message);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ public class OtherInApplyFormPlugin extends AbstractBillPlugIn {
|
|||
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)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "tqq9_otherinapply";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ public class OtherInApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (tqq9_isclose) {
|
||||
|
|
@ -70,8 +69,7 @@ public class OtherInApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (!tqq9_isclose) {
|
||||
|
|
@ -92,8 +90,7 @@ public class OtherInApplyListPlugin extends AbstractListPlugin {
|
|||
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
|
||||
for (String billNo : billnoList) {
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", "id,billno,org,billentry.warehouse,biztype",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otherinapply", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "tqq9_otherinapply";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ public class OtherOutApplyFormPlugin extends AbstractBillPlugIn {
|
|||
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)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "tqq9_otheroutapply";
|
||||
String entityName;
|
||||
|
|
@ -123,7 +121,7 @@ public class OtherOutApplyFormPlugin extends AbstractBillPlugIn {
|
|||
message = BillCloseCancelUtils.BGCloseOtherVouchOut(billNo, GZURL, entityType, entityName, label, orderType);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message) && message.contains("关闭成功")) {
|
||||
cloneOperation(dataEntity, "其他出库申请单","pm_purrefundapplybill");
|
||||
cloneOperation(dataEntity, "其他出库申请单", "pm_purrefundapplybill");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
this.getView().showMessage(String.valueOf(message));
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ public class OtherOutApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (tqq9_isclose) {
|
||||
|
|
@ -75,8 +74,7 @@ public class OtherOutApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (!tqq9_isclose) {
|
||||
|
|
@ -97,8 +95,7 @@ public class OtherOutApplyListPlugin extends AbstractListPlugin {
|
|||
List<String> 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)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "tqq9_otheroutapply";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ public class PmPurRefundApplyBillPlugin extends AbstractBillPlugIn {
|
|||
if ("tqq9_close".equals(itemKey)) {
|
||||
String billNo = (String) this.getModel().getValue("billno");
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", "id,billno,org,billentry.tqq9_thck",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_purrefundapplybill";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ public class PmPurRefundApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (tqq9_isclose) {
|
||||
|
|
@ -76,8 +75,7 @@ public class PmPurRefundApplyListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (!tqq9_isclose) {
|
||||
|
|
@ -98,8 +96,7 @@ public class PmPurRefundApplyListPlugin extends AbstractListPlugin {
|
|||
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
|
||||
for (String billNo : billnoList) {
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", "id,billno,org,billentry.tqq9_thck",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_purrefundapplybill", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_purrefundapplybill";
|
||||
String entityName;
|
||||
|
|
@ -131,7 +128,7 @@ public class PmPurRefundApplyListPlugin extends AbstractListPlugin {
|
|||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message) && message.contains("关闭成功")) {
|
||||
cloneOperation(dataEntity,"采购退货申请单","pm_purorderbill");
|
||||
cloneOperation(dataEntity, "采购退货申请单", "pm_purorderbill");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
this.getView().showMessage(String.valueOf(message));
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ public class PmReceiptNoticeFormPlugin extends AbstractBillPlugIn {
|
|||
if ("tqq9_close".equals(itemKey)) {
|
||||
String billNo = (String) this.getModel().getValue("billno");
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_receiptnotice";
|
||||
String entityName;
|
||||
|
|
@ -128,8 +127,7 @@ public class PmReceiptNoticeFormPlugin extends AbstractBillPlugIn {
|
|||
} else if ("tqq9_partclose".equals(itemKey)) {
|
||||
String billNo = (String) this.getModel().getValue("billno");
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_receiptnotice";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (tqq9_isclose) {
|
||||
|
|
@ -76,8 +75,7 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (!tqq9_isclose) {
|
||||
|
|
@ -98,8 +96,7 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin {
|
|||
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
|
||||
for (String billNo : billnoList) {
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_receiptnotice";
|
||||
String entityName;
|
||||
|
|
@ -166,8 +163,7 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin {
|
|||
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
|
||||
for (String billNo : billnoList) {
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "pm_receiptnotice";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ public class SmDeliverNoticeBillPlugin extends AbstractBillPlugIn {
|
|||
if ("tqq9_close".equals(itemKey)) {
|
||||
String billNo = (String) this.getModel().getValue("billno");
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", "id,billno,org,tqq9_ck",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "sm_delivernotice";
|
||||
String entityName;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ public class SmDeliverNoticeListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (tqq9_isclose) {
|
||||
|
|
@ -75,8 +74,7 @@ public class SmDeliverNoticeListPlugin extends AbstractListPlugin {
|
|||
evt.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", "id,billno,tqq9_isclose",
|
||||
new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", new QFilter[]{new QFilter("billno", QCP.in, billnoList)});
|
||||
if (null != dataEntity) {
|
||||
boolean tqq9_isclose = dataEntity.getBoolean("tqq9_isclose");
|
||||
if (!tqq9_isclose) {
|
||||
|
|
@ -97,8 +95,7 @@ public class SmDeliverNoticeListPlugin extends AbstractListPlugin {
|
|||
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
|
||||
for (String billNo : billnoList) {
|
||||
String message = null;
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", "id,billno,org,tqq9_ck",
|
||||
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("sm_delivernotice", new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
|
||||
|
||||
String entityType = "sm_delivernotice";
|
||||
String entityName;
|
||||
|
|
@ -126,7 +123,7 @@ public class SmDeliverNoticeListPlugin extends AbstractListPlugin {
|
|||
message = BillCloseCancelUtils.BGSaCancelSalesOrder(billNo, GZURL, entityType, entityName, label);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message) && message.contains("关闭成功")) {
|
||||
cloneOperation(dataEntity, "发货通知单","sm_salorder");
|
||||
cloneOperation(dataEntity, "发货通知单", "sm_salorder");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
this.getView().showMessage(String.valueOf(message));
|
||||
|
|
|
|||
Loading…
Reference in New Issue