diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java index 2200ea6..b6a08e2 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java @@ -13,6 +13,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; +import java.math.BigDecimal; import java.util.*; /** @@ -47,6 +48,23 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme //携带生单规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头,原因码到分录 carryCustomer(bill); SaveServiceHelper.save(new DynamicObject[]{bill}); + + //若源单为收款处理,清空单据头.SAP凭证号;单据头.是否已推送SAP;单据头.SAP会计年度 cas_recbill + String sourcebilltype = bill.getString("sourcebilltype"); + if ("cas_recbill".equals(sourcebilltype) || "收款单".equals(sourcebilltype)) { + BigDecimal sourcebillid = bill.getBigDecimal("sourcebillid"); + QFilter q1 = new QFilter("id", QCP.equals, sourcebillid); + DynamicObject[] load = BusinessDataServiceHelper.load("cas_recbill", + "id,billno,shjh_vouchernum,shjh_sapfiscalyear,shjh_ispushsap,shjh_issourceblue", q1.toArray()); + for (DynamicObject dynamicObject : load) { + boolean shjhIssourceblue = dynamicObject.getBoolean("shjh_issourceblue"); + if (!shjhIssourceblue) { + dynamicObject.set("shjh_ispushsap", false); + dynamicObject.set("shjh_issourceblue", true); + SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + } + } + } } }