Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
42a0b2cb1e
|
@ -199,6 +199,22 @@ public class TriprAutoCalWorkingDaysPlugin extends AbstractBillPlugIn implements
|
|||
return addDateSet;
|
||||
}
|
||||
|
||||
|
||||
public Set<LocalDate> calTripentryDay(Date startdate,Date enddate){
|
||||
int allHomeCount = 0;
|
||||
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity()
|
||||
.getDynamicObjectCollection("tripentry");
|
||||
Set<LocalDate> addDateSet = new HashSet<>();
|
||||
for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
||||
if(startdate!=null && enddate!=null){
|
||||
Set<LocalDate> datesExcludingWeekends = getWorkingDays(dateToLocalDate(startdate), dateToLocalDate(enddate));
|
||||
addDateSet.addAll(datesExcludingWeekends);
|
||||
}
|
||||
}
|
||||
|
||||
return addDateSet;
|
||||
}
|
||||
|
||||
//获取开始结束时间
|
||||
public static Set<LocalDate> getStartAndEnd(LocalDate startDate, LocalDate endDate) {
|
||||
Set<LocalDate> result = new HashSet<>();
|
||||
|
@ -242,11 +258,10 @@ public class TriprAutoCalWorkingDaysPlugin extends AbstractBillPlugIn implements
|
|||
}
|
||||
return workingDays;
|
||||
}else{
|
||||
if (startDate.isAfter(endDate)) {
|
||||
/*if (!startDate.isAfter(endDate)) {
|
||||
throw new IllegalArgumentException("开始日期不能晚于结束日期");
|
||||
}
|
||||
}*/
|
||||
LocalDate currentDate = startDate;
|
||||
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
if (!isWeekend(currentDate)) {
|
||||
workingDays.add(currentDate);
|
||||
|
|
|
@ -45,14 +45,16 @@ public class DailyReimbursSubOp extends AbstractOperationServicePlugIn {
|
|||
String zcgj_invoiceremark = dataEntity.getString("zcgj_invoiceremark");//特殊说明
|
||||
DynamicObjectCollection accountEntryCollection = dataEntity.getDynamicObjectCollection("accountentry");//收款信息
|
||||
if (accountEntryCollection.size() > 0) {
|
||||
for (int i = 0; i < accountEntryCollection.size(); i++) {
|
||||
DynamicObject accountEntry = accountEntryCollection.get(i);
|
||||
for (DynamicObject accountEntry : accountEntryCollection) {
|
||||
String payerType = accountEntry.getString("payertype");//收款人类型
|
||||
if (payerType.equals("er_payeer")) {
|
||||
DynamicObject payer = accountEntry.getDynamicObject("payer");//收款人(个人
|
||||
if (payer != null && applier != null) {
|
||||
String applierNumber = applier.getString("number");//申请人编号
|
||||
DynamicObject payer1 = payer.getDynamicObject("payer");
|
||||
DynamicObject payer1 = payer.getDynamicObject("payer");//收款人(个人-收款人
|
||||
if (payer1 == null) {
|
||||
return;
|
||||
}
|
||||
String payer1Number = payer1.getString("number");//收款人编号
|
||||
if (!applierNumber.equals(payer1Number) && "".equals(zcgj_invoiceremark)) {
|
||||
//申请人和收款人不一致
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.report;
|
||||
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.PackageDataEvent;
|
||||
import kd.bos.entity.report.FilterInfo;
|
||||
|
@ -9,6 +10,7 @@ import kd.bos.report.events.CellStyleRule;
|
|||
import kd.bos.report.events.SortAndFilterEvent;
|
||||
import kd.bos.report.plugin.AbstractReportFormPlugin;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -44,7 +46,8 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen
|
|||
IDataModel model = this.getModel();
|
||||
//获取当前登陆人所在组织
|
||||
long orgId = RequestContext.get().getOrgId();
|
||||
model.setValue("zcgj_query_org",orgId);
|
||||
DynamicObject orgByNumber = OrgCheckUtils.getOrgByNumber("10008253");//领导板班子成员部门编码
|
||||
model.setValue("zcgj_query_org",orgByNumber.getLong("id"));
|
||||
model.setValue("zcgj_query_year",new Date());
|
||||
}
|
||||
|
||||
|
@ -104,4 +107,5 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen
|
|||
ent.setSort(true);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@ public class OrgCheckUtils {
|
|||
* 判断是否为矿山
|
||||
*/
|
||||
public static boolean isKS(Long currentOrgId){
|
||||
QFilter costCompanyId = new QFilter("zcgj_costcompany.id", QCP.equals,currentOrgId);
|
||||
DynamicObject zcgj_minecompany = BusinessDataServiceHelper.loadSingle("zcgj_minecompany",
|
||||
"id", new QFilter[]{costCompanyId});//基础资料(矿山公司)
|
||||
if(zcgj_minecompany != null){
|
||||
return true;
|
||||
}
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,ksNumberTop);//中材矿山建设有限公司
|
||||
DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
|
||||
long orgId = adminOrg.getLong("id");
|
||||
|
@ -67,4 +73,13 @@ public class OrgCheckUtils {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为矿山
|
||||
*/
|
||||
public static DynamicObject getOrgByNumber(String orgNumber){
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,orgNumber);//中材矿山建设有限公司
|
||||
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
|
||||
return org;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||
import kd.fi.gl.util.DateUtil;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -35,6 +36,7 @@ import java.time.YearMonth;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugin {
|
||||
|
||||
|
@ -51,17 +53,6 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
super.itemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
if (itemKey.equals("zcgj_idle")){//闲置
|
||||
Set<Long> setIds = getSelectOrderIds(this.getSelectedRows());
|
||||
DynamicObject[] equipments = BusinessDataServiceHelper.load("eceq_equipment_card", "billno,billname,equipstatus", new QFilter[]{new QFilter("id", "in", setIds)});
|
||||
for (DynamicObject equipment : equipments) {
|
||||
equipment.set("equipstatus","FREE");
|
||||
}
|
||||
Object[] save = SaveServiceHelper.save(equipments);
|
||||
System.out.println();
|
||||
this.getView().showMessage("闲置成功!");
|
||||
IFormView view = this.getView();
|
||||
view.invokeOperation("refresh");
|
||||
} else if (itemKey.equals("zcgj_asset")) {//同步资产卡片
|
||||
Set<String> strings = new HashSet();
|
||||
DynamicObject[] equipmenttype = BusinessDataServiceHelper.load("zcgj_equipmenttype", "number,zcgj_assetcat",new QFilter[]{new QFilter("zcgj_assetcat.number", QCP.is_notnull,"" )});
|
||||
for (DynamicObject dynamicObject : equipmenttype) {
|
||||
|
@ -70,9 +61,19 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
strings.add(number) ;
|
||||
}
|
||||
}
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,"10006431");//中材矿山建设有限公司
|
||||
DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
|
||||
long orgId = adminOrg.getLong("id");
|
||||
List<Long> orgIds = new ArrayList<>(1);
|
||||
//orgIds.add(1692204547985902592L);
|
||||
orgIds.add(orgId);
|
||||
List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
|
||||
Set<Long> orgSer = subOrgIds.stream().collect(Collectors.toSet());
|
||||
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
||||
qFilter.and(new QFilter("assetunit.number", QCP.in, orgSer)) ;
|
||||
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
||||
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter});
|
||||
log.info("同步的实物数量有"+realcards.length);
|
||||
for (DynamicObject realcard : realcards) {
|
||||
String number = realcard.getString("number");//资产编码
|
||||
// DynamicObject assetcat = realcard.getDynamicObject("assetcat");//资产类别
|
||||
|
@ -107,17 +108,23 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
long timestamp=date.getTime(); //时间戳
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置格式
|
||||
String timeText=format.format(timestamp);
|
||||
DynamicObject eceq_equipment_card = BusinessDataServiceHelper.loadSingle("eceq_equipment_card", new QFilter[]{new QFilter("number", QCP.equals, number)});
|
||||
DynamicObject eceq_equipment_card = BusinessDataServiceHelper.loadSingle("eceq_equipment_card", new QFilter[]{new QFilter("zcgj_assetnumber", QCP.equals, number)});
|
||||
if (eceq_equipment_card!=null){
|
||||
equipmentcard.set("id",eceq_equipment_card.getLong("id"));
|
||||
String cardString = eceq_equipment_card.getString("number");
|
||||
if(!cardString.isEmpty() && cardString!=null){
|
||||
equipmentcard.set("number",cardString);//设备编号
|
||||
}else{
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
}
|
||||
}else{
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
}
|
||||
|
||||
equipmentcard.set("billno",timeText);//单据编号
|
||||
equipmentcard.set("status","C");//单据状态
|
||||
equipmentcard.set("billstatus","C");//
|
||||
equipmentcard.set("enable","1");//可用
|
||||
equipmentcard.set("property","OWN");//设备性质
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
equipmentcard.set("name",assetname);//设备名称
|
||||
equipmentcard.set("modelnum",model);//规格型号
|
||||
equipmentcard.set("indate",realaccountdate);//入库日期
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.bill.BillShowParameter;
|
||||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.events.BizDataEventArgs;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 资金计划申请插件
|
||||
*/
|
||||
public class FundingplanapplyPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
||||
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
||||
DynamicObjectCollection zcgjFinApprovedAmount = this.getModel().getDataEntity().getDynamicObjectCollection("zcgj_fin_approved_amount");
|
||||
String[] typeArray = new String[]{"XJ","YHCD","SYCD","GYL","QTJRCP"};
|
||||
for (String type : typeArray) {
|
||||
DynamicObject item = zcgjFinApprovedAmount.addNew();
|
||||
item.set("zcgj_setttype",type);
|
||||
}
|
||||
getView().updateView("zcgj_fin_approved_amount");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -281,8 +281,10 @@ public class InContractFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn im
|
|||
for(int i = selRows.length - 1; i >= 0; --i) {
|
||||
int rowIndex = selRows[i];
|
||||
DynamicObject invoice = (DynamicObject)this.getModel().getValue("zcgj_invoice", rowIndex);
|
||||
updateInvoicePks.add(invoice.getPkValue());
|
||||
delPks[i] = ((DynamicObject)subEntryEntityCol.get(selRows[i])).getPkValue();
|
||||
if (invoice != null) {
|
||||
updateInvoicePks.add(invoice.getPkValue());
|
||||
delPks[i] = ((DynamicObject)subEntryEntityCol.get(selRows[i])).getPkValue();
|
||||
}
|
||||
this.getModel().deleteEntryRow("zcgj_entryentity", rowIndex);
|
||||
}
|
||||
|
||||
|
|
|
@ -284,8 +284,10 @@ public class OutContractFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
|||
for(int i = selRows.length - 1; i >= 0; --i) {
|
||||
int rowIndex = selRows[i];
|
||||
DynamicObject invoice = (DynamicObject)this.getModel().getValue("zcgj_invoice", rowIndex);
|
||||
updateInvoicePks.add(invoice.getPkValue());
|
||||
delPks[i] = ((DynamicObject)subEntryEntityCol.get(selRows[i])).getPkValue();
|
||||
if(invoice!=null){
|
||||
updateInvoicePks.add(invoice.getPkValue());
|
||||
delPks[i] = ((DynamicObject)subEntryEntityCol.get(selRows[i])).getPkValue();
|
||||
}
|
||||
this.getModel().deleteEntryRow("zcgj_entryentity", rowIndex);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import kd.bos.bill.BillShowParameter;
|
|||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
|
@ -14,6 +15,7 @@ import kd.bos.mvc.bill.BillView;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -58,64 +60,20 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
/*if("person".equals(name)){
|
||||
String billFormId = ((BillView) this.getView()).getFormId();//单据标识
|
||||
if("ec_paymentapply".equals(billFormId)) {//付款申请单
|
||||
String name = e.getProperty().getName();
|
||||
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||
if(newValue !=null){
|
||||
long userid = newValue.getLong("id");
|
||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||
if(org!=null && orgsUserJoin!=null && !orgsUserJoin.isEmpty()){
|
||||
Set<Long> collect = new HashSet<>(orgsUserJoin);
|
||||
if(collect.contains(org.getLong("id"))){
|
||||
this.getModel().setValue("zcgj_persondepart", org.getLong("id"));
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
if("paymenttype".equals(name)){
|
||||
int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||
DynamicObjectCollection entryentity = (DynamicObjectCollection)dataEntity.get("entryentity");
|
||||
if(entryentity != null){
|
||||
entryentity.get(rowIndex).set("zcgj_expenseitem", null);
|
||||
this.getView().updateView("zcgj_expenseitem",rowIndex);
|
||||
}
|
||||
}else{
|
||||
this.getView().showErrorNotification("申请人不能为空");
|
||||
}
|
||||
}*/
|
||||
/*else if("fiaccountorg".equals(name)){
|
||||
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||
if(newValue !=null){
|
||||
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
||||
long userid = person.getLong("id");
|
||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||
List<Long> allDepartment = UserServiceHelper.getAllDepartmentByUserId(userid);
|
||||
HasPermOrgResult userHasPermOrgs = PermissionServiceHelper.getUserHasPermOrgs(userid,false);
|
||||
List<Long> hasPermOrgs = userHasPermOrgs.getHasPermOrgs();
|
||||
List<Long> userDepartment = UserServiceHelper.getUserDepartment(userid, false);
|
||||
if(hasPermOrgs!=null && !hasPermOrgs.isEmpty()){
|
||||
Set<Long> collect = new HashSet<>(hasPermOrgs);
|
||||
if(collect.contains(newValue.getLong("id"))){
|
||||
this.getModel().setValue("zcgj_persondepart", newValue.getLong("id"));
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getView().showErrorNotification("所属组织不能为空!");
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,26 +97,29 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");
|
||||
if (dynamicObjectCollection != null) {
|
||||
String paymenttype = dynamicObjectCollection.get(row).getString("paymenttype");//支付类型
|
||||
List<String> numbers = new ArrayList<>();
|
||||
QFilter biztypefilter = null;
|
||||
if("PREPAYMENT".equals(paymenttype)){
|
||||
QFilter biztypefilter = new QFilter("zcgj_biztype", QCP.equals, "50"); //过滤业务单据为支出财务确认单
|
||||
//分录过滤
|
||||
//使用BusinessDataServiceHelper.load查出来的数据,返回的是符合条件的整单,即使只有分录中的某一行符合条件,也会返回整张单包括其他分录行的数据
|
||||
//使用 QueryServiceHelper.query查出来的数据只会包含符合条件的分录行,不含其他行数据
|
||||
DynamicObjectCollection accountfeeEntries = QueryServiceHelper.query("zcgj_accountfee",
|
||||
"zcgj_entryentity.zcgj_fee.number", new QFilter[]{biztypefilter});//费用与科目分类单
|
||||
List<String> numbers = new ArrayList<>();
|
||||
if (accountfeeEntries != null) {
|
||||
for (DynamicObject dynamicObject : accountfeeEntries) {
|
||||
String zcgjAccounttypeNumber = dynamicObject.getString("zcgj_entryentity.zcgj_fee.number");
|
||||
if (zcgjAccounttypeNumber != null) {
|
||||
numbers.add(zcgjAccounttypeNumber);
|
||||
}
|
||||
biztypefilter= new QFilter("zcgj_biztype", QCP.equals, "50");
|
||||
}else{
|
||||
biztypefilter = new QFilter("zcgj_biztype", QCP.not_equals, "50");
|
||||
}
|
||||
//分录过滤
|
||||
//使用BusinessDataServiceHelper.load查出来的数据,返回的是符合条件的整单,即使只有分录中的某一行符合条件,也会返回整张单包括其他分录行的数据
|
||||
//使用 QueryServiceHelper.query查出来的数据只会包含符合条件的分录行,不含其他行数据
|
||||
DynamicObjectCollection accountfeeEntries = QueryServiceHelper.query("zcgj_accountfee",
|
||||
"zcgj_entryentity.zcgj_fee.number", new QFilter[]{biztypefilter});//费用与科目分类单
|
||||
if (accountfeeEntries != null) {
|
||||
for (DynamicObject dynamicObject : accountfeeEntries) {
|
||||
String zcgjAccounttypeNumber = dynamicObject.getString("zcgj_entryentity.zcgj_fee.number");
|
||||
if (zcgjAccounttypeNumber != null) {
|
||||
numbers.add(zcgjAccounttypeNumber);
|
||||
}
|
||||
}
|
||||
QFilter qFilter = new QFilter("number", QCP.in, numbers);
|
||||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
formShowParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||
}
|
||||
QFilter qFilter = new QFilter("number", QCP.in, numbers);
|
||||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
formShowParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class InContractSettleFiConfirmWorkFlowPlugin implements IWorkflowPlugin
|
|||
inFinaceconfirm.set("zcgj_description",inContractSettle.getString("description"));
|
||||
inFinaceconfirm.set("zcgj_currency",inContractSettle.getDynamicObject("currency"));
|
||||
inFinaceconfirm.set("zcgj_invoice_org",inContractSettle.getDynamicObject("project").getDynamicObject("projectorg"));
|
||||
// getModel().setValue("zcgj_jscustomer",ecincontractsettle.getDynamicObject("zcgj_jscustomer"));
|
||||
inFinaceconfirm.set("zcgj_jscustomer",inContractSettle.getDynamicObject("zcgj_jscustomer"));
|
||||
inFinaceconfirm.set("billstatus","A");
|
||||
inFinaceconfirm.set("creator",inContractSettle.getDynamicObject("creator"));
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class InContractSettleInvalidWorkFlowPlugin implements IWorkflowPlugin {
|
|||
inFinaceconfirm.set("zcgj_description",inContractSettle.getString("description"));
|
||||
inFinaceconfirm.set("zcgj_currency",inContractSettle.getDynamicObject("currency"));
|
||||
inFinaceconfirm.set("zcgj_invoice_org",inContractSettle.getDynamicObject("project").getDynamicObject("projectorg"));
|
||||
// getModel().setValue("zcgj_jscustomer",ecincontractsettle.getDynamicObject("zcgj_jscustomer"));
|
||||
inFinaceconfirm.set("zcgj_jscustomer",inContractSettle.getDynamicObject("zcgj_jscustomer"));
|
||||
inFinaceconfirm.set("billstatus","C");
|
||||
inFinaceconfirm.set("zcgj_is_invalid",true);
|
||||
inFinaceconfirm.set("creator",inContractSettle.getDynamicObject("creator"));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package zcgj.zcdev.zcdev.pr.task;
|
||||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.algo.Row;
|
||||
import kd.bos.coderule.api.CodeRuleInfo;
|
||||
import kd.bos.coderule.service.cache.CodeRuleCache;
|
||||
import kd.bos.context.RequestContext;
|
||||
|
@ -20,7 +19,7 @@ import kd.bos.servicehelper.QueryServiceHelper;
|
|||
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import zcgj.zcdev.zcdev.pr.plugin.form.AdjustAmountOftaxBillPlugin;
|
||||
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -29,6 +28,8 @@ import java.time.YearMonth;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 实物卡片同步设备定时任务
|
||||
|
@ -46,9 +47,19 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
strings.add(number) ;
|
||||
}
|
||||
}
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,"10006431");//中材矿山建设有限公司
|
||||
DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
|
||||
long orgId = adminOrg.getLong("id");
|
||||
List<Long> orgIds = new ArrayList<>(1);
|
||||
//orgIds.add(1692204547985902592L);
|
||||
orgIds.add(orgId);
|
||||
List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
|
||||
Set<Long> orgSer = subOrgIds.stream().collect(Collectors.toSet());
|
||||
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
||||
qFilter.and(new QFilter("assetunit.number", QCP.in, orgSer)) ;
|
||||
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
||||
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter});
|
||||
log.info("同步的实物数量有"+realcards.length);
|
||||
for (DynamicObject realcard : realcards) {
|
||||
String number = realcard.getString("number");//资产编码
|
||||
// DynamicObject assetcat = realcard.getDynamicObject("assetcat");//资产类别
|
||||
|
@ -83,9 +94,17 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
long timestamp=date.getTime(); //时间戳
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置格式
|
||||
String timeText=format.format(timestamp);
|
||||
DynamicObject eceq_equipment_card = BusinessDataServiceHelper.loadSingle("eceq_equipment_card", new QFilter[]{new QFilter("number", QCP.equals, number)});
|
||||
DynamicObject eceq_equipment_card = BusinessDataServiceHelper.loadSingle("eceq_equipment_card", new QFilter[]{new QFilter("zcgj_assetnumber", QCP.equals, number)});
|
||||
if (eceq_equipment_card!=null){
|
||||
equipmentcard.set("id",eceq_equipment_card.getLong("id"));
|
||||
String cardString = eceq_equipment_card.getString("number");
|
||||
if(!cardString.isEmpty() && cardString!=null){
|
||||
equipmentcard.set("number",cardString);//设备编号
|
||||
}else{
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
}
|
||||
}else{
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
}
|
||||
|
||||
equipmentcard.set("billno",timeText);//单据编号
|
||||
|
@ -93,7 +112,6 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
equipmentcard.set("billstatus","C");//
|
||||
equipmentcard.set("enable","1");//可用
|
||||
equipmentcard.set("property","OWN");//设备性质
|
||||
equipmentcard.set("number",getCodeRule(equipmentcard,"53BT+ZJB86=L"));//设备编号
|
||||
equipmentcard.set("name",assetname);//设备名称
|
||||
equipmentcard.set("modelnum",model);//规格型号
|
||||
equipmentcard.set("indate",realaccountdate);//入库日期
|
||||
|
@ -144,80 +162,49 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
}
|
||||
DynamicObject eceq_equipment = BusinessDataServiceHelper.loadSingle("eceq_equipinfo", new QFilter[]{new QFilter("number", QCP.equals, number)});
|
||||
if (eceq_equipment != null) {
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM"); //设置格式
|
||||
String ym = sd.format(date);
|
||||
DynamicObjectCollection entrys = eceq_equipment.getDynamicObjectCollection("zcgj_entryentity");
|
||||
QFilter qf = new QFilter("realcard.number", QCP.equals, number);
|
||||
if (entrys.size() > 0) {//若分录行数大于0 则取上月的
|
||||
qf.and(new QFilter("billno", QCP.in, ym));
|
||||
for (int i = 0; i < entrys.size(); i++) {
|
||||
DynamicObject entry = entrys.get(i);
|
||||
String zcgjDebillno = entry.getString("zcgj_debillno");
|
||||
entrys.removeIf(record -> isLastMonth(zcgjDebillno));//若属于上个月那就删除重新塞入
|
||||
// if (entrys.size() > 0) {//若分录行数大于0 则取上月的
|
||||
// for (int i = 0; i < entrys.size(); i++) {
|
||||
// DynamicObject entry = entrys.get(i);
|
||||
// long billnoid = entry.getLong("zcgj_debillno");
|
||||
// qf.and(new QFilter("id", QCP.not_equals, billnoid));
|
||||
//// entrys.removeIf(record -> isLastMonth(zcgjDebillno));//若属于上个月那就删除重新塞入
|
||||
// }
|
||||
// }
|
||||
DynamicObjectCollection depresplitdetails = QueryServiceHelper.query("fa_depresplitdetail", "id,billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
log.info("前depresplitdetails:"+depresplitdetails.toArray().toString() + "长度:"+depresplitdetails.size());
|
||||
Collections.sort(depresplitdetails , new Comparator<DynamicObject>(){
|
||||
@Override
|
||||
public int compare(DynamicObject o1, DynamicObject o2) {
|
||||
long id1 = o1.getLong("id");
|
||||
DynamicObject oo1 = BusinessDataServiceHelper.loadSingle("fa_depresplitdetail", new QFilter[]{new QFilter("id", QCP.equals, id1)});
|
||||
long id2 = o2.getLong("id");
|
||||
DynamicObject oo2 = BusinessDataServiceHelper.loadSingle("fa_depresplitdetail", new QFilter[]{new QFilter("id", QCP.equals, id2)});
|
||||
return oo2.getDynamicObject("period").getString("number").compareTo(oo1.getDynamicObject("period").getString("number"));
|
||||
}
|
||||
}
|
||||
DynamicObjectCollection depresplitdetails = QueryServiceHelper.query("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
// DynamicObject[] depresplitdetails = BusinessDataServiceHelper.load("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
// DataSet rows = QueryServiceHelper.queryDataSet(this.getClass().getName(), "fa_depresplitdetail", "billno,period,period.number,splitdept,assentry.costcentrer,assentry.splitamount", qFilter.toArray(), "period.number DESC", 1);
|
||||
// 增强版比较器(自动适配多种日期格式)
|
||||
for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
DynamicObject item = depresplitdetails.get(i);
|
||||
// log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
}
|
||||
Comparator<DynamicObject> smartComparator = (o1, o2) -> {
|
||||
DynamicObject p1 = o1.getDynamicObject("period");
|
||||
DynamicObject p2 = o2.getDynamicObject("period");
|
||||
|
||||
// 空值处理
|
||||
if (p1 == null && p2 == null) return 0;
|
||||
if (p1 == null) return 1;
|
||||
if (p2 == null) return -1;
|
||||
|
||||
String c1 = p1.getString("number");
|
||||
String c2 = p2.getString("number");
|
||||
if (c1 == null) c1 = "";
|
||||
if (c2 == null) c2 = "";
|
||||
|
||||
// 尝试解析为年月
|
||||
for (String pattern : new String[]{"yyyyMM", "yyyy-MM", "yyyy/MM"}) {
|
||||
try {
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
|
||||
YearMonth ym1 = YearMonth.parse(c1, fmt);
|
||||
YearMonth ym2 = YearMonth.parse(c2, fmt);
|
||||
return ym2.compareTo(ym1); // 降序
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
// 纯数字比较(如 "202301")
|
||||
try {
|
||||
int num1 = Integer.parseInt(c1);
|
||||
int num2 = Integer.parseInt(c2);
|
||||
return Integer.compare(num2, num1);
|
||||
} catch (NumberFormatException e) {
|
||||
return c2.compareTo(c1); // 字符串降序
|
||||
}
|
||||
};
|
||||
depresplitdetails.sort(smartComparator);
|
||||
for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
DynamicObject item = depresplitdetails.get(i);
|
||||
log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
}
|
||||
|
||||
for (DynamicObject depresplitdetail : depresplitdetails) {
|
||||
String billno = depresplitdetail.getString("billno");
|
||||
DynamicObject period = depresplitdetail.getDynamicObject("period");//折旧区间
|
||||
DynamicObject splitdept = depresplitdetail.getDynamicObject("splitdept");//使用部门
|
||||
DynamicObjectCollection assentry = depresplitdetail.getDynamicObjectCollection("assentry");
|
||||
});
|
||||
log.info("后depresplitdetails:"+depresplitdetails.toArray().toString() + "长度:"+depresplitdetails.size());
|
||||
entrys.clear();
|
||||
for (int x = 0 ; x<depresplitdetails.size() ; x++) {
|
||||
DynamicObject depresplitdetail = depresplitdetails.get(x);
|
||||
long id = depresplitdetail.getLong("id");
|
||||
DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle("fa_depresplitdetail", new QFilter[]{new QFilter("id", QCP.equals, id)});
|
||||
// String billnoid = loadSingle.getString("billno");
|
||||
DynamicObject period = loadSingle.getDynamicObject("period");//折旧区间
|
||||
DynamicObject splitdept = loadSingle.getDynamicObject("splitdept");//使用部门
|
||||
DynamicObjectCollection assentry = loadSingle.getDynamicObjectCollection("assentry");
|
||||
DynamicObject costcentrer = assentry.get(0).getDynamicObject("costcentrer");//成本中心
|
||||
BigDecimal splitamount = assentry.get(0).getBigDecimal("splitamount");//分摊金额
|
||||
DynamicObject addNew = entrys.addNew();
|
||||
addNew.set("zcgj_debillno", billno);
|
||||
DynamicObject addNew = new DynamicObject(entrys.getDynamicObjectType());
|
||||
addNew.set("zcgj_debillno", id);
|
||||
addNew.set("zcgj_assperiod", period);
|
||||
addNew.set("zcgj_headusedept", splitdept);
|
||||
addNew.set("zcgj_entrybillno", number);
|
||||
addNew.set("zcgj_entryname", assetname);
|
||||
addNew.set("zcgj_costcenter", costcentrer);
|
||||
addNew.set("zcgj_shareamount", splitamount);
|
||||
entrys.add(addNew);
|
||||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{eceq_equipment});
|
||||
}
|
||||
|
@ -302,3 +289,48 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// DynamicObject[] depresplitdetails = BusinessDataServiceHelper.load("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
// DataSet rows = QueryServiceHelper.queryDataSet(this.getClass().getName(), "fa_depresplitdetail", "id,billno,period,splitdept,assentry,assentry.costcentrer,assentry.splitamount",
|
||||
// new QFilter[]{new QFilter("realcard.number", QCP.equals, number)}, "period.number DESC");
|
||||
// DynamicObjectCollection depresplitdetails = ORM.create().toPlainDynamicObjectCollection(rows.copy());
|
||||
// // 增强版比较器(自动适配多种日期格式)
|
||||
// for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
// DynamicObject item = depresplitdetails.get(i);
|
||||
//// log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
// }
|
||||
// Comparator<DynamicObject> smartComparator = (o1, o2) -> {
|
||||
// DynamicObject p1 = o1.getDynamicObject("period");
|
||||
// DynamicObject p2 = o2.getDynamicObject("period");
|
||||
// // 空值处理
|
||||
// if (p1 == null && p2 == null) return 0;
|
||||
// if (p1 == null) return 1;
|
||||
// if (p2 == null) return -1;
|
||||
// String c1 = p1.getString("number");
|
||||
// String c2 = p2.getString("number");
|
||||
// if (c1 == null) c1 = "";
|
||||
// if (c2 == null) c2 = "";
|
||||
// // 尝试解析为年月
|
||||
// for (String pattern : new String[]{"yyyyMM", "yyyy-MM", "yyyy/MM"}) {
|
||||
// try {
|
||||
// DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
|
||||
// YearMonth ym1 = YearMonth.parse(c1, fmt);
|
||||
// YearMonth ym2 = YearMonth.parse(c2, fmt);
|
||||
// return ym2.compareTo(ym1); // 降序
|
||||
// } catch (Exception ignored) {}
|
||||
// }
|
||||
// // 纯数字比较(如 "202301")
|
||||
// try {
|
||||
// int num1 = Integer.parseInt(c1);
|
||||
// int num2 = Integer.parseInt(c2);
|
||||
// return Integer.compare(num2, num1);
|
||||
// } catch (NumberFormatException e) {
|
||||
// return c2.compareTo(c1); // 字符串降序
|
||||
// }
|
||||
// };
|
||||
// depresplitdetails.sort(smartComparator);
|
||||
// for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
// DynamicObject item = depresplitdetails.get(i);
|
||||
// log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
// }
|
||||
//按字段 menuindex 排序
|
Loading…
Reference in New Issue