入库单发票导入优化
This commit is contained in:
parent
8fc5d49a18
commit
15f1caf561
|
@ -44,16 +44,17 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn implements Plugin {
|
public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
private static final Log log = LogFactory.getLog(MaterialInbFinaceConfirmeInvoicePlugin.class);
|
private static final Log log = LogFactory.getLog(MaterialInbFinaceConfirmeInvoicePlugin.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
super.beforeDoOperation(args);
|
super.beforeDoOperation(args);
|
||||||
FormOperate operate = (FormOperate)args.getSource();
|
FormOperate operate = (FormOperate) args.getSource();
|
||||||
String key = operate.getOperateKey();
|
String key = operate.getOperateKey();
|
||||||
if (StringUtils.equals(key, "newsubentry")) { //选择发票
|
if (StringUtils.equals(key, "newsubentry")) { //选择发票
|
||||||
this.beforeNewSubEntry(args);
|
this.beforeNewSubEntry(args);
|
||||||
} else if (StringUtils.equals(key, "selectinvoice")) { //导入发票
|
} else if (StringUtils.equals(key, "selectinvoice")) { //导入发票
|
||||||
this.showInvoiceImport(args);
|
this.showInvoiceImport(args);
|
||||||
}else if (key.equals("deletesubentry")) {
|
} else if (key.equals("deletesubentry")) {
|
||||||
this.beforeDeleteSubEntry(args);
|
this.beforeDeleteSubEntry(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,8 +83,14 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showInvoice(String entryType) {
|
private void showInvoice(String entryType) {
|
||||||
long currencyId = ((DynamicObject)this.getModel().getValue("zcgj_currency")).getLong("id");
|
Boolean ismulticurrency = (Boolean) this.getModel().getValue("ismulticurrency");//多币别
|
||||||
long orgId = ((DynamicObject)this.getModel().getValue("zcgj_invoice_org")).getLong("id");
|
long currencyId = 0L;
|
||||||
|
if (ismulticurrency) {
|
||||||
|
currencyId = ((DynamicObject) this.getModel().getValue("currency")).getLong("id");//签约币别
|
||||||
|
} else {
|
||||||
|
currencyId = ((DynamicObject) this.getModel().getValue("stdcurrency")).getLong("id");//本位币别
|
||||||
|
}
|
||||||
|
long orgId = ((DynamicObject) this.getModel().getValue("fiaccountorg")).getLong("id");//财务记账组织
|
||||||
QFilter filter = new QFilter("org", "=", orgId);
|
QFilter filter = new QFilter("org", "=", orgId);
|
||||||
filter.and(new QFilter("isclaimed", "=", false));
|
filter.and(new QFilter("isclaimed", "=", false));
|
||||||
filter.and(new QFilter("billstatus", "=", "C"));
|
filter.and(new QFilter("billstatus", "=", "C"));
|
||||||
|
@ -92,16 +99,16 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
filter.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
filter.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
||||||
QFilter filter1 = new QFilter("isclaimed", "=", true);
|
QFilter filter1 = new QFilter("isclaimed", "=", true);
|
||||||
filter1.and(new QFilter("billstatus", "=", "C"));
|
filter1.and(new QFilter("billstatus", "=", "C"));
|
||||||
DynamicObject contract = (DynamicObject)this.getModel().getValue("zcgj_contract");
|
// DynamicObject contract = (DynamicObject) this.getModel().getValue("zcgj_contract");
|
||||||
if (contract != null) {
|
// if (contract != null) {
|
||||||
long contractId = contract.getLong("id");
|
// long contractId = contract.getLong("id");
|
||||||
filter1.and(new QFilter("contract", "=", contractId));
|
// filter1.and(new QFilter("contract", "=", contractId));
|
||||||
filter1.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
filter1.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
||||||
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
||||||
if (contInvEntryCol.size() > 0) {
|
if (contInvEntryCol.size() > 0) {
|
||||||
List<Long> selectedInvIds = new ArrayList(8);
|
List<Long> selectedInvIds = new ArrayList(8);
|
||||||
|
|
||||||
for(DynamicObject contInvEntryObj : contInvEntryCol) {
|
for (DynamicObject contInvEntryObj : contInvEntryCol) {
|
||||||
DynamicObject invoice = contInvEntryObj.getDynamicObject("zcgj_invoice");
|
DynamicObject invoice = contInvEntryObj.getDynamicObject("zcgj_invoice");
|
||||||
selectedInvIds.add(invoice.getLong("id"));
|
selectedInvIds.add(invoice.getLong("id"));
|
||||||
}
|
}
|
||||||
|
@ -115,15 +122,15 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
param.setCloseCallBack(new CloseCallBack(this, entryType));
|
param.setCloseCallBack(new CloseCallBack(this, entryType));
|
||||||
param.getOpenStyle().setShowType(ShowType.Modal);
|
param.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
this.getView().showForm(param);
|
this.getView().showForm(param);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void invoiceCloseCallBack(ClosedCallBackEvent event) {
|
protected void invoiceCloseCallBack(ClosedCallBackEvent event) {
|
||||||
ListSelectedRowCollection rows = (ListSelectedRowCollection)event.getReturnData();
|
ListSelectedRowCollection rows = (ListSelectedRowCollection) event.getReturnData();
|
||||||
DynamicObject[] invArr = new DynamicObject[rows.size()];
|
DynamicObject[] invArr = new DynamicObject[rows.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
DynamicObject upContract = (DynamicObject)this.getModel().getValue("zcgj_contract");
|
DynamicObject upContract = (DynamicObject) this.getModel().getValue("zcgj_contract");
|
||||||
for(ListSelectedRow row : rows) {
|
for (ListSelectedRow row : rows) {
|
||||||
Object invoicePk = row.getPrimaryKeyValue().toString();
|
Object invoicePk = row.getPrimaryKeyValue().toString();
|
||||||
int rowIndex = this.getModel().createNewEntryRow("zcgj_entryentity");
|
int rowIndex = this.getModel().createNewEntryRow("zcgj_entryentity");
|
||||||
this.getModel().setValue("zcgj_invoice", invoicePk.toString(), rowIndex);
|
this.getModel().setValue("zcgj_invoice", invoicePk.toString(), rowIndex);
|
||||||
|
@ -138,7 +145,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
invArr[index++] = invoice;
|
invArr[index++] = invoice;
|
||||||
invoice.set("isclaimed", true);
|
invoice.set("isclaimed", true);
|
||||||
invoice.set("contract", upContract);
|
invoice.set("contract", upContract);
|
||||||
invoice.set("project", (DynamicObject)this.getModel().getValue("zcgj_project"));
|
invoice.set("project", (DynamicObject) this.getModel().getValue("zcgj_project"));
|
||||||
invoice.set("connecttype", "contract");
|
invoice.set("connecttype", "contract");
|
||||||
}
|
}
|
||||||
SaveServiceHelper.save(invArr);
|
SaveServiceHelper.save(invArr);
|
||||||
|
@ -149,8 +156,8 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
int rowCount = this.getModel().getEntryRowCount(entryId);
|
int rowCount = this.getModel().getEntryRowCount(entryId);
|
||||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
for(int i = 0; i < rowCount; ++i) {
|
for (int i = 0; i < rowCount; ++i) {
|
||||||
BigDecimal amount = (BigDecimal)this.getModel().getValue(columnId, i);
|
BigDecimal amount = (BigDecimal) this.getModel().getValue(columnId, i);
|
||||||
amount = amount == null ? BigDecimal.ZERO : amount;
|
amount = amount == null ? BigDecimal.ZERO : amount;
|
||||||
totalAmount = totalAmount.add(amount);
|
totalAmount = totalAmount.add(amount);
|
||||||
}
|
}
|
||||||
|
@ -163,16 +170,16 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
protected void showInvoiceImport(BeforeDoOperationEventArgs args) {
|
protected void showInvoiceImport(BeforeDoOperationEventArgs args) {
|
||||||
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
||||||
if (!billId.equals("0") && "A".equals(this.getModel().getValue("billstatus"))) {
|
if (!billId.equals("0") && "A".equals(this.getModel().getValue("billstatus"))) {
|
||||||
if (this.getModel().getValue("zcgj_invoice_org") == null) {
|
if (this.getModel().getValue("fiaccountorg") == null) {
|
||||||
this.getView().showTipNotification(ResManager.loadKDString("发票企业名称不能为空", "PaymentApplyEditUI_18", "ec-contract-formplugin", new Object[0]));
|
this.getView().showTipNotification(ResManager.loadKDString("发票企业名称不能为空", "PaymentApplyEditUI_18", "ec-contract-formplugin", new Object[0]));
|
||||||
args.setCancel(true);
|
args.setCancel(true);
|
||||||
} else {
|
} else {
|
||||||
if (!ImportInvoiceUtils.isXhInvoiceCloud()) {
|
if (!ImportInvoiceUtils.isXhInvoiceCloud()) {
|
||||||
args.setCancel(true);
|
args.setCancel(true);
|
||||||
ImportInvoiceUtils.showImportView(this);
|
ImportInvoiceUtils.showImportView(this);
|
||||||
}else{
|
} else {
|
||||||
args.setCancel(true);
|
args.setCancel(true);
|
||||||
DynamicObject org = (DynamicObject) this.getModel().getValue("zcgj_invoice_org");
|
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||||
InvoiceCollectHelper.showSelectInvoice(this, org);
|
InvoiceCollectHelper.showSelectInvoice(this, org);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,11 +190,18 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void importInvoiceCallBack(Object returnData) {
|
protected void importInvoiceCallBack(Object returnData) {
|
||||||
DynamicObject org = (DynamicObject)this.getModel().getValue("zcgj_invoice_org");
|
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||||
//List<InvoiceVO> invoiceVOList = InvoiceDataHandleHelper.parseXhInvoiceCloudReturnData(returnData);
|
//List<InvoiceVO> invoiceVOList = InvoiceDataHandleHelper.parseXhInvoiceCloudReturnData(returnData);
|
||||||
List<InvoiceVO> invoiceVOList = CustomInvoiceDataHandleHelper.parseXhInvoiceCloudReturnData(returnData);
|
List<InvoiceVO> invoiceVOList = CustomInvoiceDataHandleHelper.parseXhInvoiceCloudReturnData(returnData);
|
||||||
|
Boolean ismulticurrency = (Boolean) this.getModel().getValue("ismulticurrency");//多币别
|
||||||
|
DynamicObject currency = null;
|
||||||
|
if (ismulticurrency) {
|
||||||
|
currency = (DynamicObject) this.getModel().getValue("currency");//签约币别
|
||||||
|
} else {
|
||||||
|
currency = (DynamicObject) this.getModel().getValue("stdcurrency");//本位币别
|
||||||
|
}
|
||||||
Map<Boolean, Set<DynamicObject>> invoiceMap = InvoiceDataHandleHelper.processInvoiceVO(invoiceVOList, RequestContext.get().getCurrUserId(),
|
Map<Boolean, Set<DynamicObject>> invoiceMap = InvoiceDataHandleHelper.processInvoiceVO(invoiceVOList, RequestContext.get().getCurrUserId(),
|
||||||
org.getLong("id"), new Date(), "ec_in_invoice", (DynamicObject)this.getModel().getValue("zcgj_currency"), true);
|
org.getLong("id"), new Date(), "ec_in_invoice", currency, true);
|
||||||
ImportInvoiceUtils invoiceUtils = new ImportInvoiceUtils(this.getView(), this.getPageCache());
|
ImportInvoiceUtils invoiceUtils = new ImportInvoiceUtils(this.getView(), this.getPageCache());
|
||||||
this.addInvoiceToEntry(invoiceUtils, invoiceMap);
|
this.addInvoiceToEntry(invoiceUtils, invoiceMap);
|
||||||
}
|
}
|
||||||
|
@ -196,11 +210,11 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
if (invoiceMap.isEmpty()) {
|
if (invoiceMap.isEmpty()) {
|
||||||
this.getView().showTipNotification(ResManager.loadKDString("导入发票为空。", "PaymentApplyEditUI_19", "ec-contract-formplugin", new Object[0]));
|
this.getView().showTipNotification(ResManager.loadKDString("导入发票为空。", "PaymentApplyEditUI_19", "ec-contract-formplugin", new Object[0]));
|
||||||
} else {
|
} else {
|
||||||
long orgId = (Long)((DynamicObject)this.getModel().getValue("zcgj_invoice_org")).getPkValue();
|
long orgId = (Long) ((DynamicObject) this.getModel().getValue("fiaccountorg")).getPkValue();
|
||||||
Set<DynamicObject> newInvoices = (Set)invoiceMap.get(Boolean.TRUE);
|
Set<DynamicObject> newInvoices = (Set) invoiceMap.get(Boolean.TRUE);
|
||||||
Set<DynamicObject> existInvoices = (Set)invoiceMap.get(Boolean.FALSE);
|
Set<DynamicObject> existInvoices = (Set) invoiceMap.get(Boolean.FALSE);
|
||||||
if (newInvoices != null && !newInvoices.isEmpty()) {
|
if (newInvoices != null && !newInvoices.isEmpty()) {
|
||||||
for(DynamicObject newInvoice : newInvoices) {
|
for (DynamicObject newInvoice : newInvoices) {
|
||||||
DynamicObject buyerOrg = newInvoice.getDynamicObject("buyer");
|
DynamicObject buyerOrg = newInvoice.getDynamicObject("buyer");
|
||||||
if (buyerOrg != null && buyerOrg.getLong("id") != orgId) {
|
if (buyerOrg != null && buyerOrg.getLong("id") != orgId) {
|
||||||
this.getView().showErrorNotification(ResManager.loadKDString("导入失败:当前发票购买方不为当前财务记账组织,请确认信息。", "PaymentApplyEditUI_20", "ec-contract-formplugin", new Object[0]));
|
this.getView().showErrorNotification(ResManager.loadKDString("导入失败:当前发票购买方不为当前财务记账组织,请确认信息。", "PaymentApplyEditUI_20", "ec-contract-formplugin", new Object[0]));
|
||||||
|
@ -211,7 +225,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
this.saveInvoiceData(invoiceUtils, newInvoices, existInvoices);
|
this.saveInvoiceData(invoiceUtils, newInvoices, existInvoices);
|
||||||
} else if (existInvoices != null) {
|
} else if (existInvoices != null) {
|
||||||
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
||||||
Map<Object, Object> entryMap = (Map)contInvEntryCol.stream().collect(Collectors.toMap(this::getInvoicePK, this::getInvoicePK));
|
Map<Object, Object> entryMap = (Map) contInvEntryCol.stream().collect(Collectors.toMap(this::getInvoicePK, this::getInvoicePK));
|
||||||
this.initSubEntryEntity(existInvoices, entryMap);
|
this.initSubEntryEntity(existInvoices, entryMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,21 +238,21 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
newInvoices.addAll(existInvoices);
|
newInvoices.addAll(existInvoices);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initSubEntryEntity(newInvoices, (Map)null);
|
this.initSubEntryEntity(newInvoices, (Map) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initSubEntryEntity(Set<DynamicObject> invoices, Map<Object, Object> entryMap) {
|
protected void initSubEntryEntity(Set<DynamicObject> invoices, Map<Object, Object> entryMap) {
|
||||||
if (invoices != null) {
|
if (invoices != null) {
|
||||||
List<DynamicObject> invArr = new ArrayList(invoices.size());
|
List<DynamicObject> invArr = new ArrayList(invoices.size());
|
||||||
for(DynamicObject invoice : invoices) {
|
for (DynamicObject invoice : invoices) {
|
||||||
if (entryMap != null && entryMap.get(invoice.getPkValue()) != null) {
|
if (entryMap != null && entryMap.get(invoice.getPkValue()) != null) {
|
||||||
this.getView().showTipNotification(String.format(ResManager.loadKDString("发票号码%s,已存在分录行", "PaymentApplyEditUI_22", "ec-contract-formplugin", new Object[0]), invoice.getString("invoiceno")));
|
this.getView().showTipNotification(String.format(ResManager.loadKDString("发票号码%s,已存在分录行", "PaymentApplyEditUI_22", "ec-contract-formplugin", new Object[0]), invoice.getString("invoiceno")));
|
||||||
} else {
|
} else {
|
||||||
BigDecimal unApplyAmount = invoice.getBigDecimal("unapplyamount");
|
BigDecimal unApplyAmount = invoice.getBigDecimal("unapplyamount");
|
||||||
if (unApplyAmount != null && unApplyAmount.doubleValue() <= (double)0.0F) {
|
if (unApplyAmount != null && unApplyAmount.doubleValue() <= (double) 0.0F) {
|
||||||
this.getView().showTipNotification(String.format(ResManager.loadKDString("发票号码%s,金额已经被关联完毕,不可重复使用", "PaymentApplyEditUI_23", "ec-contract-formplugin", new Object[0]), invoice.getString("invoiceno")));
|
this.getView().showTipNotification(String.format(ResManager.loadKDString("发票号码%s,金额已经被关联完毕,不可重复使用", "PaymentApplyEditUI_23", "ec-contract-formplugin", new Object[0]), invoice.getString("invoiceno")));
|
||||||
} else {
|
} else {
|
||||||
DynamicObject upContract = (DynamicObject)this.getModel().getValue("zcgj_contract");
|
DynamicObject upContract = (DynamicObject) this.getModel().getValue("zcgj_contract");
|
||||||
int rowIndex = this.getModel().createNewEntryRow("zcgj_entryentity");
|
int rowIndex = this.getModel().createNewEntryRow("zcgj_entryentity");
|
||||||
this.getModel().setValue("zcgj_invoice", invoice.getPkValue(), rowIndex);
|
this.getModel().setValue("zcgj_invoice", invoice.getPkValue(), rowIndex);
|
||||||
this.getModel().setValue("zcgj_invoicecurrency", invoice.getDynamicObject("currency") == null ? Long.valueOf("0") : invoice.getDynamicObject("currency").getPkValue(), rowIndex);
|
this.getModel().setValue("zcgj_invoicecurrency", invoice.getDynamicObject("currency") == null ? Long.valueOf("0") : invoice.getDynamicObject("currency").getPkValue(), rowIndex);
|
||||||
|
@ -250,7 +264,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
this.getModel().setValue("zcgj_applyinvoftaxamt", invoice.getBigDecimal("unapplyamount"), rowIndex);
|
this.getModel().setValue("zcgj_applyinvoftaxamt", invoice.getBigDecimal("unapplyamount"), rowIndex);
|
||||||
invoice.set("isclaimed", true);
|
invoice.set("isclaimed", true);
|
||||||
invoice.set("contract", upContract);
|
invoice.set("contract", upContract);
|
||||||
invoice.set("project", (DynamicObject)this.getModel().getValue("zcgj_project"));
|
invoice.set("project", (DynamicObject) this.getModel().getValue("zcgj_project"));
|
||||||
invoice.set("connecttype", "contract");
|
invoice.set("connecttype", "contract");
|
||||||
invArr.add(invoice);
|
invArr.add(invoice);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +272,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invArr.size() > 0) {
|
if (invArr.size() > 0) {
|
||||||
SaveServiceHelper.save((DynamicObject[])invArr.toArray(new DynamicObject[invoices.size()]));
|
SaveServiceHelper.save((DynamicObject[]) invArr.toArray(new DynamicObject[invoices.size()]));
|
||||||
}
|
}
|
||||||
this.getView().invokeOperation("invoicesave");
|
this.getView().invokeOperation("invoicesave");
|
||||||
}
|
}
|
||||||
|
@ -271,7 +285,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
|
|
||||||
//删除发票 开始
|
//删除发票 开始
|
||||||
protected void beforeDeleteSubEntry(BeforeDoOperationEventArgs args) {
|
protected void beforeDeleteSubEntry(BeforeDoOperationEventArgs args) {
|
||||||
EntryGrid subGrid = (EntryGrid)this.getControl("zcgj_entryentity");
|
EntryGrid subGrid = (EntryGrid) this.getControl("zcgj_entryentity");
|
||||||
int[] selRows = subGrid.getEntryState().getSelectedRows();
|
int[] selRows = subGrid.getEntryState().getSelectedRows();
|
||||||
if (selRows.length == 0) {
|
if (selRows.length == 0) {
|
||||||
this.getView().showMessage(ResManager.loadKDString("请选择发票。", "PaymentApplyEditUI_3", "ec-contract-formplugin", new Object[0]));
|
this.getView().showMessage(ResManager.loadKDString("请选择发票。", "PaymentApplyEditUI_3", "ec-contract-formplugin", new Object[0]));
|
||||||
|
@ -281,11 +295,11 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
Set<Object> updateInvoicePks = new HashSet(selRows.length);
|
Set<Object> updateInvoicePks = new HashSet(selRows.length);
|
||||||
DynamicObjectCollection subEntryEntityCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
DynamicObjectCollection subEntryEntityCol = this.getModel().getEntryEntity("zcgj_entryentity");
|
||||||
|
|
||||||
for(int i = selRows.length - 1; i >= 0; --i) {
|
for (int i = selRows.length - 1; i >= 0; --i) {
|
||||||
int rowIndex = selRows[i];
|
int rowIndex = selRows[i];
|
||||||
DynamicObject invoice = (DynamicObject)this.getModel().getValue("zcgj_invoice", rowIndex);
|
DynamicObject invoice = (DynamicObject) this.getModel().getValue("zcgj_invoice", rowIndex);
|
||||||
updateInvoicePks.add(invoice.getPkValue());
|
updateInvoicePks.add(invoice.getPkValue());
|
||||||
delPks[i] = ((DynamicObject)subEntryEntityCol.get(selRows[i])).getPkValue();
|
delPks[i] = ((DynamicObject) subEntryEntityCol.get(selRows[i])).getPkValue();
|
||||||
this.getModel().deleteEntryRow("zcgj_entryentity", rowIndex);
|
this.getModel().deleteEntryRow("zcgj_entryentity", rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +311,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
filter.and("id", "!=", this.getModel().getDataEntity().getPkValue());
|
filter.and("id", "!=", this.getModel().getDataEntity().getPkValue());
|
||||||
DynamicObjectCollection invoiceApplyEntries = QueryServiceHelper.query("zcgj_ecma_materialinb_ext", "zcgj_entryentity.zcgj_invoice", new QFilter[]{filter});
|
DynamicObjectCollection invoiceApplyEntries = QueryServiceHelper.query("zcgj_ecma_materialinb_ext", "zcgj_entryentity.zcgj_invoice", new QFilter[]{filter});
|
||||||
if (invoiceApplyEntries != null && !invoiceApplyEntries.isEmpty()) {
|
if (invoiceApplyEntries != null && !invoiceApplyEntries.isEmpty()) {
|
||||||
for(DynamicObject subEntry : invoiceApplyEntries) {
|
for (DynamicObject subEntry : invoiceApplyEntries) {
|
||||||
updateInvoicePks.remove(subEntry.get("zcgj_entryentity.zcgj_invoice"));
|
updateInvoicePks.remove(subEntry.get("zcgj_entryentity.zcgj_invoice"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,11 +320,11 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
DynamicObject[] invoices = BusinessDataServiceHelper.load("ec_in_invoice", "isinvoiceclaim,isclaimed,contract,project,connecttype",
|
DynamicObject[] invoices = BusinessDataServiceHelper.load("ec_in_invoice", "isinvoiceclaim,isclaimed,contract,project,connecttype",
|
||||||
new QFilter[]{new QFilter("id", "in", updateInvoicePks)});
|
new QFilter[]{new QFilter("id", "in", updateInvoicePks)});
|
||||||
|
|
||||||
for(DynamicObject invoice : invoices) {
|
for (DynamicObject invoice : invoices) {
|
||||||
if (!invoice.getBoolean("isinvoiceclaim")) {
|
if (!invoice.getBoolean("isinvoiceclaim")) {
|
||||||
invoice.set("isclaimed", false);
|
invoice.set("isclaimed", false);
|
||||||
invoice.set("contract", (Object)null);
|
invoice.set("contract", (Object) null);
|
||||||
invoice.set("project", (Object)null);
|
invoice.set("project", (Object) null);
|
||||||
invoice.set("connecttype", "null");
|
invoice.set("connecttype", "null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue