Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	code/fi/nckd-xtpoc-fi/src/main/java/nckd/xtpoc/fi/app/plugin/form/DailyReimburseCusEditPlugin.java
yyy 1 nedēļu atpakaļ
vecāks
revīzija
6436d46bcd

+ 55 - 0
code/fi/nckd-xtpoc-fi/src/main/java/nckd/xtpoc/fi/app/plugin/form/DailyReimburseCusEditPlugin.java

@@ -5,6 +5,15 @@ import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
 import kd.bos.entity.datamodel.events.BizDataEventArgs;
 import kd.bos.entity.datamodel.events.PropertyChangedArgs;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.QueryServiceHelper;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.QueryServiceHelper;
+
 import java.util.EventObject;
 
 /**
@@ -41,6 +50,7 @@ public class DailyReimburseCusEditPlugin extends AbstractBillPlugIn {
         if("expenseitem".equals(propertyName)){
             setFeildVisibleByExpenseItem();
             setSupplierVisibleByExpenseItem();
+            setEntryAccountValue();
         }
     }
 
@@ -83,4 +93,49 @@ public class DailyReimburseCusEditPlugin extends AbstractBillPlugIn {
         this.getView().setVisible(isShowBookClass, "nckd_supplier");
         this.getView().setVisible(isShowBookClass, "nckd_plateno");
     }
+
+
+    private void setEntryAccountValue(){
+        //费用承担部门
+        DynamicObject costDept = (DynamicObject) this.getModel().getValue("costdept");
+
+        if(costDept == null){
+            return;
+        }
+
+        //部门属性
+        QFilter qFilter = new QFilter("org.id", QCP.equals, costDept.getLong("id"));
+        DynamicObject deptDuty = BusinessDataServiceHelper.loadSingle("bos_org_dutyrelation", qFilter.toArray());
+        if(deptDuty == null){
+            return;
+        }
+
+        int rowIndex = -1;
+        DynamicObjectCollection expenseentryentity = (DynamicObjectCollection)this.getModel().getValue("expenseentryentity");
+
+        for(DynamicObject entry : expenseentryentity){
+            rowIndex++;
+            DynamicObject expenseitem = entry.getDynamicObject("expenseitem");
+
+            if(expenseitem == null){
+                continue;
+            }
+
+            String expentItemCode = expenseitem.getString("number");
+            String deptDutyCode = deptDuty.getDynamicObject("orgduty").getString("number");
+            String bdinfoimport = "er_expenseitemedit:" + expentItemCode + ",bos_org_duty:" + deptDutyCode;
+
+            //科目影响因素ai_accountmaptype
+            qFilter = new QFilter("number", QCP.equals, "FY01");
+            qFilter.and(new QFilter("entryentity.bdinfoimport", QCP.equals, bdinfoimport));
+
+            DynamicObject accountMapType = QueryServiceHelper.queryOne("ai_accountmaptype", "entryentity.accfield", qFilter.toArray());
+            if(accountMapType != null){
+                Long accountViewId = accountMapType.getLong("entryentity.accfield");
+                qFilter = new QFilter("id", QCP.equals, accountViewId);
+                DynamicObject accountViewInfo = BusinessDataServiceHelper.loadSingle("bd_accountview", qFilter.toArray());
+                this.getModel().setValue("nckd_account", accountViewInfo, rowIndex);
+            }
+        }
+    }
 }

+ 3 - 2
code/fi/nckd-xtpoc-fi/src/main/java/nckd/xtpoc/fi/app/plugin/form/SettlebillFormPlugin.java

@@ -204,7 +204,7 @@ public class SettlebillFormPlugin extends AbstractFormPlugin implements Plugin {
         this.getModel().getEntryEntity(mainEntry).clear();
         this.getModel().getEntryEntity(assistEntry).clear();
 
-        String selectField1 = "id,billno,fiperiod,company.name,expenseentryentity.id,expenseentryentity.expenseamount,expenseentryentity.orgiexpebalanceamount";
+        String selectField1 = "id,billno,fiperiod,company.name,expenseentryentity.id,expenseentryentity.entrywlunit.name,expenseentryentity.expenseamount,expenseentryentity.orgiexpebalanceamount";
         QFilter qFilter1 = new QFilter("expenseentryentity.expenseamount", QCP.large_equals, 0); // 启用
 
         DynamicObjectCollection mainDyns = QueryServiceHelper.query(main, selectField1,new QFilter[]{qFilter1},"fiperiod");
@@ -217,6 +217,7 @@ public class SettlebillFormPlugin extends AbstractFormPlugin implements Plugin {
             newEntry.set("nckd_fentryid", maintDyn.getLong("expenseentryentity.id"));
             newEntry.set("nckd_billtype", "费用预提单");
             newEntry.set("nckd_billno", maintDyn.getString("billno"));
+            newEntry.set("nckd_supp", maintDyn.getString("expenseentryentity.entrywlunit.name"));
             newEntry.set("nckd_date", maintDyn.getDate("fiperiod"));
             newEntry.set("nckd_amount", maintDyn.getBigDecimal("expenseentryentity.expenseamount"));
             newEntry.set("nckd_writeamount", maintDyn.getBigDecimal("expenseentryentity.expenseamount"));
@@ -250,7 +251,7 @@ public class SettlebillFormPlugin extends AbstractFormPlugin implements Plugin {
             newEntry.set("nckd_billno1", assistDyn.getString("billno"));
             newEntry.set("nckd_date1", assistDyn.getDate("bizdate"));
             //logger.info("SettlebillFormPlugin: "+assistDyn.getString("billpayerid.name"));
-            newEntry.set("nckd_supp", assistDyn.getString("billpayerid.name"));
+            newEntry.set("nckd_supp1", assistDyn.getString("billpayerid.name"));
             newEntry.set("nckd_amount1", assistDyn.getBigDecimal("expenseentryentity.expenseamount"));
             newEntry.set("nckd_writeoffamount", assistDyn.getBigDecimal("expenseentryentity.expenseamount"));
             descEntries1.add(newEntry);

+ 11 - 2
code/fi/nckd-xtpoc-fi/src/main/java/nckd/xtpoc/fi/app/plugin/validate/DailyReimBurseBillValidator.java

@@ -27,7 +27,7 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
             DynamicObject bill = dataEntity.getDataEntity();
             // 申请日期
             Date bizDate = bill.getDate("bizdate");
-            if(checkPeriod(bizDate)) {
+            if(checkPeriod(bizDate,bill)) {
                 String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
                 this.addErrorMessage(dataEntity, msg);
             }
@@ -45,10 +45,19 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
      * @param date
      * @return
      */
-    public boolean checkPeriod(Date date) {
+    public boolean checkPeriod(Date date, DynamicObject bill) {
         QFilter filter = new QFilter("nckd_closestatus", QCP.equals, "B");
         filter.and("nckd_period.begindate", QCP.less_equals, date);
         filter.and("nckd_period.enddate", QCP.large_equals, date);
+        String entityKey = this.getEntityKey();
+
+        if("cas_paybill".equals(entityKey)) {
+            filter.and("org.id", QCP.equals, bill.getLong("applyorg.id"));
+        }
+        else {
+            filter.and("org.id", QCP.equals, bill.getLong("costcompany.id"));
+        }
+
         return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
     }
 

+ 1 - 1
code/fi/nckd-xtpoc-fi/src/main/java/nckd/xtpoc/fi/app/plugin/validate/TripReimBurseBillValidator.java

@@ -28,7 +28,7 @@ public class TripReimBurseBillValidator extends AbstractValidator {
                 Date endDate = tripEntry.getDate("enddate");
                 String msg = checkDateIsExists(billId, userId, startDate, endDate);
                 if(msg.length() > 0) {
-                    this.addErrorMessage(dataEntity, "存在开始时间、结束时间重叠的单据:" + msg);
+                    this.addWarningMessage(dataEntity, "存在开始时间、结束时间重叠的单据:" + msg + ",是否确认提交?");
                 }
             }
         }