入库单发票导入优化
This commit is contained in:
parent
8fc5d49a18
commit
15f1caf561
|
@ -44,6 +44,7 @@ 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);
|
||||||
|
@ -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,10 +99,10 @@ 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) {
|
||||||
|
@ -115,7 +122,7 @@ 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) {
|
||||||
|
@ -163,7 +170,7 @@ 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 {
|
||||||
|
@ -172,7 +179,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
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,7 +210,7 @@ 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()) {
|
||||||
|
|
Loading…
Reference in New Issue