Browse Source

合同台账单接口新增9个字段的赋值

chengchaohua 3 days ago
parent
commit
1c02f3814d

+ 13 - 7
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/ContractbillApiPlugin.java

@@ -54,19 +54,15 @@ public class ContractbillApiPlugin implements Serializable {
         log.info("合同附件上传-1");
         byte[] fileData = file.getFileData();
         String fileName = file.getFileName();
-        log.info("合同附件上传-2");
         Map<String,Object> map = new HashMap<>();
         TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
-        log.info("合同附件上传-3");
         String tempUrl = cache.saveAsFullUrl(fileName, fileData,3600);
-        log.info("合同附件上传-4");
         CustomApiResult<Map<String,Object>> customApiResult = new CustomApiResult<>();
-        log.info("合同附件上传-5");
         map.put("tempurl",tempUrl);
         map.put("fileName",fileName);
         map.put("size",file.getFileData().length);
         customApiResult.setData(map);
-        log.info("合同附件上传-6");
+        log.info("合同附件上传-2");
         return customApiResult;
     }
 
@@ -265,6 +261,10 @@ public class ContractbillApiPlugin implements Serializable {
 
             dynamicObject.set("creator",applicatuser); // 创建人
             dynamicObject.set("createtime",new Date()); // 创建时间
+
+            dynamicObject.set("formid", "er_contractbill"); // 表单ID
+            dynamicObject.set("isenableinvoice", true); // 启用发票云
+            dynamicObject.set("currency", 1); // 本位币种
         }
         long pkid = dynamicObject.getLong("id");
 
@@ -435,13 +435,14 @@ public class ContractbillApiPlugin implements Serializable {
                 result.setStatus(false);
                 return result;
             }
-            BigDecimal fexpapplyamountBen =fexpapplyamount.multiply(huilv).setScale(2, RoundingMode.HALF_UP); // 含税金额本位币,四舍五入
+            BigDecimal fexpapplyamountBen =fexpapplyamount.multiply(huilv).setScale(2, RoundingMode.HALF_UP); // 含税金额(本位币) = 含税金额本位币 * 汇率,四舍五入
 
             // 确认合同单据本次是新增还是更新,分录接口只允许送一条记录
             DynamicObject newEntry3 = null;
             if (isnew) {
-                // 新增
+                // 新增(接口第一次调)
                 newEntry3 = new DynamicObject(plannewColl.getDynamicObjectType());
+                newEntry3.set("seq",1); // 分录序号
                 newEntry3.set("reimbursedamount",0); // 已报销金额
                 newEntry3.set("reimbursedcurramount",0); // 已报销金额(本位币)
                 newEntry3.set("oriexppayedamount",0); // 已付金额
@@ -452,6 +453,7 @@ public class ContractbillApiPlugin implements Serializable {
                 newEntry3.set("canloancurramount",fexpapplyamountBen); // 可预付金额(本位币)
                 newEntry3.set("orgiexpebalanceamount",fexpapplyamount); // 可报销金额
                 newEntry3.set("expebalanceamount",fexpapplyamountBen); // 可报销金额(本位币)
+                newEntry3.set("expquotetype","0"); // 换算方式:直接汇率 0,间接汇率 1
             } else {
                 // 更新
                 newEntry3 = plannewColl.get(0); // 分录只有一条记录
@@ -473,8 +475,11 @@ public class ContractbillApiPlugin implements Serializable {
             }
 
             newEntry3.set("orientryamount",fexpapplyamount); // 不含税金额
+            newEntry3.set("acorientryamount",fexpapplyamount); // 变更后不含税
             newEntry3.set("expenseamount",fexpapplyamount); // 含税金额
+            newEntry3.set("acexpeapproveamount",fexpapplyamount); // 变更后含税金额
             newEntry3.set("currexpenseamount",fexpapplyamountBen); // 含税金额(本位币),四舍五入
+            newEntry3.set("acexpeapprovecurramount",fexpapplyamountBen); // 变更后含税金额(本位币)
 
             // 累加给头表字段
             hetongjinetotalfist = hetongjinetotalfist.add(fexpapplyamount); // 进行累加付给合同金额
@@ -524,6 +529,7 @@ public class ContractbillApiPlugin implements Serializable {
             dynamicObject.set("frameworkcontract",false); // 框架合同:否
             dynamicObject.set("contractamount", hetongjinetotalfist); // 头表字段:合同总额(初始)
             dynamicObject.set("oriapplyamount", hetongjinetotalfist); // 头表字段:合同总额(变更后)
+            dynamicObject.set("applyamount", hetongjinetotalfist.multiply(huilv).setScale(2, RoundingMode.HALF_UP)); // 头表字段:合同总额(变更后)本位币 = 合同总额(变更后) * 汇率
             dynamicObject.set("originalamount", hetongjinetotalfist); // 头表字段:合同总额(不含税)
             if (isnew) {
                 // 第一次合同送入,新增