Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xiaoshi 2025-06-11 16:47:25 +08:00
commit 550844c1d2
1 changed files with 50 additions and 8 deletions

View File

@ -40,11 +40,40 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* 入库单发票导入插件
* 入库单发票导入插件+事物类型默认为空+是否主材隐显
*/
public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn implements Plugin {
private static final Log log = LogFactory.getLog(MaterialInbFinaceConfirmeInvoicePlugin.class);
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
this.getModel().setValue("transtype", null);//事务类型默认为空
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String key = e.getProperty().getName();
if (key.equals("transtype")) {
//事务类型
ChangeData[] changeSet = e.getChangeSet();
ChangeData changeData = changeSet[0];
DynamicObject transtype = (DynamicObject) changeData.getNewValue();//新值
if (transtype != null) {
String number = transtype.getString("number");
if (number.equals("jrjc")) {
//事务类型为即入即出时隐藏是否主材
this.getView().setVisible(false, "ismainmaterial");//是否主材
} else {
this.getView().setVisible(true, "ismainmaterial");//是否主材
}
} else {
this.getView().setVisible(true, "ismainmaterial");//是否主材
}
}
}
@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args);
@ -99,17 +128,30 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
filter.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
QFilter filter1 = new QFilter("isclaimed", "=", true);
filter1.and(new QFilter("billstatus", "=", "C"));
// DynamicObject contract = (DynamicObject) this.getModel().getValue("zcgj_contract");
// if (contract != null) {
// long contractId = contract.getLong("id");
// filter1.and(new QFilter("contract", "=", contractId));
filter1.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");
DynamicObject contract = (DynamicObject) this.getModel().getValue("contract");//合同
String matinsource = (String) this.getModel().getValue("matinsource");//入库来源
if (contract != null && matinsource.equals("1")) {
//入库来源为合同清单且合同字段不为空时使用合同过滤
long contractId = contract.getLong("id");
filter1.and(new QFilter("contract", "=", contractId));
filter1.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
} else {
//入库来源不为合同时根据项目过滤
DynamicObject project = (DynamicObject) this.getModel().getValue("project");//项目
if (project != null) {
DynamicObject ec_in_invoice = BusinessDataServiceHelper.loadSingle("ec_in_invoice",
new QFilter("project.billno", "=", project.getString("billno")).toArray());//进项发票登记
if (ec_in_invoice != null) {
filter1.and(new QFilter("invoiceno", "=", ec_in_invoice.getString("invoiceno")));//发票号码
}
}
}
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("zcgj_entryentity");//发票分录
if (contInvEntryCol.size() > 0) {
List<Long> selectedInvIds = new ArrayList(8);
for (DynamicObject contInvEntryObj : contInvEntryCol) {
DynamicObject invoice = contInvEntryObj.getDynamicObject("zcgj_invoice");
DynamicObject invoice = contInvEntryObj.getDynamicObject("zcgj_invoice");//发票号码
selectedInvIds.add(invoice.getLong("id"));
}