ArBillEditPlugin.java 131 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647
  1. package fi.cas.formplugin;
  2. import com.alibaba.fastjson.JSON;
  3. import kd.bos.bill.BillShowParameter;
  4. import kd.bos.bill.OperationStatus;
  5. import kd.bos.context.RequestContext;
  6. import kd.bos.dataentity.OperateOption;
  7. import kd.bos.dataentity.entity.DataEntityBase;
  8. import kd.bos.dataentity.entity.DynamicObject;
  9. import kd.bos.dataentity.entity.DynamicObjectCollection;
  10. import kd.bos.dataentity.entity.LocaleString;
  11. import kd.bos.dataentity.metadata.IDataEntityProperty;
  12. import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
  13. import kd.bos.dataentity.resource.ResManager;
  14. import kd.bos.dataentity.serialization.SerializationUtils;
  15. import kd.bos.entity.AppMetadataCache;
  16. import kd.bos.entity.EntityMetadataCache;
  17. import kd.bos.entity.Tips;
  18. import kd.bos.entity.datamodel.*;
  19. import kd.bos.entity.datamodel.events.*;
  20. import kd.bos.entity.format.FormatFactory;
  21. import kd.bos.entity.format.FormatObject;
  22. import kd.bos.entity.format.FormatTypes;
  23. import kd.bos.entity.operate.result.OperationResult;
  24. import kd.bos.entity.param.AppParam;
  25. import kd.bos.entity.property.EntryProp;
  26. import kd.bos.exception.KDBizException;
  27. import kd.bos.form.*;
  28. import kd.bos.form.control.*;
  29. import kd.bos.form.control.events.BeforeItemClickEvent;
  30. import kd.bos.form.control.events.ClickListener;
  31. import kd.bos.form.control.events.ItemClickEvent;
  32. import kd.bos.form.control.events.RowClickEventListener;
  33. import kd.bos.form.events.*;
  34. import kd.bos.form.field.BasedataEdit;
  35. import kd.bos.form.field.ComboEdit;
  36. import kd.bos.form.field.ComboItem;
  37. import kd.bos.form.operate.AbstractOperate;
  38. import kd.bos.form.operate.FormOperate;
  39. import kd.bos.form.operate.SignOperateCallback;
  40. import kd.bos.list.ListFilterParameter;
  41. import kd.bos.list.ListShowParameter;
  42. import kd.bos.logging.Log;
  43. import kd.bos.logging.LogFactory;
  44. import kd.bos.orm.query.QFilter;
  45. import kd.bos.orm.util.CollectionUtils;
  46. import kd.bos.servicehelper.BusinessDataServiceHelper;
  47. import kd.bos.servicehelper.DispatchServiceHelper;
  48. import kd.bos.servicehelper.QueryServiceHelper;
  49. import kd.bos.servicehelper.inte.InteServiceHelper;
  50. import kd.bos.servicehelper.operation.OperationServiceHelper;
  51. import kd.bos.servicehelper.parameter.SystemParamServiceHelper;
  52. import kd.bos.servicehelper.workflow.WorkflowServiceHelper;
  53. import kd.bos.workflow.component.approvalrecord.IApprovalRecordGroup;
  54. import kd.fi.cas.business.errorcode.CasErrorCode;
  55. import kd.fi.cas.business.errorcode.PaymentErrorCode;
  56. import kd.fi.cas.business.helper.AcctBalanceHelper;
  57. import kd.fi.cas.business.helper.PayBillHepler;
  58. import kd.fi.cas.business.helper.PaymentFillPropHelper;
  59. import kd.fi.cas.business.helper.VisibleVirtualAcctHelper;
  60. import kd.fi.cas.business.opservice.impl.PaymentPayImpl;
  61. import kd.fi.cas.business.service.ViewReceiptService;
  62. import kd.fi.cas.consts.BillTypeConstants;
  63. import kd.fi.cas.enums.*;
  64. import kd.fi.cas.formplugin.PaymentBillEdit;
  65. import kd.fi.cas.formplugin.common.CasBillEdit;
  66. import kd.fi.cas.formplugin.helper.InitCheckPluginHelper;
  67. import kd.fi.cas.helper.*;
  68. import kd.fi.cas.pojo.BizBalanceModelBean;
  69. import kd.fi.cas.util.DateUtils;
  70. import kd.fi.cas.util.EmptyUtil;
  71. import kd.fi.cas.util.FormUtils;
  72. import kd.fi.cas.util.StringUtils;
  73. import java.math.BigDecimal;
  74. import java.text.Format;
  75. import java.util.*;
  76. import java.util.List;
  77. import java.util.stream.Collectors;
  78. /**
  79. * 应收挂账单界面插件
  80. * 2024-07-24 wangj
  81. * 主要功能:应收挂账单标准表单插件改
  82. */
  83. public class ArBillEditPlugin extends PaymentBillEdit implements ClickListener, RowClickEventListener, SignCallbackLisenter {
  84. private String labCurrencySign;
  85. private int currencyAmtprecision;
  86. private Format currencyFormat;
  87. private static final String KEY_DIFFPAY_CALLBACK = "KEY_DIFFPAY_CALLBACK";
  88. private static final String CONFIRM_DEL_CALLBACK = "CONFIRM_DEL_CALLBACK";
  89. private static final String KEY_CALLBACK_CHARGEBACK = "CALLBACK_CHARGEBACK";
  90. private static final String KEY_CLOSECALLBACK_CHARGEBACK = "CALLBACK_SELECTDRAFT";
  91. private static Log logger = LogFactory.getLog(PaymentBillEdit.class);
  92. private Long orgId;
  93. private boolean isBeConfirmOK = false;
  94. private List<String> settleTypes;
  95. public ArBillEditPlugin() {
  96. this.settleTypes = Arrays.asList(SettleMentTypeEnum.PROMISSORY.getValue(), SettleMentTypeEnum.CHECK.getValue(), SettleMentTypeEnum.DRAFT.getValue(), SettleMentTypeEnum.BUSINESS.getValue(), SettleMentTypeEnum.BANK.getValue());
  97. }
  98. private void initFormat() {
  99. FormatObject fobj = InteServiceHelper.getUserFormat(RequestContext.get().getCurrUserId());
  100. fobj.getCurrencyFormat().setCurrencySymbols(this.labCurrencySign);
  101. fobj.getCurrencyFormat().setMinimumFractionDigits(this.currencyAmtprecision);
  102. this.currencyFormat = FormatFactory.get(FormatTypes.Currency).getFormat(fobj);
  103. }
  104. public void preOpenForm(PreOpenFormEventArgs e) {
  105. BillShowParameter showParameter = (BillShowParameter)e.getSource();
  106. Object pkId = showParameter.getPkId();
  107. if (pkId != null && !pkId.equals(0L)) {
  108. DynamicObject info = BusinessDataServiceHelper.loadSingle(pkId, "nckd_cas_arbill", "id, billtype");
  109. DynamicObject billtype = info.getDynamicObject("billtype");
  110. if (billtype != null && BillTypeConstants.PAYBILL_SYN.equals(billtype.getPkValue())) {
  111. e.getFormShowParameter().setFormId("cas_paybill_synonym");
  112. e.getFormShowParameter().setCaption(ResManager.loadKDString("同名转账", "PaymentBillEdit_24", "fi-cas-formplugin", new Object[0]));
  113. } else if (billtype != null && BillTypeConstants.PAYBILL_CASH.equals(billtype.getPkValue())) {
  114. e.getFormShowParameter().setFormId("cas_paybill_cash");
  115. e.getFormShowParameter().setCaption(ResManager.loadKDString("现金存取", "PaymentBillEdit_25", "fi-cas-formplugin", new Object[0]));
  116. } else if (billtype != null && BillTypeConstants.PAYBILL_SPAN.equals(billtype.getPkValue())) {
  117. e.getFormShowParameter().setCaption(ResManager.loadKDString("跨主体调拨", "PaymentBillEdit_28", "fi-cas-formplugin", new Object[0]));
  118. }
  119. } else {
  120. String formId = showParameter.getFormId();
  121. if ("cas_paybill_synonym".equals(formId)) {
  122. e.getFormShowParameter().setFormId("cas_paybill_synonym");
  123. e.getFormShowParameter().setCaption(ResManager.loadKDString("同名转账", "PaymentBillEdit_24", "fi-cas-formplugin", new Object[0]));
  124. } else if ("cas_paybill_cash".equals(formId)) {
  125. e.getFormShowParameter().setFormId("cas_paybill_cash");
  126. e.getFormShowParameter().setCaption(ResManager.loadKDString("现金存取", "PaymentBillEdit_25", "fi-cas-formplugin", new Object[0]));
  127. } else if ("cas_paybill_spanmainpart".equals(formId)) {
  128. e.getFormShowParameter().setFormId("cas_paybill_spanmainpart");
  129. e.getFormShowParameter().setCaption(ResManager.loadKDString("跨主体调拨", "PaymentBillEdit_28", "fi-cas-formplugin", new Object[0]));
  130. }
  131. }
  132. }
  133. public void registerListener(EventObject e) {
  134. super.registerListener(e);
  135. this.addClickListeners(new String[]{"changepayer", "changepayee", "addpayeelb1", "addpayeelb2", "settletnumber", "applyname"});
  136. this.initF7();
  137. }
  138. private void initF7() {
  139. this.fillPaymentType();
  140. this.fillCurrency();
  141. this.fillEntrustorg();
  142. this.setSettlementTypeFilter();
  143. this.fillNetBankAcct();
  144. this.expenseItem();
  145. this.fillFundFlow();
  146. }
  147. private void fillFundFlow() {
  148. BasedataEdit fundFlow = (BasedataEdit)this.getControl("e_fundflowitem");
  149. fundFlow.addBeforeF7SelectListener((select) -> {
  150. ListShowParameter showParam = (ListShowParameter)select.getFormShowParameter();
  151. Object org = this.getModel().getValue("org");
  152. showParam.setCustomParam("org", String.valueOf(((DynamicObject)org).getPkValue()));
  153. });
  154. }
  155. protected void expenseItem() {
  156. BasedataEdit orgCtrl = (BasedataEdit)this.getControl("e_expenseitem");
  157. orgCtrl.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
  158. ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
  159. DynamicObject[] objects = BusinessDataServiceHelper.load("er_expenseitembill", "id,expenseitem", new QFilter[]{new QFilter("billtype.bill_number.number", "=", "nckd_cas_arbill")});
  160. if (!EmptyUtil.isEmpty(objects)) {
  161. List<Object> ids = (List)Arrays.stream(objects).map((o) -> {
  162. return o.get("expenseitem.id");
  163. }).collect(Collectors.toList());
  164. QFilter qFilter = new QFilter("id", "in", ids);
  165. showParameter.getListFilterParameter().getQFilters().add(qFilter);
  166. }
  167. });
  168. }
  169. protected String getControlBankAcctForSettleType() {
  170. return "payeracctbank";
  171. }
  172. private boolean isAcctBankExistOnlineBankAcct() {
  173. DynamicObject payeracctbank = (DynamicObject)this.getValue("payeracctbank");
  174. if (null != payeracctbank) {
  175. DynamicObjectCollection onlineBankAccts = payeracctbank.getDynamicObjectCollection("netbank");
  176. return null != onlineBankAccts && onlineBankAccts.size() != 0;
  177. } else {
  178. return false;
  179. }
  180. }
  181. private void fillNetBankAcct() {
  182. BasedataEdit onlinebankacct = (BasedataEdit)this.getControl("netbankacct");
  183. onlinebankacct.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
  184. ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
  185. DynamicObject payeracctbank = (DynamicObject)this.getValue("payeracctbank");
  186. List<Long> ids = new ArrayList();
  187. if (null != payeracctbank) {
  188. DynamicObjectCollection onlineBankAccts = payeracctbank.getDynamicObjectCollection("netbank");
  189. if (null != onlineBankAccts && onlineBankAccts.size() > 0) {
  190. Iterator var6 = onlineBankAccts.iterator();
  191. while(var6.hasNext()) {
  192. DynamicObject bankAcct = (DynamicObject)var6.next();
  193. ids.add((Long)bankAcct.getDynamicObject("fbasedataid").getPkValue());
  194. }
  195. }
  196. }
  197. if (ids.size() == 0) {
  198. ids.add(0L);
  199. }
  200. QFilter qFilter = new QFilter("id", "in", ids);
  201. showParameter.getListFilterParameter().getQFilters().add(qFilter);
  202. });
  203. }
  204. private void fillEntrustorg() {
  205. BasedataEdit currencyF7 = (BasedataEdit)this.getControl("entrustorg");
  206. currencyF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
  207. ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
  208. showParameter.setCustomParam("orgFuncId", "08");
  209. });
  210. }
  211. private void fillPaymentType() {
  212. BasedataEdit paymenttypeF7 = (BasedataEdit)this.getControl("paymenttype");
  213. paymenttypeF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
  214. String sourceBillType = (String)this.getModel().getValue("sourcebilltype");
  215. ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
  216. QFilter qFilter = new QFilter("enable", "=", "1");
  217. Object entrance = this.getModel().getValue("entrance");
  218. if (!CasHelper.isEmpty(this.getModel().getDataEntity().getPkValue())) {
  219. DynamicObject payemntType = (DynamicObject)this.getModel().getValue("paymenttype");
  220. if (payemntType != null) {
  221. qFilter = qFilter.and(new QFilter("ispartpayment", "=", payemntType.getBoolean("ispartpayment") ? "1" : "0"));
  222. } else if (!PaymentTypeEnum.AP.name().equals(entrance)) {
  223. qFilter = qFilter.and(new QFilter("ispartpayment", "=", "0"));
  224. }
  225. }
  226. if (entrance != null && !"".equals(entrance)) {
  227. if (PaymentTypeEnum.AP.name().equals(entrance)) {
  228. qFilter = qFilter.and(new QFilter("ispartpayment", "=", "1"));
  229. } else {
  230. qFilter = qFilter.and(new QFilter("ispartpayment", "=", "0"));
  231. }
  232. }
  233. if ("pm_purorderbill".equals(sourceBillType) || "conm_purcontract".equals(sourceBillType)) {
  234. qFilter = qFilter.and(new QFilter("biztype", "=", "202")).and(new QFilter("ispartpayment", "=", "1"));
  235. qFilter = qFilter.and(new QFilter("ispartpayment", "=", "1"));
  236. }
  237. showParameter.getListFilterParameter().setFilter(qFilter);
  238. });
  239. }
  240. private void fillCurrency() {
  241. BasedataEdit currencyF7 = (BasedataEdit)this.getControl("currency");
  242. currencyF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
  243. ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
  244. QFilter qFilter = new QFilter("enable", "=", "1");
  245. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  246. if (!isDiffCur) {
  247. DynamicObject settleType = (DynamicObject)this.getModel().getValue("settletype");
  248. boolean isCash = BaseDataHelper.isSettleTypeCash(settleType);
  249. DynamicObject accountCash;
  250. if (isCash) {
  251. accountCash = (DynamicObject)this.getModel().getValue("payeracctcash");
  252. if (accountCash != null) {
  253. List<Long> currencys = AccountCashHelper.getCurrencys(Collections.singletonList((Long)accountCash.getPkValue()));
  254. qFilter = qFilter.and(new QFilter("id", "in", currencys));
  255. }
  256. } else {
  257. accountCash = (DynamicObject)this.getModel().getValue("payeracctbank");
  258. if (accountCash != null) {
  259. Set<Long> currencysx = AccountBankHelper.getCurrencyPks((Long)accountCash.getPkValue());
  260. qFilter = qFilter.and(new QFilter("id", "in", currencysx));
  261. }
  262. }
  263. }
  264. showParameter.getListFilterParameter().setFilter(qFilter);
  265. });
  266. }
  267. public void afterCreateNewData(EventObject e) {
  268. super.afterCreateNewData(e);
  269. this.setDefaultPaymentChannelValue();
  270. if (!"true".equals(this.getPageCache().get("isFromWebApi"))) {
  271. this.createNewModel();
  272. }
  273. this.getView().setVisible(false, new String[]{"netbankacct"});
  274. this.getEntryCache();
  275. this.calculateAmt();
  276. DynamicObject settleType = this.getDynamicObject("settletype");
  277. if (BaseDataHelper.isSettleTypeCash(settleType)) {
  278. this.setValue("payeracctcash", AccountCashHelper.getDefaultAccountcash(this.getPk("org"), "payer"));
  279. }
  280. }
  281. private void getEntryCache() {
  282. String str_json = this.getPageCache().get("entry");
  283. if (str_json != null) {
  284. this.getModel().deleteEntryRow("entry", 0);
  285. TableValueSetter vs = new TableValueSetter(new String[0]);
  286. vs.addField("e_expenseitem", new Object[0]).addField("e_payableamt", new Object[0]).addField("project", new Object[0]).addField("e_fundflowitem", new Object[0]).addField("e_remark", new Object[0]);
  287. Map<String, ArrayList<Map<String, String>>> maps = (Map) SerializationUtils.fromJsonString(str_json, Map.class);
  288. ArrayList<Map<String, String>> list = (ArrayList)maps.get("entry");
  289. Iterator var5 = list.iterator();
  290. while(var5.hasNext()) {
  291. Map<String, String> map = (Map)var5.next();
  292. vs.addRow(new Object[]{map.get("e_expenseitem"), map.get("e_payableamt"), map.get("project"), map.get("e_fundflowitem"), map.get("e_remark")});
  293. }
  294. AbstractFormDataModel model = (AbstractFormDataModel)this.getModel();
  295. model.batchCreateNewEntryRow("entry", vs);
  296. this.getView().updateView("entry");
  297. }
  298. }
  299. private void setDefaultPaymentChannelValue() {
  300. List<ComboItem> comboItems = new ArrayList();
  301. ComboEdit paymentChannel = (ComboEdit)this.getControl("paymentchannel");
  302. ComboItem comboItem = new ComboItem();
  303. comboItem.setValue(PaymentChannelEnum.COUNTER.getValue());
  304. comboItem.setCaption(new LocaleString(ResManager.loadKDString(PaymentChannelEnum.COUNTER.getName(), "PaymentBillEdit_16", "fi-cas-formplugin", new Object[0])));
  305. comboItems.add(comboItem);
  306. paymentChannel.setComboItems(comboItems);
  307. this.getModel().setValue("paymentchannel", comboItem.getValue());
  308. }
  309. public void beforeBindData(EventObject e) {
  310. super.beforeBindData(e);
  311. DynamicObject paymenttype = (DynamicObject)this.getModel().getValue("paymenttype");
  312. if (null != paymenttype && !paymenttype.getBoolean("ispartpayment")) {
  313. this.getView().setVisible(false, new String[]{"settleorg"});
  314. }
  315. this.settleOrg(false);
  316. if (this.isBotpNew()) {
  317. this.supplePayeeInfo();
  318. }
  319. this.getModel().setDataChanged(false);
  320. }
  321. private void supplePayeeInfo() {
  322. Object sourcebilltype = this.getModel().getValue("sourcebilltype");
  323. if (!CasHelper.isEmpty(sourcebilltype)) {
  324. Object payee = this.getModel().getValue("payee");
  325. Object payeebanknumMo = this.getModel().getValue("payeebanknum");
  326. Object payeebankMo = this.getModel().getValue("payeebank");
  327. Object payeeType = this.getValue("payeetype");
  328. if (CasHelper.isEmpty(payeebanknumMo) && CasHelper.isEmpty(payeebankMo)) {
  329. String billName = this.getModel().getDataEntityType().getName();
  330. Map<String, Object> resultMap = CasPayeeOrPayerHelper.getPayeeOrPayerInfo(payee, payeeType, billName);
  331. if (resultMap.size() > 0) {
  332. Object bankaccount = resultMap.get("payeebanknum");
  333. Object accountname = resultMap.get("accountname");
  334. DynamicObject payeebank = (DynamicObject)resultMap.get("payeebank");
  335. this.getModel().setValue("payeebanknum", bankaccount);
  336. this.getModel().setValue("recaccbankname", accountname);
  337. if (!CasHelper.isEmpty(payeebank)) {
  338. this.fillProvinceAndCity(payeebank);
  339. }
  340. }
  341. } else if (!CasHelper.isEmpty(payeebankMo)) {
  342. this.fillProvinceAndCity((DynamicObject)payeebankMo);
  343. }
  344. }
  345. }
  346. private void fillProvinceAndCity(DynamicObject payeeBank) {
  347. logger.info("打开单据 填充 国家、省、城市字段");
  348. payeeBank = BusinessDataServiceHelper.loadSingle(payeeBank.getPkValue(), payeeBank.getDataEntityType().getName(), "id,name,number,country,provincetxt,citytxt,union_number");
  349. this.getModel().setValue("payeebank", payeeBank);
  350. this.getModel().setValue("payeebankname", payeeBank.getString("name"));
  351. this.getModel().setValue("recbanknumber", payeeBank.getString("union_number"));
  352. this.getModel().setValue("reccountry", payeeBank.getDynamicObject("country"));
  353. this.getModel().setValue("recprovince", payeeBank.getString("provincetxt"));
  354. this.getModel().setValue("reccity", payeeBank.getString("citytxt"));
  355. }
  356. private void createNewModel() {
  357. this.getView().setVisible(false, new String[]{"usage"});
  358. FormShowParameter parameter = this.getView().getFormShowParameter();
  359. Map<String, Object> customParams = parameter.getCustomParams();
  360. if (this.getModel().getValue("org") != null) {
  361. this.orgId = this.getPk("org");
  362. } else {
  363. String appId = this.getView().getFormShowParameter().getAppId();
  364. if (EmptyUtil.isNotEmpty(appId)) {
  365. appId = AppMetadataCache.getAppInfo(appId).getId();
  366. } else {
  367. appId = AppMetadataCache.getAppInfo("cas").getId();
  368. }
  369. List<Long> authorizedBankOrgId = OrgHelper.getAuthorizedBankOrgId(RequestContext.get().getCurrUserId(), appId, "nckd_cas_arbill", "47156aff000000ac");
  370. if (!CollectionUtils.isEmpty(authorizedBankOrgId)) {
  371. this.orgId = (Long)authorizedBankOrgId.get(0);
  372. this.setValue("org", this.orgId);
  373. } else {
  374. this.orgId = null;
  375. }
  376. }
  377. this.setValueIfAbsent("bizdate", DateUtils.getCurrentDate());
  378. if (customParams != null && customParams.containsKey("paymentType")) {
  379. String entrance = (String)customParams.get("paymentType");
  380. this.setValue("entrance", entrance);
  381. long billTypeID = 0L;
  382. QFilter[] qFilters;
  383. if (PaymentTypeEnum.AP.name().equals(entrance)) {
  384. qFilters = new QFilter[]{new QFilter("ispartpayment", "=", "1"), new QFilter("biztype", "=", "201")};
  385. this.setPaymentType(qFilters);
  386. billTypeID = BillTypeConstants.PAYBILL_PUR;
  387. } else if (PaymentTypeEnum.SYN.name().equals(entrance)) {
  388. qFilters = new QFilter[]{new QFilter("biztype", "=", "214")};
  389. this.setPaymentType(qFilters);
  390. billTypeID = BillTypeConstants.PAYBILL_SYN;
  391. } else if (PaymentTypeEnum.SPAN.name().equals(entrance)) {
  392. qFilters = new QFilter[]{new QFilter("biztype", "=", "217")};
  393. this.setPaymentType(qFilters);
  394. billTypeID = BillTypeConstants.PAYBILL_SPAN;
  395. } else if (PaymentTypeEnum.CASH.name().equals(entrance)) {
  396. qFilters = new QFilter[]{new QFilter("biztype", "=", "215")};
  397. this.setPaymentType(qFilters);
  398. billTypeID = BillTypeConstants.PAYBILL_CASH;
  399. } else {
  400. if (PaymentTypeEnum.ER.name().equals(entrance)) {
  401. qFilters = new QFilter[]{new QFilter("biztype", "=", "211")};
  402. this.setPaymentType(qFilters);
  403. } else if (PaymentTypeEnum.OTR.name().equals(entrance)) {
  404. qFilters = new QFilter[]{new QFilter("biztype", "=", "999")};
  405. this.setPaymentType(qFilters);
  406. }
  407. billTypeID = BillTypeConstants.PAYBILL_OTR;
  408. }
  409. this.setValue("issingle", "1");
  410. if (billTypeID != 0L && QueryServiceHelper.exists("bos_billtype", billTypeID)) {
  411. // this.setValue("billtype", billTypeID);
  412. }
  413. }
  414. this.fillPayeeType(true);
  415. if (CasHelper.isEmpty(this.orgId)) {
  416. this.getView().setEnable(false, new String[]{"bar_save", "bar_submit", "bar_beforesubmit"});
  417. this.getView().showErrorNotification(ResManager.loadKDString("请先选择付款人", "PaymentBillEdit_30", "fi-cas-formplugin", new Object[0]));
  418. } else if (InitCheckPluginHelper.checkInitForPlugin(this.getView(), this.getDynamicObject("org"), new String[]{"bar_save", "bar_submit", "bar_beforesubmit"})) {
  419. this.getView().setEnable(true, new String[]{"bar_save", "bar_submit", "bar_beforesubmit"});
  420. DynamicObject baseCurrency = OrgHelper.getBaseCurrency(this.orgId);
  421. this.setValue("basecurrency", baseCurrency);
  422. this.setValue("currency", baseCurrency);
  423. this.setValue("dpcurrency", baseCurrency);
  424. this.setValue("feecurrency", baseCurrency);
  425. this.setDefaultExratetable(this.orgId);
  426. DynamicObject defaultSettleType = BaseDataHelper.getDefaultSettleType();
  427. this.setValue("settletype", defaultSettleType);
  428. DynamicObject defaultPayAccount;
  429. if (!BaseDataHelper.isSettleTypeCash(defaultSettleType)) {
  430. defaultPayAccount = AccountBankHelper.getDefaultPayAccount(this.orgId);
  431. if (defaultPayAccount == null || (!BaseDataHelper.isSettleTypeVirtual(defaultSettleType) || !VisibleVirtualAcctHelper.checkVirtualAcct(defaultPayAccount)) && (BaseDataHelper.isSettleTypeVirtual(defaultSettleType) || VisibleVirtualAcctHelper.checkVirtualAcct(defaultPayAccount))) {
  432. this.getView().setEnable(false, new String[]{"exchangerate"});
  433. this.clearBalanceValue();
  434. } else {
  435. this.setValue("payeracctbank", defaultPayAccount);
  436. this.payerAcctBankF7Changed((PropertyChangedArgs)null, defaultPayAccount);
  437. this.currencyF7Changed(false);
  438. }
  439. }
  440. defaultPayAccount = BusinessDataServiceHelper.loadSingleFromCache(this.orgId, "bos_org");
  441. this.getModel().setValue("payernumber", defaultPayAccount.getString("number"));
  442. this.getModel().setValue("uniformsocialcreditcode", defaultPayAccount.getString("uniformsocialcreditcode"));
  443. this.setPayerInfo4Lb();
  444. this.setOpenOrg();
  445. }
  446. }
  447. private void setPayerInfo4Lb() {
  448. DynamicObject org = (DynamicObject)this.getModel().getValue("org");
  449. if (org != null) {
  450. this.getModel().setValue("orgv", CasHelper.getLocalValue(org, "name"));
  451. String defaultUrl = "/icons/pc/entrance/cn_fk_80_80.png";
  452. Image orgPic = (Image)this.getControl("orgpic");
  453. orgPic.setUrl(defaultUrl);
  454. DynamicObject payerAcctBank = (DynamicObject)this.getModel().getValue("payeracctbank");
  455. DynamicObject payerAcctCash = (DynamicObject)this.getModel().getValue("payeracctcash");
  456. String v_payerbanknum = "";
  457. if (payerAcctBank != null) {
  458. v_payerbanknum = StringUtils.splitString(payerAcctBank.getString("bankaccountnumber"), 4, " ");
  459. } else if (payerAcctCash != null) {
  460. v_payerbanknum = payerAcctCash.getString("number");
  461. }
  462. ((Label)this.getControl("payerbanknumv")).setText(v_payerbanknum);
  463. DynamicObject payerBank = (DynamicObject)this.getModel().getValue("payerbank");
  464. String v_payerbankname = "";
  465. if (payerBank != null) {
  466. v_payerbankname = CasHelper.getLocalValue(payerBank, "name");
  467. }
  468. ((Label)this.getControl("payerbanknamev")).setText(v_payerbankname);
  469. boolean isCash = BaseDataHelper.isSettleTypeCash((DynamicObject)this.getModel().getValue("settletype"));
  470. this.getView().setVisible(!isCash, new String[]{"payerbanknamev", "payerbanknamelb"});
  471. }
  472. }
  473. private void fillPayeeType(boolean setDefaultValue) {
  474. ComboEdit payeetypeCbo = (ComboEdit)this.getView().getControl("payeetype");
  475. List<ComboItem> comboItem = new ArrayList();
  476. String entrance = (String)this.getModel().getValue("entrance");
  477. if (PaymentTypeEnum.AP.name().equals(entrance)) {
  478. comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.SUPPLIER.getName()), AsstActTypeEnum.SUPPLIER.getValue()));
  479. comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.CUSTOMER.getName()), AsstActTypeEnum.CUSTOMER.getValue()));
  480. comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.EMPLOYEE.getName()), AsstActTypeEnum.EMPLOYEE.getValue()));
  481. } else if (!PaymentTypeEnum.SYN.name().equals(entrance) && !PaymentTypeEnum.CASH.name().equals(entrance)) {
  482. AsstActTypeEnum[] var5 = AsstActTypeEnum.values();
  483. int var6 = var5.length;
  484. for(int var7 = 0; var7 < var6; ++var7) {
  485. AsstActTypeEnum asstAct = var5[var7];
  486. comboItem.add(new ComboItem(new LocaleString(asstAct.getName()), asstAct.getValue()));
  487. }
  488. } else {
  489. comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.COMPANY.getName()), AsstActTypeEnum.COMPANY.getValue()));
  490. }
  491. payeetypeCbo.setComboItems(comboItem);
  492. if (setDefaultValue) {
  493. this.getModel().setValue("payeetype", ((ComboItem)comboItem.get(0)).getValue());
  494. }
  495. }
  496. public void afterImportData(ImportDataEventArgs e) {
  497. super.afterImportData(e);
  498. PaymentFillPropHelper.fillProp(this.getModel().getDataEntity());
  499. if (this.getModel().getValue("entrance") == null) {
  500. this.setEntrance();
  501. }
  502. }
  503. public void initImportData(InitImportDataEventArgs e) {
  504. super.initImportData(e);
  505. this.getPageCache().put("isFromWebApi", "true");
  506. }
  507. public void afterCopyData(EventObject e) {
  508. super.afterCopyData(e);
  509. DynamicObject billType = (DynamicObject)this.getValue("billtype");
  510. if (billType != null && BillTypeConstants.PAYBILL_PUR == billType.getLong("id")) {
  511. this.getModel().setValue("entrance", PaymentTypeEnum.AP.name());
  512. }
  513. this.fillPayeeType(false);
  514. this.setValue("sourcetype", SourceTypeEnum.CAS);
  515. DynamicObject paymentType = (DynamicObject)this.getValue("paymenttype");
  516. if (paymentType != null && paymentType.getBoolean("ispartpayment")) {
  517. int count = this.getModel().getEntryRowCount("entry");
  518. for(int i = 0; i < count; ++i) {
  519. this.setValue("e_unlockamt", (BigDecimal)this.getModel().getValue("e_payableamt", i), i);
  520. this.setValue("e_unsettledamt", (BigDecimal)this.getModel().getValue("e_payableamt", i), i);
  521. }
  522. this.getView().updateView("entry");
  523. }
  524. this.showBalance();
  525. this.setNetBankAcctVisible();
  526. DynamicObject accountBank = this.getDynamicObject("payeracctbank");
  527. this.setPaymentChannelValue(accountBank, Boolean.TRUE);
  528. DynamicObject crossTranType0 = (DynamicObject)this.getModel().getValue("crosstrantype");
  529. if (crossTranType0 != null) {
  530. DynamicObject crossTransType = BusinessDataServiceHelper.loadSingle(crossTranType0.getPkValue(), "bei_crosstrantype");
  531. DynamicObjectCollection dynamicObjectCollection = crossTransType.getDynamicObjectCollection("entry");
  532. this.isCrossTranTypeHide(dynamicObjectCollection);
  533. }
  534. this.getModel().deleteEntryData("cas_draftinfo");
  535. this.getModel().setValue("applyorg", (Object)null);
  536. }
  537. public void afterLoadData(EventObject e) {
  538. super.afterLoadData(e);
  539. this.showBalance();
  540. this.setNetBankAcctVisible();
  541. DynamicObject crossTranType0 = (DynamicObject)this.getModel().getValue("crosstrantype");
  542. if (crossTranType0 != null) {
  543. DynamicObject crossTransType = BusinessDataServiceHelper.loadSingle(crossTranType0.getPkValue(), "bei_crosstrantype");
  544. DynamicObjectCollection dynamicObjectCollection = crossTransType.getDynamicObjectCollection("entry");
  545. this.isCrossTranTypeHide(dynamicObjectCollection);
  546. }
  547. }
  548. private void ctrRefundInfoVisibility() {
  549. logger.info("付款单:PaymentBillEdit.ctrRefundInfoVisibility()");
  550. this.getView().setVisible(false, new String[]{"bar_refund_save"});
  551. String billstatus = (String)this.getValue("billstatus");
  552. this.getView().setVisible(BillStatusEnum.REFUND.getValue().equals(billstatus) || BillStatusEnum.RENOTE.getValue().equals(billstatus), new String[]{"e_refundamt", "e_refunddes"});
  553. this.getView().setEnable(false, new String[]{"e_refundamt", "e_refunddes"});
  554. }
  555. private void setNetBankAcctVisible() {
  556. String paymentchannel = (String)this.getValue("paymentchannel");
  557. if (null != paymentchannel && this.isAcctBankExistOnlineBankAcct()) {
  558. this.getView().setVisible(true, new String[]{"netbankacct"});
  559. } else {
  560. this.getView().setVisible(false, new String[]{"netbankacct"});
  561. }
  562. }
  563. private void setEntrance() {
  564. DynamicObject billType = (DynamicObject)this.getModel().getValue("billtype");
  565. if (billType != null) {
  566. Long billTypeId = billType.getLong("id");
  567. if (BillTypeConstants.PAYBILL_PUR.equals(billTypeId)) {
  568. this.getModel().setValue("entrance", PaymentTypeEnum.AP.name());
  569. } else if (BillTypeConstants.PAYBILL_EXP.equals(billTypeId)) {
  570. this.getModel().setValue("entrance", PaymentTypeEnum.OTR.name());
  571. } else if (BillTypeConstants.PAYBILL_OTR.equals(billTypeId)) {
  572. this.getModel().setValue("entrance", PaymentTypeEnum.OTR.name());
  573. } else if (BillTypeConstants.PAYBILL_SYN.equals(billTypeId)) {
  574. this.getModel().setValue("entrance", PaymentTypeEnum.SYN.name());
  575. } else if (BillTypeConstants.PAYBILL_CASH.equals(billTypeId)) {
  576. this.getModel().setValue("entrance", PaymentTypeEnum.CASH.name());
  577. } else if (BillTypeConstants.PAYBILL_SPAN.equals(billTypeId)) {
  578. this.getModel().setValue("entrance", PaymentTypeEnum.SPAN.name());
  579. }
  580. }
  581. }
  582. public void customPrintDataObject(CustomPrintDataObjectArgs e) {
  583. super.customPrintDataObject(e);
  584. String entityKey = e.getDataSourceName();
  585. if ("nckd_cas_arbill".equals(entityKey)) {
  586. List<DynamicObject> dataEntitiesv = new ArrayList();
  587. DynamicObject dsv = this.getModel().getDataEntity();
  588. DynamicObject basecur = (DynamicObject)this.getModel().getValue("basecurrency");
  589. if (basecur != null) {
  590. dsv.set("basecurrency", basecur.getString("name"));
  591. }
  592. if (dsv.getString("payeetype") != null && dsv.getString("payeetype").length() > 0) {
  593. dsv.set("payeetype", AsstActTypeEnum.getName(dsv.getString("payeetype")));
  594. }
  595. dataEntitiesv.add(dsv);
  596. e.setDataEntities(dataEntitiesv);
  597. }
  598. }
  599. public void propertyChanged(PropertyChangedArgs e) {
  600. String key = e.getProperty().getName();
  601. ChangeData[] changeData = e.getChangeSet();
  602. Object newValue = changeData[0].getNewValue();
  603. Object oldValue = changeData[0].getOldValue();
  604. int iRow = changeData[0].getRowIndex();
  605. if (newValue != oldValue) {
  606. DynamicObject applyDo;
  607. switch (key) {
  608. case "paymenttype":
  609. this.paymentTypeChanged((DynamicObject)newValue);
  610. break;
  611. case "bizdate":
  612. this.exratedateChanged(newValue);
  613. break;
  614. case "exratetable":
  615. this.currencyF7Changed(false);
  616. this.setRecInfo("dpexratetable", newValue, Boolean.FALSE);
  617. break;
  618. case "exratedate":
  619. this.currencyF7Changed(false);
  620. this.setRecInfo("dpexratedate", newValue, Boolean.FALSE);
  621. break;
  622. case "payeetype":
  623. this.payeeTypeChanged((String)newValue, true);
  624. break;
  625. case "org":
  626. this.setOpenOrg();
  627. this.showBalance();
  628. break;
  629. case "payeracctbank":
  630. this.payerAcctBankF7Changed(e, newValue);
  631. this.isOnlinebankVisibility();
  632. break;
  633. case "payeracctcash":
  634. this.payerAcctCashChanged((DynamicObject)newValue);
  635. break;
  636. case "currency":
  637. this.currencyF7Changed(true);
  638. this.setRecInfo("dpcurrency", newValue, Boolean.TRUE);
  639. this.setExratetableVisibility();
  640. break;
  641. case "exchangerate":
  642. case "agreedquotation":
  643. case "payquotation":
  644. case "dppayquotation":
  645. this.calculateAmt();
  646. break;
  647. case "settletype":
  648. this.settleTypeChanged(e, newValue);
  649. this.settletNumber((DynamicObject)newValue);
  650. this.isClearSettleType((DynamicObject)oldValue, (DynamicObject)newValue);
  651. if (this.isClearFeeSettleType()) {
  652. this.setValue("fee", (Object)null);
  653. }
  654. break;
  655. case "billstatus":
  656. PaymentBillPluginHelper.fillToolBar(this, this.getModel(), this.getView());
  657. break;
  658. case "e_payableamt":
  659. this.entries_payableAmtChanged((BigDecimal)newValue, oldValue, iRow);
  660. break;
  661. case "e_discountamt":
  662. this.entries_discountAmtChanged((BigDecimal)newValue, oldValue, iRow);
  663. break;
  664. case "entrustorg":
  665. this.entrustorgChange(newValue);
  666. break;
  667. case "paymentchannel":
  668. this.paymentchannelChange();
  669. break;
  670. case "e_refundamt":
  671. this.refundChange((BigDecimal)newValue, (BigDecimal)oldValue, iRow);
  672. break;
  673. case "crosstrantype":
  674. DynamicObject crossTranType0 = (DynamicObject)this.getModel().getValue("crosstrantype");
  675. if (crossTranType0 != null) {
  676. applyDo = BusinessDataServiceHelper.loadSingle(crossTranType0.getPkValue(), "bei_crosstrantype");
  677. DynamicObjectCollection dynamicObjectCollection = applyDo.getDynamicObjectCollection("entry");
  678. this.isCrossTranTypeHide(dynamicObjectCollection);
  679. Iterator var16 = dynamicObjectCollection.iterator();
  680. while(var16.hasNext()) {
  681. DynamicObject dyobj = (DynamicObject)var16.next();
  682. String settleMethod = ResManager.loadKDString("清算方式", "PaymentBillEdit_27", "fi-cas-formplugin", new Object[0]);
  683. if (kd.bos.dataentity.utils.StringUtils.equals(settleMethod, dyobj.getString("fieldname")) && kd.bos.dataentity.utils.StringUtils.isNotEmpty(dyobj.getString("defaultvalue"))) {
  684. this.getModel().setValue("settlementmethod", dyobj.getString("defaultvalue"));
  685. }
  686. }
  687. }
  688. break;
  689. case "applyid":
  690. applyDo = (DynamicObject)newValue;
  691. if (applyDo != null) {
  692. String name = applyDo.getString("name");
  693. String phone = applyDo.getString("phone");
  694. this.getModel().beginInit();
  695. this.getModel().setValue("applyname", name);
  696. this.getModel().endInit();
  697. if (kd.bos.dataentity.utils.StringUtils.isNotEmpty(phone)) {
  698. this.getModel().setValue("applyphone", phone);
  699. }
  700. this.getView().updateView("applyname");
  701. }
  702. break;
  703. case "reccountry":
  704. case "paycountry":
  705. this.setCrossPayValue();
  706. }
  707. }
  708. }
  709. private void isCrossTranTypeHide(DynamicObjectCollection dyobj) {
  710. QFilter qFilter = new QFilter("enable", "=", '1');
  711. DynamicObject[] crossTransType = BusinessDataServiceHelper.load("bei_crosstranfield", "id,number", new QFilter[]{qFilter});
  712. List<Long> number = (List)dyobj.stream().map((e) -> {
  713. return e.getLong("id");
  714. }).collect(Collectors.toList());
  715. Arrays.stream(crossTransType).forEach((e) -> {
  716. if (!number.contains(e.getLong("id"))) {
  717. this.getView().setVisible(Boolean.FALSE, new String[]{e.getString("number")});
  718. }
  719. });
  720. }
  721. private void isClearSettleType(DynamicObject oldValue, DynamicObject newValue) {
  722. String settletnumber = (String)this.getModel().getValue("settletnumber");
  723. if (EmptyUtil.isNoEmpty(settletnumber) && Objects.nonNull(oldValue) && SettleMentTypeEnum.CREDIT.getValue().equals(oldValue.getString("settlementtype")) && (Objects.nonNull(newValue) && !SettleMentTypeEnum.CREDIT.getValue().equals(newValue.getString("settlementtype")) || Objects.isNull(newValue))) {
  724. this.getModel().setValue("settletnumber", (Object)null);
  725. this.getModel().setValue("sourcebilltype", (Object)null);
  726. this.getModel().setValue("sourcebillid", (Object)null);
  727. this.getModel().setValue("sourcetype", "CAS");
  728. this.getModel().deleteEntryData("billhead_lk");
  729. }
  730. }
  731. private void settletNumber(DynamicObject newValue) {
  732. if (!Objects.isNull(newValue)) {
  733. Object settlementType = newValue.get("settlementtype");
  734. DynamicObject org = (DynamicObject)this.getModel().getValue("org");
  735. String appId;
  736. if (Objects.nonNull(org)) {
  737. appId = AppMetadataCache.getAppInfo("cdm").getId();
  738. boolean visible = false;
  739. if (!Objects.equals(settlementType, SettleMentTypeEnum.BUSINESS.getValue()) && !Objects.equals(settlementType, SettleMentTypeEnum.BANK.getValue())) {
  740. if (Objects.equals(settlementType, SettleMentTypeEnum.PROMISSORY.getValue())) {
  741. visible = (Boolean) SystemParamServiceHelper.getAppParameter(appId, "08", (Long)org.getPkValue(), "ischeck");
  742. } else if (Objects.equals(settlementType, SettleMentTypeEnum.CHECK.getValue())) {
  743. visible = (Boolean)SystemParamServiceHelper.getAppParameter(appId, "08", (Long)org.getPkValue(), "ispromissorynote");
  744. }
  745. } else {
  746. visible = (Boolean)SystemParamServiceHelper.getAppParameter(appId, "08", (Long)org.getPkValue(), "isdraft");
  747. }
  748. this.getView().setVisible(!visible, new String[]{"settletnumber"});
  749. this.getView().setVisible(visible, new String[]{"draftbill"});
  750. }
  751. appId = this.getString("settletnumber");
  752. if (PayBillHepler.isCreditSettlement(newValue) && appId != null && appId.trim().length() > 0 && "cas_payapplybill".equals(this.getString("sourcebilltype"))) {
  753. this.getView().setEnable(false, new String[]{"settletype", "settletnumber"});
  754. }
  755. }
  756. }
  757. private void refundChange(BigDecimal newValue, BigDecimal oldValue, int iRow) {
  758. IBillModel model = (IBillModel)this.getModel();
  759. BigDecimal e_actamt = (BigDecimal)model.getValue("e_actamt", iRow);
  760. if (BigDecimal.ZERO.compareTo(newValue) != 0) {
  761. if (BigDecimal.ZERO.compareTo(newValue) > 0) {
  762. model.setValue("e_refundamt", oldValue, iRow);
  763. this.getView().showTipNotification(ResManager.loadKDString("退款金额不能为零", "PaymentBillEdit_21", "fi-cas-formplugin", new Object[0]));
  764. } else if (e_actamt.compareTo(newValue) < 0) {
  765. model.setValue("e_refundamt", oldValue, iRow);
  766. this.getView().showTipNotification(ResManager.loadKDString("退款金额不能大于付款金额", "PaymentBillEdit_20", "fi-cas-formplugin", new Object[0]));
  767. }
  768. }
  769. }
  770. private void paymentchannelChange() {
  771. if (this.isBeiBePay()) {
  772. this.setValue("fee", (Object)null);
  773. }
  774. this.isOnlinebankVisibility();
  775. this.ctrBeInfoVisibility();
  776. this.changePayeeValue();
  777. }
  778. private void entrustorgChange(Object newValue) {
  779. if (null != newValue) {
  780. this.getModel().setValue("settletype", (Object)null);
  781. } else {
  782. DynamicObject defaultSettleType = BaseDataHelper.getDefaultSettleType();
  783. this.setValue("settletype", defaultSettleType);
  784. }
  785. }
  786. private void addEntryCache() {
  787. DynamicObjectCollection entry = this.getModel().getEntryEntity("entry");
  788. List<Map<String, Object>> list = new ArrayList();
  789. Iterator var3 = entry.iterator();
  790. while(var3.hasNext()) {
  791. DynamicObject row = (DynamicObject)var3.next();
  792. Map<String, Object> map = new HashMap();
  793. map.put("e_expenseitem", row.get("e_expenseitem") == null ? null : ((DynamicObject)row.get("e_expenseitem")).getPkValue());
  794. map.put("e_payableamt", row.get("e_payableamt"));
  795. map.put("project", row.get("project") == null ? null : row.getDynamicObject("project").getPkValue());
  796. map.put("e_fundflowitem", row.get("e_fundflowitem") == null ? null : row.getDynamicObject("e_fundflowitem").getPkValue());
  797. map.put("e_remark", row.get("e_remark"));
  798. list.add(map);
  799. }
  800. Map<String, List<Map<String, Object>>> map = new HashMap();
  801. map.put("entry", list);
  802. String mapJson = SerializationUtils.toJsonString(map);
  803. this.getPageCache().put("entry", mapJson);
  804. }
  805. private void paymentTypeChanged(DynamicObject paymentType) {
  806. String entrance = (String)this.getModel().getValue("entrance");
  807. boolean isAp;
  808. if (paymentType != null && PaymentTypeEnum.OTR.name().equals(entrance)) {
  809. isAp = paymentType.getBoolean("ispartpayment");
  810. Long billTypeID = this.getPk("billtype");
  811. boolean isChange = false;
  812. if (isAp) {
  813. if (!BillTypeConstants.PAYBILL_EXP.equals(billTypeID)) {
  814. this.addEntryCache();
  815. this.setValue("billtype", BusinessDataServiceHelper.loadSingleFromCache(BillTypeConstants.PAYBILL_EXP, "bos_billtype"));
  816. isChange = true;
  817. }
  818. } else if (!BillTypeConstants.PAYBILL_OTR.equals(billTypeID)) {
  819. this.addEntryCache();
  820. this.setValue("billtype", BusinessDataServiceHelper.loadSingleFromCache(BillTypeConstants.PAYBILL_OTR, "bos_billtype"));
  821. isChange = true;
  822. }
  823. if (isChange) {
  824. this.getModel().beginInit();
  825. this.setValue("paymenttype", paymentType);
  826. this.getModel().endInit();
  827. this.getView().updateView("paymenttype");
  828. Label payeebanknumvLable = (Label)this.getControl("payeebanknumv");
  829. payeebanknumvLable.setText("");
  830. Label recaccbanknamevLable = (Label)this.getControl("recaccbanknamev");
  831. recaccbanknamevLable.setText("");
  832. Label payeebanknamevLable = (Label)this.getControl("payeebanknamev");
  833. payeebanknamevLable.setText("");
  834. Label recbanknumbervLable = (Label)this.getControl("recbanknumberv");
  835. recbanknumbervLable.setText("");
  836. }
  837. }
  838. this.setEntryAmountCaption();
  839. if (paymentType != null) {
  840. isAp = paymentType.getBoolean("ispartpayment");
  841. this.getView().setVisible(isAp, new String[]{"settleorg"});
  842. this.settleOrg(false);
  843. DynamicObject fundflowitem = paymentType.getDynamicObject("fundflowitem");
  844. this.fillFundflowItem(true, fundflowitem);
  845. }
  846. }
  847. private void settleTypeChanged(PropertyChangedArgs e, Object newValue) {
  848. this.ctrBeInfoVisibility();
  849. DynamicObject settleType = (DynamicObject)newValue;
  850. DynamicObject accountCash;
  851. if (BaseDataHelper.isSettleTypeCash(settleType)) {
  852. this.setValue("payeracctbank", (Object)null);
  853. this.setValue("payerbank", (Object)null);
  854. accountCash = this.getDynamicObject("payeracctcash");
  855. if (accountCash == null) {
  856. this.setValue("payeracctcash", AccountCashHelper.getDefaultAccountcash(this.getPk("org"), "payer"));
  857. }
  858. this.setValue("isdiffcur", "0");
  859. this.getView().setVisible(false, new String[]{"isdiffcur"});
  860. } else {
  861. this.setValue("payeracctcash", (Object)null);
  862. this.getView().setVisible(true, new String[]{"isdiffcur"});
  863. }
  864. this.setPayerInfo4Lb();
  865. accountCash = this.getDynamicObject("payeracctbank");
  866. this.setPaymentChannelValue(accountCash, Boolean.TRUE);
  867. this.changePayeeValue();
  868. }
  869. private void ctrBeInfoVisibility() {
  870. boolean isBePay = this.isBePay();
  871. this.getView().setVisible(!this.isDraft(), new String[]{"settletnumber"});
  872. this.getView().setVisible(this.isDraft(), new String[]{"draftbill"});
  873. this.getView().setVisible(isBePay, new String[]{"usage"});
  874. }
  875. private boolean isDraft() {
  876. DynamicObject settleType = (DynamicObject)this.getModel().getValue("settletype");
  877. if (settleType == null) {
  878. return false;
  879. } else {
  880. String settlementType = settleType.getString("settlementtype");
  881. return Objects.equals(settlementType, SettleMentTypeEnum.BANK.getValue()) || Objects.equals(settlementType, SettleMentTypeEnum.BUSINESS.getValue()) || Objects.equals(settlementType, SettleMentTypeEnum.CHECK.getValue()) || Objects.equals(settlementType, SettleMentTypeEnum.PROMISSORY.getValue());
  882. }
  883. }
  884. private void exratedateChanged(Object newValue) {
  885. if (newValue != null) {
  886. this.setValue("exratedate", newValue);
  887. this.setValue("dpexratedate", newValue);
  888. }
  889. }
  890. private void currencyF7Changed(boolean reBalance) {
  891. if (reBalance) {
  892. this.showBalance();
  893. }
  894. this.setExchangerateEditable();
  895. }
  896. private void entries_payableAmtChanged(BigDecimal payableAmt, Object oldValue, int iRow) {
  897. IBillModel model = (IBillModel)this.getModel();
  898. BigDecimal discountAmt = (BigDecimal)model.getValue("e_discountamt", iRow);
  899. discountAmt = discountAmt != null ? discountAmt : BigDecimal.ZERO;
  900. if (discountAmt.abs().compareTo(payableAmt.abs()) > 0) {
  901. this.getView().showTipNotification(String.format(ResManager.loadKDString("现金折扣绝对值不允许大于应付金额绝对值!", "PaymentBillEdit_2", "fi-cas-formplugin", new Object[0])));
  902. this.setValue("e_payableamt", oldValue, iRow);
  903. } else {
  904. this.calculateAmt();
  905. }
  906. }
  907. private void entries_discountAmtChanged(BigDecimal discountAmt, Object oldValue, int iRow) {
  908. IBillModel model = (IBillModel)this.getModel();
  909. BigDecimal payableAmt = (BigDecimal)model.getValue("e_payableamt", iRow);
  910. payableAmt = payableAmt != null ? payableAmt : BigDecimal.ZERO;
  911. if (discountAmt.abs().compareTo(payableAmt.abs()) > 0) {
  912. this.getView().showTipNotification(String.format(ResManager.loadKDString("现金折扣绝对值不允许大于应付金额绝对值!", "PaymentBillEdit_2", "fi-cas-formplugin", new Object[0])));
  913. this.setValue("e_discountamt", oldValue, iRow);
  914. } else {
  915. this.calculateAmt();
  916. }
  917. }
  918. private void calculateAmt() {
  919. DynamicObject basecurrency = this.getDynamicObject("basecurrency");
  920. BigDecimal exchangeRate = (BigDecimal)this.getModel().getValue("exchangerate");
  921. String quotation = this.getString("payquotation");
  922. int round = 10;
  923. if (basecurrency != null) {
  924. round = basecurrency.getInt("amtprecision");
  925. }
  926. int count = this.getModel().getEntryRowCount("entry");
  927. BigDecimal sumAmt = BigDecimal.ZERO;
  928. BigDecimal sumLocalAmt = BigDecimal.ZERO;
  929. for(int i = 0; i < count; ++i) {
  930. DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
  931. BigDecimal payAmount = rowInfo.getBigDecimal("e_payableamt");
  932. if (payAmount != null) {
  933. this.setValue("e_payablelocamt", QuotationHelper.callToCurrency(payAmount, exchangeRate, quotation, round), i);
  934. }
  935. BigDecimal discountAmt = rowInfo.getBigDecimal("e_discountamt");
  936. if (discountAmt != null) {
  937. this.setValue("e_discountlocamt", QuotationHelper.callToCurrency(discountAmt, exchangeRate, quotation, round), i);
  938. }
  939. if (payAmount != null && discountAmt != null) {
  940. BigDecimal actAmt = payAmount.subtract(discountAmt);
  941. sumAmt = sumAmt.add(actAmt);
  942. BigDecimal actLocalAmt = BigDecimal.ZERO;
  943. actLocalAmt = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
  944. sumLocalAmt = sumLocalAmt.add(actLocalAmt);
  945. this.setValue("e_actamt", actAmt, i);
  946. this.setValue("e_localamt", actLocalAmt, i);
  947. }
  948. this.setValue("e_unsettledamt", payAmount, i);
  949. if (payAmount != null) {
  950. this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(payAmount, exchangeRate, quotation, round), i);
  951. }
  952. this.setValue("e_unlockamt", payAmount, i);
  953. }
  954. this.setValue("actpayamt", sumAmt);
  955. this.setValue("localamt", sumLocalAmt);
  956. this.calculateDpAmt();
  957. }
  958. private void calculateDpAmt() {
  959. DynamicObject dpcurrency = this.getDynamicObject("dpcurrency");
  960. DynamicObject basecurrency = this.getDynamicObject("basecurrency");
  961. DynamicObject currency = this.getDynamicObject("currency");
  962. String dppayquotation = this.getString("dppayquotation");
  963. String agreedquotation = this.getString("agreedquotation");
  964. int round = 10;
  965. if (basecurrency != null) {
  966. round = basecurrency.getInt("amtprecision");
  967. }
  968. int dppayround = 10;
  969. if (dpcurrency != null) {
  970. dppayround = dpcurrency.getInt("amtprecision");
  971. }
  972. BigDecimal actPayAmt = this.getBigDecimal("actpayamt");
  973. if (currency != null) {
  974. actPayAmt = actPayAmt.setScale(currency.getInt("amtprecision"), 4);
  975. }
  976. BigDecimal localAmt = this.getBigDecimal("localamt");
  977. BigDecimal agreedRate = this.getBigDecimal("agreedrate");
  978. if (agreedRate.compareTo(new BigDecimal(0)) != 0) {
  979. BigDecimal dpAmt = BigDecimal.ZERO;
  980. dpAmt = QuotationHelper.callToCurrency(actPayAmt, agreedRate, agreedquotation, dppayround);
  981. BigDecimal dpExchangeRate = this.getBigDecimal("dpexchangerate");
  982. BigDecimal dpLocalAmt = BigDecimal.ZERO;
  983. dpLocalAmt = QuotationHelper.callToCurrency(dpAmt, dpExchangeRate, dppayquotation, round);
  984. this.getModel().beginInit();
  985. this.setValue("dpamt", dpAmt);
  986. this.setValue("dplocalamt", dpLocalAmt);
  987. this.setValue("lossamt", localAmt.subtract(dpLocalAmt));
  988. this.getModel().endInit();
  989. this.getView().updateView("dpamt");
  990. this.getView().updateView("dplocalamt");
  991. this.getView().updateView("lossamt");
  992. }
  993. }
  994. private void payeeTypeChanged(String payeeType, boolean isChanged) {
  995. if (isChanged) {
  996. this.getView().setVisible(true, new String[]{"flex_addpayee"});
  997. this.getView().setVisible(false, new String[]{"flex_payeeinfo"});
  998. this.clearPayeeValue();
  999. }
  1000. }
  1001. private void clearPayeeValue() {
  1002. Object value = null;
  1003. this.setValue("payeeformid", value);
  1004. this.setValue("payee", value);
  1005. this.setValue("payeename", value);
  1006. this.setValue("payeeaccformid", value);
  1007. this.setValue("payeeacctbank", value);
  1008. this.setValue("payeebanknum", value);
  1009. this.setValue("payeebank", value);
  1010. this.setValue("payeebankname", value);
  1011. this.setValue("recaccbankname", value);
  1012. this.setValue("recbanknumber", value);
  1013. this.setValue("payeenumber", (Object)null);
  1014. this.setValue("supplierBankId", (Object)null);
  1015. }
  1016. private void payerAcctBankF7Changed(PropertyChangedArgs e, Object newValue) {
  1017. DynamicObject payerAcctBank = (DynamicObject)newValue;
  1018. this.ctrBeInfoVisibility();
  1019. this.showBalance();
  1020. if (!FeePayerEnum.REC.getValue().equals(this.getString("feepayer"))) {
  1021. this.setValue("feeactbank", payerAcctBank);
  1022. }
  1023. if (payerAcctBank == null) {
  1024. this.setValue("payerbank", (Object)null);
  1025. this.setPaymentChannelValue((DynamicObject)null, Boolean.TRUE);
  1026. this.setCurrencyEditable();
  1027. } else {
  1028. this.setValue("payerbank", payerAcctBank.getDynamicObject("bank"));
  1029. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  1030. DynamicObject payCurrency = null;
  1031. if (isDiffCur) {
  1032. payCurrency = this.getDynamicObject("dpcurrency");
  1033. } else {
  1034. payCurrency = this.getDynamicObject("currency");
  1035. }
  1036. boolean containCurrency = AccountBankHelper.isAcctBankContainCurrency("bd_accountbanks", payerAcctBank.getPkValue(), payCurrency);
  1037. if (!containCurrency) {
  1038. Long defaultCurrencyId = (Long)payerAcctBank.get("defaultcurrency.id");
  1039. if (isDiffCur) {
  1040. this.setValue("dpcurrency", defaultCurrencyId);
  1041. } else if (this.isBotpCreate()) {
  1042. this.setValueIfAbsent("currency", defaultCurrencyId);
  1043. } else {
  1044. this.setValue("currency", defaultCurrencyId);
  1045. }
  1046. }
  1047. this.setCurrencyEditable();
  1048. this.setOpenOrg();
  1049. this.setPaymentChannelValue(payerAcctBank, Boolean.TRUE);
  1050. this.setSettleTypeValue(payerAcctBank);
  1051. this.settleOrg(true);
  1052. }
  1053. }
  1054. private void setPaymentChannelValue(DynamicObject payerAcctBank, boolean isAdd) {
  1055. List<ComboItem> comboItems = new ArrayList(1);
  1056. ComboEdit paymentChannel = (ComboEdit)this.getControl("paymentchannel");
  1057. DynamicObject settleType = this.getDynamicObject("settletype");
  1058. ComboItem comboItem = new ComboItem();
  1059. comboItem.setValue(PaymentChannelEnum.COUNTER.getValue());
  1060. comboItem.setCaption(new LocaleString(PaymentChannelEnum.COUNTER.getName()));
  1061. ComboItem selectedItem = comboItem;
  1062. comboItems.add(comboItem);
  1063. DynamicObject billtype = this.getDynamicObject("billtype");
  1064. if (null != payerAcctBank && (settleType == null || !"14".equals(settleType.getString("settlementtype"))) && (billtype == null || !BillTypeConstants.PAYBILL_CASH.equals(billtype.getPkValue()))) {
  1065. ComboItem item;
  1066. if (payerAcctBank.getBoolean("isopenbank")) {
  1067. item = new ComboItem();
  1068. item.setValue(PaymentChannelEnum.ONLINEBANK.getValue());
  1069. item.setCaption(new LocaleString(PaymentChannelEnum.ONLINEBANK.getName()));
  1070. selectedItem = item;
  1071. comboItems.add(item);
  1072. }
  1073. if (payerAcctBank.getBoolean("issetbankinterface")) {
  1074. item = new ComboItem();
  1075. item.setValue(PaymentChannelEnum.BEI.getValue());
  1076. item.setCaption(new LocaleString(ResManager.loadKDString(PaymentChannelEnum.BEI.getName(), "PaymentBillEdit_18", "fi-cas-formplugin", new Object[0])));
  1077. selectedItem = item;
  1078. comboItems.add(item);
  1079. }
  1080. String defaultPaymentChannel = "";
  1081. String defChannel;
  1082. if (Objects.nonNull(settleType)) {
  1083. defChannel = settleType.getString("paymentchannel");
  1084. defaultPaymentChannel = settleType.getString("defaultpaymentchannel");
  1085. if (kd.bos.dataentity.utils.StringUtils.isNotEmpty(defChannel)) {
  1086. List<String> paymentChannels = (List)Arrays.stream(defChannel.split(",")).filter(kd.bos.dataentity.utils.StringUtils::isNotEmpty).collect(Collectors.toList());
  1087. comboItems.removeIf((i) -> {
  1088. return !paymentChannels.contains(i.getValue());
  1089. });
  1090. }
  1091. }
  1092. paymentChannel.setComboItems(comboItems);
  1093. if (isAdd || this.isBotpNew() && Objects.isNull(this.getModel().getValue("paymentchannel"))) {
  1094. defChannel = selectedItem.getValue();
  1095. if (settleType != null && !SettleMentTypeEnum.COLLECT.getValue().equals(settleType.getString("settlementtype"))) {
  1096. defChannel = PaymentChannelEnum.COUNTER.getValue();
  1097. }
  1098. if (kd.bos.dataentity.utils.StringUtils.isNotEmpty(defaultPaymentChannel)) {
  1099. defChannel = defaultPaymentChannel;
  1100. }
  1101. String finalDefChannel = defChannel;
  1102. boolean contains = comboItems.stream().anyMatch((itemx) -> {
  1103. return Objects.equals(finalDefChannel, itemx.getValue());
  1104. });
  1105. if (!contains) {
  1106. defChannel = null;
  1107. }
  1108. if ("bei".equalsIgnoreCase(defChannel)) {
  1109. this.getModel().setValue("fee", (Object)null);
  1110. this.getModel().setValue("singlestream", Boolean.FALSE);
  1111. }
  1112. this.getModel().setValue("paymentchannel", defChannel);
  1113. }
  1114. } else {
  1115. paymentChannel.setComboItems(comboItems);
  1116. if (isAdd) {
  1117. this.getModel().setValue("paymentchannel", comboItem.getValue());
  1118. if ("bei".equalsIgnoreCase(comboItem.getValue())) {
  1119. this.getModel().setValue("fee", (Object)null);
  1120. this.getModel().setValue("singlestream", Boolean.FALSE);
  1121. }
  1122. }
  1123. }
  1124. }
  1125. private void payerAcctCashChanged(DynamicObject acctCash) {
  1126. if (acctCash == null) {
  1127. this.setValue("currency", this.getDynamicObject("basecurrency"));
  1128. this.setCurrencyEditable();
  1129. this.showBalance();
  1130. } else {
  1131. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  1132. DynamicObject payCurrency = null;
  1133. if (isDiffCur) {
  1134. payCurrency = this.getDynamicObject("dpcurrency");
  1135. } else {
  1136. payCurrency = this.getDynamicObject("currency");
  1137. }
  1138. boolean containCurrency = AccountBankHelper.isAcctBankContainCurrency("cas_accountcash", acctCash.getPkValue(), payCurrency);
  1139. if (!containCurrency) {
  1140. DynamicObject defaultCurrency = acctCash.getDynamicObject("defaultcurrency");
  1141. if (isDiffCur) {
  1142. this.setValue("dpcurrency", defaultCurrency);
  1143. } else if (this.isBotpCreate()) {
  1144. this.setValueIfAbsent("currency", defaultCurrency);
  1145. } else {
  1146. this.setValue("currency", defaultCurrency);
  1147. }
  1148. }
  1149. this.setCurrencyEditable();
  1150. this.setValue("openorg", acctCash.getDynamicObject("openorg"));
  1151. this.showBalance();
  1152. }
  1153. }
  1154. private void setCurrencyEditable() {
  1155. Boolean isCurrencyEditable = Boolean.TRUE;
  1156. DynamicObject settleType = this.getDynamicObject("settletype");
  1157. boolean isCash = BaseDataHelper.isSettleTypeCash(settleType);
  1158. DynamicObject accountCash;
  1159. if (isCash) {
  1160. accountCash = this.getDynamicObject("payeracctcash");
  1161. if (accountCash != null) {
  1162. isCurrencyEditable = !accountCash.getBoolean("isbycurrency");
  1163. }
  1164. } else {
  1165. accountCash = this.getDynamicObject("payeracctbank");
  1166. if (accountCash != null) {
  1167. isCurrencyEditable = accountCash.getBoolean("ismulcurrency");
  1168. }
  1169. }
  1170. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  1171. if (isDiffCur) {
  1172. this.getView().setEnable(isCurrencyEditable, new String[]{"dpcurrency"});
  1173. } else {
  1174. this.getView().setEnable(isCurrencyEditable, new String[]{"currency"});
  1175. }
  1176. if (this.isBotpCreate()) {
  1177. this.getView().setEnable(false, new String[]{"currency"});
  1178. }
  1179. }
  1180. private void showBalance() {
  1181. this.getView().setEnable(true, new String[]{"bar_save", "bar_submit", "bar_beforesubmit"});
  1182. if (this.getModel().getValue("org") != null) {
  1183. Long orgID = this.getPk("org");
  1184. Long acctBankId = this.getPk("payeracctbank");
  1185. Long acctCashId = this.getPk("payeracctcash");
  1186. Long currencyId = this.getPk("currency");
  1187. boolean var5 = (Boolean)this.getValue("isdiffcur");
  1188. if (var5) {
  1189. currencyId = this.getPk("dpcurrency");
  1190. }
  1191. if (orgID != null && (acctBankId != null || acctCashId != null) && currencyId != null) {
  1192. DynamicObject currency = BusinessDataServiceHelper.loadSingleFromCache(currencyId, "bd_currency");
  1193. try {
  1194. BigDecimal currentBalance = BigDecimal.ZERO;
  1195. if (CasHelper.isNotEmpty(acctBankId)) {
  1196. DynamicObject acctBank = BusinessDataServiceHelper.loadSingle(acctBankId, "am_accountbank", "acctclassify");
  1197. if (Objects.equals(acctBank.get("acctclassify"), AcctClassifyEnum.I.getValue())) {
  1198. currentBalance = getCurrBalance(acctBank);
  1199. } else {
  1200. String balanceType = SystemParameterFcsHelper.getParameterString(orgID, "balancevalue");
  1201. Object result = DispatchServiceHelper.invokeBizService("tmc", "fbp", "balanceModelService", "getRunningBalance", new Object[]{balanceType, acctBankId, currencyId});
  1202. BizBalanceModelBean bizBalanceModelBean = (BizBalanceModelBean)SerializationUtils.fromJsonString(SerializationUtils.toJsonString(result), BizBalanceModelBean.class);
  1203. currentBalance = bizBalanceModelBean.getAmount();
  1204. }
  1205. }
  1206. if (CasHelper.isNotEmpty(acctCashId)) {
  1207. currentBalance = AcctBalanceHelper.getAccountCashCurrBalance(orgID, acctCashId, currencyId, new Date());
  1208. ((Label)this.getControl("balancelb")).setText(ResManager.loadKDString("账面余额:", "PaymentBillEdit_4", "fi-cas-formplugin", new Object[0]));
  1209. LocaleString content = new LocaleString(ResManager.loadKDString("付款账户为现金账户时,账面余额即为当前时点现金日记账账面余额。", "PaymentBillEdit_3", "fi-cas-formplugin", new Object[0]));
  1210. ((Label)this.getControl("balancelb")).addTips(new Tips("text", (LocaleString)null, content, false, (List)null));
  1211. }
  1212. this.labCurrencySign = currency.getString("sign");
  1213. this.currencyAmtprecision = currency.getInt("amtprecision");
  1214. this.initFormat();
  1215. ((Label)this.getControl("balancev")).setText(this.currencyFormat.format(currentBalance == null ? 0 : currentBalance));
  1216. } catch (Exception var12) {
  1217. this.clearBalanceValue();
  1218. logger.error(var12);
  1219. }
  1220. } else {
  1221. this.clearBalanceValue();
  1222. }
  1223. }
  1224. }
  1225. private static BigDecimal getCurrBalance(DynamicObject bankAcct) {
  1226. DynamicObject[] load = BusinessDataServiceHelper.load("ifm_accountbalance", "amount", (new QFilter("accountbank", "=", bankAcct.getPkValue())).toArray(), "bizdate desc", 1);
  1227. return load.length > 0 ? load[0].getBigDecimal("amount") : BigDecimal.ZERO;
  1228. }
  1229. private void clearBalanceValue() {
  1230. ((Label)this.getControl("balancelb")).setText(ResManager.loadKDString("即时余额:", "PaymentBillEdit_5", "fi-cas-formplugin", new Object[0]));
  1231. LocaleString content = new LocaleString(ResManager.loadKDString("付款账户当前时点余额。付款账户即时余额取值来源有银企互联余额表、出纳/资金结算日记账;系统支持四种取值模式:(1)完全取自余额表;(2)完全取自日记账;(3)优先取余额表,再取日记账;(4)开通银企取余额表,未开通银企取日记账。具体采取何种模式请前往【系统服务云】-【配置工具】-【系统参数】-【资金云】-【资金公共服务】中查看。", "PaymentBillEdit_6", "fi-cas-formplugin", new Object[0]));
  1232. ((Label)this.getControl("balancelb")).addTips(new Tips("text", (LocaleString)null, content, false, (List)null));
  1233. DynamicObject currency = this.getDynamicObject("currency");
  1234. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  1235. if (isDiffCur) {
  1236. currency = this.getDynamicObject("dpcurrency");
  1237. }
  1238. if (!CasHelper.isEmpty(currency)) {
  1239. this.labCurrencySign = currency.getString("sign");
  1240. this.currencyAmtprecision = currency.getInt("amtprecision");
  1241. this.initFormat();
  1242. ((Label)this.getControl("balancev")).setText(this.currencyFormat.format(BigDecimal.ZERO));
  1243. } else {
  1244. ((Label)this.getControl("balancev")).setText("¥0.00");
  1245. }
  1246. }
  1247. public void click(EventObject evt) {
  1248. super.click(evt);
  1249. this.getView().setEnable(true, 0, new String[]{"e_payableamt", "e_discountamt", "contractnumber", "e_corebillno", "e_corebillentryseq"});
  1250. Control c = (Control)evt.getSource();
  1251. switch (c.getKey().toLowerCase()) {
  1252. case "changepayer":
  1253. this.changePayerPage();
  1254. break;
  1255. case "addpayeelb1":
  1256. this.addPayee();
  1257. break;
  1258. case "addpayeelb2":
  1259. this.addPayee();
  1260. break;
  1261. case "changepayee":
  1262. this.changePayeePage();
  1263. break;
  1264. case "settletnumber":
  1265. this.settleNumberClick();
  1266. break;
  1267. case "applyname":
  1268. BasedataEdit applyF7 = (BasedataEdit)this.getControl("applyid");
  1269. applyF7.click();
  1270. }
  1271. }
  1272. private void settleNumberClick() {
  1273. DynamicObject settleType = (DynamicObject)this.getModel().getValue("settletype");
  1274. if (EmptyUtil.isNoEmpty(settleType) && SettleMentTypeEnum.CREDIT.getValue().equals(settleType.getString("settlementtype"))) {
  1275. String appId = AppMetadataCache.getAppInfo("lc").getId();
  1276. DynamicObject org = (DynamicObject)this.getModel().getValue("org");
  1277. AppParam param = new AppParam();
  1278. param.setAppId(appId);
  1279. param.setOrgId(org.getLong("id"));
  1280. param.setViewType("08");
  1281. String paymethod = (String)SystemParamServiceHelper.loadAppParameterFromCache(param, "paymethod");
  1282. if ("0".equals(paymethod)) {
  1283. CloseCallBack closeCallBack = new CloseCallBack(this, "settletnumber");
  1284. QFilter qFilterSour = new QFilter("arrivalstatus", "=", "arrival_confirm");
  1285. qFilterSour.and("arrivalway", "!=", "protest");
  1286. qFilterSour.and(QFilter.sqlExpress("arrivalamount", ">", "flockamount"));
  1287. qFilterSour.and("isinit", "=", '0');
  1288. qFilterSour.and("eassrcid", "=", "");
  1289. CasBotpHelper.doBeforeDraw(this.getView(), "lc_arrival", this.getModel().getDataEntityType().getName(), false, qFilterSour, closeCallBack);
  1290. }
  1291. }
  1292. }
  1293. private void changePayeePage() {
  1294. this.opreatePayee(Boolean.FALSE);
  1295. }
  1296. private void addPayee() {
  1297. this.opreatePayee(Boolean.TRUE);
  1298. }
  1299. private void opreatePayee(Boolean isAddNew) {
  1300. Map<String, Object> paramMap = new HashMap();
  1301. if (this.isHwControl()) {
  1302. paramMap.put("hw_payeesiteid", this.getValue("hw_payeesiteid"));
  1303. }
  1304. paramMap.put("org", this.getPk("org"));
  1305. paramMap.put("asstActType", this.getString("payeetype"));
  1306. paramMap.put("isBE", this.isBePay());
  1307. paramMap.put("billtype", Optional.ofNullable(this.getDynamicObject("billtype")).map(DataEntityBase::getPkValue).orElse((Object)null));
  1308. FormShowParameter parameter = new FormShowParameter();
  1309. parameter.getOpenStyle().setShowType(ShowType.Modal);
  1310. parameter.setFormId("cas_addpayee");
  1311. parameter.setStatus(isAddNew ? OperationStatus.ADDNEW : OperationStatus.EDIT);
  1312. parameter.getCustomParams().putAll(paramMap);
  1313. parameter.setCloseCallBack(new CloseCallBack(this, "addpayee"));
  1314. this.getView().showForm(parameter);
  1315. }
  1316. private void addPayeeValue(Map<String, Object> resultMap) {
  1317. this.setValue("payeeformid", resultMap.get("payeeformid"));
  1318. this.setValue("payee", resultMap.get("payee"));
  1319. this.setValue("payeename", resultMap.get("payeename"));
  1320. if (this.isHwControl()) {
  1321. this.setValue("hw_payeesiteid", resultMap.get("hw_payeesiteid"));
  1322. this.setValue("scorg", resultMap.get("scorg"));
  1323. }
  1324. this.setValue("payeenumber", resultMap.get("payeenumber"));
  1325. this.setValue("payeeaccformid", resultMap.get("payeeaccformid"));
  1326. this.setValue("payeeacctbank", resultMap.get("payeeacctbank"));
  1327. this.setValue("payeeacctcash", resultMap.get("payeeacctcash"));
  1328. this.setValue("payeebanknum", resultMap.get("payeebanknum"));
  1329. this.setValue("payeebank", resultMap.get("payeebank"));
  1330. this.setValue("payeebankname", resultMap.get("payeebankname"));
  1331. this.setValue("recaccbankname", resultMap.get("recaccbankname"));
  1332. String beBankNumber = (String)resultMap.get("recbanknumber");
  1333. this.setValue("recbanknumber", beBankNumber);
  1334. this.setValue("reccountry", resultMap.get("reccountry"));
  1335. this.setValue("recprovince", resultMap.get("recprovince"));
  1336. this.setValue("reccity", resultMap.get("reccity"));
  1337. this.setValue("recswiftcode", resultMap.get("swift_code"));
  1338. this.setValue("recroutingnum", resultMap.get("routingnum"));
  1339. this.setValue("recothercode", resultMap.get("other_code"));
  1340. this.setValue("recbankaddress", resultMap.get("address_eng"));
  1341. this.setValue("recemail", resultMap.get("payeeemail"));
  1342. this.setValue("payeecurrency", resultMap.get("payeecurrency"));
  1343. this.setValue("recaddress", resultMap.get("payeeaddress"));
  1344. this.setValue("supplierBankId", resultMap.get("supplierBankId"));
  1345. PaymentBillPluginHelper.fillProxyBeBankInfo(this.getModel(), this.getView(), true);
  1346. Boolean isDiffCur = (Boolean)this.getValue("isdiffcur");
  1347. Object recCurId = resultMap.get("payeecurrency");
  1348. if (recCurId != null && ((Long)recCurId).intValue() != 0 && !this.isBotpCreate() && isDiffCur) {
  1349. this.setValue("currency", resultMap.get("payeecurrency"));
  1350. }
  1351. if (AsstActTypeEnum.SUPPLIER.getValue().equals(this.getModel().getValue("payeetype"))) {
  1352. DynamicObject new_settletype = (DynamicObject)resultMap.get("settlment");
  1353. DynamicObject old_settletype = (DynamicObject)this.getModel().getValue("settletype");
  1354. if (!CasHelper.isEquals(new_settletype, old_settletype) && new_settletype != null) {
  1355. this.setValue("settletype", new_settletype);
  1356. }
  1357. }
  1358. this.setPayeeInfo4Lb();
  1359. this.getView().setVisible(false, new String[]{"flex_addpayee"});
  1360. this.getView().setVisible(true, new String[]{"flex_payeeinfo"});
  1361. }
  1362. private void changePayeeValue() {
  1363. this.setPayeeInfo4Lb();
  1364. boolean addpayView = this.hasPayeeInfo();
  1365. this.getView().setVisible(!addpayView, new String[]{"flex_addpayee"});
  1366. this.getView().setVisible(addpayView, new String[]{"flex_payeeinfo"});
  1367. }
  1368. private void setPayeeInfo4Lb() {
  1369. String payeeformid = this.getString("payeetype");
  1370. List<String> payeetypeList = Arrays.asList("bos_org", "bd_supplier", "bd_customer", "bos_user");
  1371. Long payeeId = Long.parseLong(this.getValue("payee") == null ? "0" : this.getValue("payee").toString());
  1372. String payeeType = this.getString("payeetype");
  1373. if (isOther(payeeType)) {
  1374. this.setValue("payeenamev", this.getValue("payeename"));
  1375. } else if (CasHelper.isNotEmpty(payeeformid) && payeetypeList.contains(payeeformid) && CasHelper.isNotEmpty(payeeId)) {
  1376. DynamicObject payeeObj = BusinessDataServiceHelper.loadSingleFromCache(payeeId, payeeformid, "name");
  1377. this.setValue("payeenamev", CasHelper.getLocalValue(payeeObj, "name"));
  1378. }
  1379. Image payeePic = (Image)this.getControl("payeepic");
  1380. String defaultUrl = BaseDataHelper.getPictureUrl(payeeId, payeeformid);
  1381. defaultUrl = defaultUrl == null ? "/icons/pc/entrance/cn_sk_80_80.png" : defaultUrl;
  1382. payeePic.setUrl(defaultUrl);
  1383. ((Label)this.getControl("payeebanknumv")).setText(StringUtils.splitString(this.getString("payeebanknum"), 4, " "));
  1384. ((Label)this.getControl("payeebanknamev")).setText(this.getString("payeebankname"));
  1385. ((Label)this.getControl("recaccbanknamev")).setText(this.getString("recaccbankname"));
  1386. ((Label)this.getControl("recbanknumberv")).setText(this.getString("recbanknumber"));
  1387. }
  1388. private void changePayerPage() {
  1389. DynamicObject settleType = this.getDynamicObject("settletype");
  1390. Object sourceBillType = this.getModel().getValue("sourcebilltype");
  1391. Map<String, Object> payerInfo = new HashMap();
  1392. payerInfo.put("cash", BaseDataHelper.isSettleTypeCash(settleType));
  1393. payerInfo.put("virtual", BaseDataHelper.isSettleTypeVirtual(settleType));
  1394. payerInfo.put("sourceBillType", sourceBillType);
  1395. FormShowParameter parameter = new FormShowParameter();
  1396. parameter.getOpenStyle().setShowType(ShowType.Modal);
  1397. parameter.setFormId("cas_changepayer");
  1398. parameter.getCustomParams().putAll(payerInfo);
  1399. parameter.setCloseCallBack(new CloseCallBack(this, "changepayer"));
  1400. this.getView().showForm(parameter);
  1401. }
  1402. private void changePayerValue(Map<String, Object> returnMap) {
  1403. boolean isChangeCur = false;
  1404. IBillModel model = (IBillModel)this.getModel();
  1405. DynamicObject new_org = (DynamicObject)returnMap.get("org");
  1406. DynamicObject old_org = (DynamicObject)model.getValue("org");
  1407. DynamicObject cur = OrgHelper.getBaseCurrency((Long)new_org.getPkValue());
  1408. if (!CasHelper.isEquals(new_org, old_org)) {
  1409. this.setValue("org", new_org);
  1410. this.setValue("basecurrency", cur);
  1411. this.setValue("draftbill", (Object)null);
  1412. isChangeCur = true;
  1413. }
  1414. DynamicObject new_acctcash = (DynamicObject)returnMap.get("payeracctcash");
  1415. DynamicObject old_acctcash = (DynamicObject)model.getValue("payeracctcash");
  1416. if (!CasHelper.isEquals(new_acctcash, old_acctcash)) {
  1417. this.setValue("payeracctcash", new_acctcash);
  1418. isChangeCur = false;
  1419. }
  1420. DynamicObject new_acctbank = (DynamicObject)returnMap.get("payeracctbank");
  1421. DynamicObject old_acctbank = (DynamicObject)model.getValue("payeracctbank");
  1422. if (!CasHelper.isEquals(new_acctbank, old_acctbank)) {
  1423. this.setValue("payeracctbank", new_acctbank);
  1424. isChangeCur = false;
  1425. }
  1426. DynamicObject new_bank = (DynamicObject)returnMap.get("payerbank");
  1427. DynamicObject old_bank = (DynamicObject)model.getValue("payerbank");
  1428. if (!CasHelper.isEquals(new_bank, old_bank)) {
  1429. this.setValue("payerbank", new_bank);
  1430. }
  1431. this.setPayerInfo4Lb();
  1432. this.settleOrg(true);
  1433. if (isChangeCur) {
  1434. this.setValue("currency", cur);
  1435. }
  1436. String uniformsocialcreditcode = new_org.getString("uniformsocialcreditcode");
  1437. if (kd.bos.dataentity.utils.StringUtils.isNotBlank(uniformsocialcreditcode)) {
  1438. this.setValue("uniformsocialcreditcode", uniformsocialcreditcode);
  1439. }
  1440. String payerNumber = new_org.getString("number");
  1441. if (kd.bos.dataentity.utils.StringUtils.isNotBlank(payerNumber)) {
  1442. this.setValue("payernumber", payerNumber);
  1443. }
  1444. this.setValue("openorg", returnMap.get("openorg"));
  1445. }
  1446. public void closedCallBack(ClosedCallBackEvent e) {
  1447. super.closedCallBack(e);
  1448. Map data;
  1449. if ("changepayer".equals(e.getActionId())) {
  1450. data = (Map)e.getReturnData();
  1451. if (data != null) {
  1452. this.changePayerValue(data);
  1453. }
  1454. } else if ("addpayee".equals(e.getActionId())) {
  1455. data = (Map)e.getReturnData();
  1456. if (data != null) {
  1457. this.addPayeeValue(data);
  1458. this.setCrossPayValue();
  1459. }
  1460. } else {
  1461. String confirm;
  1462. if ("beforesubmit".equals(e.getActionId())) {
  1463. confirm = (String)e.getReturnData();
  1464. if (confirm != null && confirm.equals("ok")) {
  1465. this.getView().invokeOperation("submit");
  1466. }
  1467. } else if ("beforesubmitnew".equals(e.getActionId())) {
  1468. confirm = (String)e.getReturnData();
  1469. if (confirm != null && confirm.equals("ok")) {
  1470. this.getView().invokeOperation("submitandnew");
  1471. }
  1472. } else {
  1473. OperateOption option;
  1474. if (kd.bos.dataentity.utils.StringUtils.equals(e.getActionId(), "KEY_DIFFPAY_CALLBACK")) {
  1475. data = (Map)e.getReturnData();
  1476. if (data != null) {
  1477. option = OperateOption.create();
  1478. Iterator var4 = data.entrySet().iterator();
  1479. while(var4.hasNext()) {
  1480. Map.Entry<String, Object> entry = (Map.Entry)var4.next();
  1481. if (entry.getValue() != null) {
  1482. option.setVariableValue((String)entry.getKey(), entry.getValue().toString());
  1483. }
  1484. }
  1485. option.setVariableValue("payConfirm", "1");
  1486. this.getView().invokeOperation("pay", option);
  1487. }
  1488. } else if (kd.bos.dataentity.utils.StringUtils.equals(e.getActionId(), "CALLBACK_SELECTDRAFT")) {
  1489. Object draftIdList = e.getReturnData();
  1490. if (draftIdList != null) {
  1491. option = OperateOption.create();
  1492. option.setVariableValue("draftids", JSON.toJSONString(draftIdList));
  1493. this.getView().invokeOperation("pay", option);
  1494. }
  1495. } else if (kd.bos.dataentity.utils.StringUtils.equals(e.getActionId(), "settletnumber")) {
  1496. ListSelectedRowCollection rows = (ListSelectedRowCollection)e.getReturnData();
  1497. if (EmptyUtil.isNoEmpty(rows)) {
  1498. this.getModel().deleteEntryData("entry");
  1499. CasBotpHelper.doDraw(this.getView(), "lc_arrival", this.getModel().getDataEntityType().getName(), rows);
  1500. }
  1501. }
  1502. }
  1503. }
  1504. PaymentBillPluginHelper.isSchePayEditable(this, this.getModel());
  1505. DynamicObject org = this.getDynamicObject("org");
  1506. InitCheckPluginHelper.checkInitForPlugin(this.getView(), org, new String[]{"bar_save", "bar_submit"});
  1507. }
  1508. public void beforeItemClick(BeforeItemClickEvent evt) {
  1509. String opKey = evt.getOperationKey();
  1510. if ("delete".equals(opKey)) {
  1511. if ("cas_recbill".equals(this.getString("sourcebilltype"))) {
  1512. evt.setCancel(true);
  1513. String billno = this.getString("billno");
  1514. this.getView().showConfirm(String.format(ResManager.loadKDString("%s付款单由内部收付协同业务自动生成,是否确认删除?", "PaymentBillEdit_23", "fi-cas-formplugin", new Object[0]), billno), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_DEL_CALLBACK", this));
  1515. }
  1516. } else if ("pay".equals(opKey)) {
  1517. DynamicObject dataEntity = this.getModel().getDataEntity();
  1518. long orgDynId = dataEntity.getDynamicObject("org").getLong("id");
  1519. boolean selectDraftFlag = SystemParameterHelper.getParameterBoolean(orgDynId, "cs122");
  1520. String settleTypeKey = DraftHelper.getKey(dataEntity.get("settletype"));
  1521. logger.info("selectDraftFlag is:" + selectDraftFlag + ",key:" + settleTypeKey);
  1522. boolean isdraft = SystemParameterHelper.getCdmParameterBoolean(orgDynId, "isdraft");
  1523. boolean ischeck = SystemParameterHelper.getCdmParameterBoolean(orgDynId, "ischeck");
  1524. boolean ispromissorynote = SystemParameterHelper.getCdmParameterBoolean(orgDynId, "ispromissorynote");
  1525. if (!CasHelper.isEmpty(settleTypeKey)) {
  1526. String typeName;
  1527. switch (settleTypeKey) {
  1528. case "isdraft":
  1529. if (isdraft && !selectDraftFlag) {
  1530. typeName = ResManager.loadKDString("汇票", "DraftHelper_4", "fi-cas-common", new Object[0]);
  1531. this.cancelAndWarn(evt, dataEntity, typeName);
  1532. }
  1533. break;
  1534. case "ischeck":
  1535. if (ischeck && !selectDraftFlag) {
  1536. typeName = ResManager.loadKDString("支票", "DraftHelper_5", "fi-cas-common", new Object[0]);
  1537. this.cancelAndWarn(evt, dataEntity, typeName);
  1538. }
  1539. break;
  1540. case "ispromissorynote":
  1541. if (ispromissorynote && !selectDraftFlag) {
  1542. typeName = ResManager.loadKDString("本票", "DraftHelper_6", "fi-cas-common", new Object[0]);
  1543. this.cancelAndWarn(evt, dataEntity, typeName);
  1544. }
  1545. }
  1546. }
  1547. }
  1548. if ("commitbe".equals(opKey)) {
  1549. OperateOption op = OperateOption.create();
  1550. op.setVariableValue("ishasright", "true");
  1551. OperationResult operationResult = OperationServiceHelper.executeOperate("beforecommitbe", "nckd_cas_arbill", new Object[]{this.getModel().getDataEntity().getPkValue()}, op);
  1552. if (!operationResult.isSuccess() && operationResult.isNeedSign()) {
  1553. SignOperateCallback signOperate = new SignOperateCallback(this.getView(), this, op, ClientCallback.SignClientType.Secondry, "signbeforecommitbe");
  1554. OperationResult ops = signOperate.sign(operationResult);
  1555. evt.setCancel(true);
  1556. if (!ops.isSuccess()) {
  1557. logger.info(" beforecommitbe sign error ");
  1558. if (ops.isShowMessage() && EmptyUtil.isNoEmpty(ops.getMessage())) {
  1559. this.getView().showTipNotification(ops.getMessage());
  1560. }
  1561. }
  1562. }
  1563. }
  1564. }
  1565. private void cancelAndWarn(BeforeItemClickEvent evt, DynamicObject dataEntity, String typeName) {
  1566. String msg = String.format(ResManager.loadKDString("%1$s :结算方式类别为%2$s的付款单不支持确认付款", "DraftHelper_7_1", "fi-cas-common", new Object[0]), dataEntity.getString("billno"), typeName);
  1567. evt.setCancel(true);
  1568. this.getView().showTipNotification(msg);
  1569. }
  1570. public void itemClick(ItemClickEvent evt) {
  1571. super.itemClick(evt);
  1572. String key = evt.getItemKey().toLowerCase();
  1573. if ("bar_beforesubmit".equals(key)) {
  1574. this.getView().invokeOperation("beforesubmit");
  1575. } else if ("bar_cancelpay".equals(key)) {
  1576. this.cancelPay();
  1577. } else if ("viewsettle".equals(key)) {
  1578. this.viewSettle();
  1579. } else if ("bar_save".equals(key)) {
  1580. this.getView().updateView("feeactbank");
  1581. this.getView().updateView("feecurrency");
  1582. }
  1583. }
  1584. public void afterDeleteRow(AfterDeleteRowEventArgs e) {
  1585. super.afterDeleteRow(e);
  1586. this.calculateAmt();
  1587. }
  1588. public void afterBindData(EventObject e) {
  1589. super.afterBindData(e);
  1590. DynamicObject org = this.getDynamicObject("org");
  1591. InitCheckPluginHelper.checkInitForPlugin(this.getView(), org, new String[]{"bar_save", "bar_submit"});
  1592. DynamicObject paymentBill = this.getModel().getDataEntity();
  1593. Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
  1594. Object showConer = customParams.get("showConer");
  1595. List<IApprovalRecordGroup> workflowlist = WorkflowServiceHelper.getAllApprovalRecord(paymentBill.getPkValue().toString());
  1596. if (CollectionUtils.isEmpty(workflowlist) || CasHelper.isEmpty(showConer)) {
  1597. SplitContainer control = (SplitContainer)this.getControl("splitcontainerap");
  1598. control.hidePanel(SplitDirection.right, true);
  1599. control.setCollapse("splitpanelap1", true);
  1600. }
  1601. Long orgId = this.getPk("org");
  1602. DynamicObject cur;
  1603. DynamicObject payeracctbank;
  1604. if (this.isBotpNew()) {
  1605. if (orgId == null) {
  1606. this.getView().setEnable(false, new String[]{"bar_save", "bar_submit", "bar_beforesubmit"});
  1607. this.getView().showErrorNotification(ResManager.loadKDString("请在上游单据维护付款组织来源再推付款单。", "PaymentBillEdit_7", "fi-cas-formplugin", new Object[0]));
  1608. return;
  1609. }
  1610. cur = OrgHelper.getBaseCurrency(orgId);
  1611. if (cur == null) {
  1612. this.getView().setEnable(false, new String[]{"bar_save", "bar_submit", "bar_beforesubmit"});
  1613. this.getView().setVisible(false, new String[]{"bar_refund_save", "bar_submitandnew", "bar_del", "bar_audit", "bar_unaudit", "bar_pay", "bar_cancelpay", "bar_commitbe", "genvoucher", "deletevoucher", "copyentryrow"});
  1614. this.getView().getFormShowParameter().setStatus(OperationStatus.VIEW);
  1615. this.getView().showErrorNotification(SystemStatusCtrolHelper.notFinishInitSetMsg(CasHelper.getLocalValue(this.getDynamicObject("org"), "name")));
  1616. return;
  1617. }
  1618. this.setValueIfAbsent("basecurrency", cur);
  1619. payeracctbank = this.getDynamicObject("payeracctbank");
  1620. if (payeracctbank != null) {
  1621. this.setValueIfAbsent("payerbank", payeracctbank.getDynamicObject("bank"));
  1622. this.setValueIfAbsent("openorg", payeracctbank.getDynamicObject("openorg"));
  1623. }
  1624. this.setNetBankAcctVisible();
  1625. DynamicObject paymentType = paymentBill.getDynamicObject("paymenttype");
  1626. if (paymentType != null) {
  1627. paymentType = BusinessDataServiceHelper.loadSingleFromCache(paymentType.getPkValue(), "cas_paymentbilltype", "id,fundflowitem");
  1628. this.fillFundflowItem(false, paymentType.getDynamicObject("fundflowitem"));
  1629. }
  1630. }
  1631. if (null == this.getDynamicObject("exratetable")) {
  1632. this.setDefaultExratetable(orgId);
  1633. }
  1634. PaymentBillPluginHelper.fillToolBar(this, this.getModel(), this.getView());
  1635. this.setPayerInfo4Lb();
  1636. this.changePayeeValue();
  1637. this.setEntryAmountCaption();
  1638. this.ctrChangeLableVisible();
  1639. this.setCurrencyEditable();
  1640. this.ctrBeInfoVisibility();
  1641. this.setExchangerateEditable();
  1642. this.ctrRefundInfoVisibility();
  1643. cur = this.getDynamicObject("payeracctbank");
  1644. this.setPaymentChannelValue(cur, Boolean.FALSE);
  1645. this.setDiffCurInfo();
  1646. this.setCountryValue();
  1647. this.setCrossPayValue();
  1648. this.isDiffCurVisibility();
  1649. this.isOnlinebankVisibility();
  1650. this.setPayerAndPayeeInfo(orgId);
  1651. this.getModel().setDataChanged(false);
  1652. payeracctbank = (DynamicObject)this.getModel().getValue("settletype");
  1653. if (Objects.nonNull(payeracctbank)) {
  1654. this.settletNumber(payeracctbank);
  1655. } else {
  1656. this.getView().setVisible(Boolean.FALSE, new String[]{"draftbill"});
  1657. }
  1658. this.showBalance();
  1659. }
  1660. private void setPayerAndPayeeInfo(Long orgId) {
  1661. if (!CasHelper.isEmpty(orgId)) {
  1662. DynamicObject org = BusinessDataServiceHelper.loadSingleFromCache(orgId, "bos_org");
  1663. this.getModel().setValue("payernumber", org.getString("number"));
  1664. this.getModel().setValue("uniformsocialcreditcode", org.getString("uniformsocialcreditcode"));
  1665. Long payeeId = Long.valueOf(this.getModel().getValue("payee").toString());
  1666. String type = this.getModel().getValue("payeetype").toString();
  1667. String number = this.getModel().getValue("payeenumber").toString();
  1668. if (!number.isEmpty() || !AsstActTypeEnum.SUPPLIER.getValue().equals(type) && !AsstActTypeEnum.CUSTOMER.getValue().equals(type)) {
  1669. if (number.isEmpty() && (AsstActTypeEnum.EMPLOYEE.getValue().equals(type) || AsstActTypeEnum.COMPANY.getValue().equals(type))) {
  1670. number = this.getUserOrOrgNumber(payeeId, type);
  1671. }
  1672. } else {
  1673. number = this.getPayeeOrPayerInfoNumber(payeeId, type, this.getModel().getDataEntityType().getName());
  1674. }
  1675. this.getModel().setValue("payeenumber", number);
  1676. if (!this.getModel().getDataEntity().getString("billstatus").equals(BillStatusEnum.SAVE.getValue())) {
  1677. this.getView().setEnable(false, new String[]{"priority"});
  1678. }
  1679. }
  1680. }
  1681. protected void setExchangerateEditable() {
  1682. DynamicObject srcCurrency = this.getDynamicObject("currency");
  1683. DynamicObject destCurrency = this.getDynamicObject("basecurrency");
  1684. if (srcCurrency != null && destCurrency != null) {
  1685. if (srcCurrency.getLong("id") == destCurrency.getLong("id")) {
  1686. this.getView().setEnable(false, new String[]{"exchangerate"});
  1687. }
  1688. }
  1689. }
  1690. private void setDefaultExratetable(Long orgId) {
  1691. Long exchangeRateTableId = 0L;
  1692. try {
  1693. exchangeRateTableId = SystemStatusCtrolHelper.getExrateTable(orgId).getLong("id");
  1694. } catch (Exception var4) {
  1695. }
  1696. this.getModel().setValue("exratetable", exchangeRateTableId);
  1697. }
  1698. private void setEntryAmountCaption() {
  1699. DynamicObject billType = (DynamicObject)this.getModel().getValue("billtype");
  1700. if (billType != null) {
  1701. EntryGrid entryCtr = (EntryGrid)this.getControl("entry");
  1702. if (BillTypeConstants.PAYBILL_OTR.equals(billType.getPkValue())) {
  1703. entryCtr.setColumnProperty("e_payableamt", "header", new LocaleString(ResManager.loadKDString("实付金额", "PaymentBillEdit_8", "fi-cas-formplugin", new Object[0])));
  1704. entryCtr.setColumnProperty("e_payablelocamt", "header", new LocaleString(ResManager.loadKDString("实付折本币", "PaymentBillEdit_9", "fi-cas-formplugin", new Object[0])));
  1705. } else {
  1706. entryCtr.setColumnProperty("e_payableamt", "header", new LocaleString(ResManager.loadKDString("应付金额", "PaymentBillEdit_10", "fi-cas-formplugin", new Object[0])));
  1707. entryCtr.setColumnProperty("e_payablelocamt", "header", new LocaleString(ResManager.loadKDString("应付折本币", "PaymentBillEdit_11", "fi-cas-formplugin", new Object[0])));
  1708. }
  1709. }
  1710. }
  1711. private void ctrChangeLableVisible() {
  1712. Object sourceBillType = this.getModel().getValue("sourcebilltype");
  1713. if (!"cas_recbill".equals(sourceBillType) && !"bei_transdetail_cas".equals(sourceBillType) && BillStatusEnum.SAVE.getValue().equals(this.getModel().getValue("billstatus"))) {
  1714. if (!(Boolean)this.getModel().getValue("issupplecontract")) {
  1715. this.getView().setVisible(true, new String[]{"changepayer", "changepayee"});
  1716. }
  1717. } else {
  1718. this.getView().setVisible(false, new String[]{"changepayer", "changepayee"});
  1719. }
  1720. }
  1721. private boolean isBePay() {
  1722. DynamicObject payerAcctBank = this.getDynamicObject("payeracctbank");
  1723. if (payerAcctBank != null && PayBillCrossHelper.isIfmBankAcc(payerAcctBank)) {
  1724. return true;
  1725. } else {
  1726. return payerAcctBank != null && (Boolean)payerAcctBank.get("issetbankinterface") && "bei".equalsIgnoreCase(this.getString("paymentchannel"));
  1727. }
  1728. }
  1729. private boolean isBeiBePay() {
  1730. DynamicObject payerAcctBank = this.getDynamicObject("payeracctbank");
  1731. return payerAcctBank != null && (Boolean)payerAcctBank.get("issetbankinterface") && "bei".equalsIgnoreCase(this.getString("paymentchannel"));
  1732. }
  1733. public void beforeDoOperation(BeforeDoOperationEventArgs args) {
  1734. super.beforeDoOperation(args);
  1735. AbstractOperate op = (AbstractOperate)args.getSource();
  1736. String operateKey = op.getOperateKey();
  1737. DynamicObject payerAcctBank = this.getDynamicObject("payeracctbank");
  1738. DynamicObject accountBank;
  1739. if ("trackdown".equals(operateKey)) {
  1740. accountBank = this.getDynamicObject("settletype");
  1741. if (accountBank != null) {
  1742. String settlementtype = accountBank.getString("settlementtype");
  1743. if (EmptyUtil.isNoEmpty(settlementtype) && this.settleTypes.contains(settlementtype)) {
  1744. op.getOption().setVariableValue("botp_track_edit_status", "true");
  1745. }
  1746. }
  1747. } else if ((!"save".equals(operateKey) || (Boolean)this.getModel().getValue("issupplecontract")) && !"submit".equals(operateKey) && !"submitandnew".equals(operateKey) && !"beforesubmit".equals(operateKey) && !"beforesubmitnew".equals(operateKey)) {
  1748. DynamicObject orgData;
  1749. if ("refundsave".equals(operateKey)) {
  1750. Long rebillid = (Long)this.getView().getFormShowParameter().getCustomParam("rebillid");
  1751. orgData = BusinessDataServiceHelper.loadSingle(rebillid, "cas_recbill");
  1752. BigDecimal actrecamt = orgData.getBigDecimal("actrecamt");
  1753. DynamicObjectCollection payEntrys = this.getModel().getEntryEntity("entry");
  1754. BigDecimal refundamtTotal = (BigDecimal)payEntrys.stream().map((o) -> {
  1755. return o.getBigDecimal("e_refundamt");
  1756. }).reduce(BigDecimal.ZERO, BigDecimal::add);
  1757. if (actrecamt.compareTo(refundamtTotal) != 0) {
  1758. throw new KDBizException(ResManager.loadKDString("退款金额合计与收款单金额不相等", "PaymentBillEdit_19", "fi-cas-formplugin", new Object[0]));
  1759. }
  1760. FormOperate operate = (FormOperate)args.getSource();
  1761. operate.getOption().setVariableValue("rebillid", SerializationUtils.toJsonString(this.getView().getFormShowParameter().getCustomParam("rebillid")));
  1762. operate.getOption().setVariableValue("billtype", "nckd_cas_arbill");
  1763. } else if ("recbook".equals(operateKey)) {
  1764. accountBank = this.getDynamicObject("payeracctbank");
  1765. if (null != accountBank && AccountBankHelper.isClosed(accountBank.getLong("id"))) {
  1766. throw new KDBizException(String.format(ResManager.loadKDString("账户%s当前状态为已销户,暂无法进行业务处理。", "PaymentErrorCode_47", "fi-cas-business", new Object[0]), accountBank.getString("number")));
  1767. }
  1768. if (payerAcctBank != null && PayBillCrossHelper.isIfmBankAcc(payerAcctBank)) {
  1769. throw new KDBizException(ResManager.loadKDString("内部账户请选择内部结算付款。", "PaymentErrorCode_48", "fi-cas-business", new Object[0]));
  1770. }
  1771. if (PaymentBillPluginHelper.checkPayeeTypeFreeze(Collections.singletonList(this.getModel().getDataEntity()))) {
  1772. throw new KDBizException((new PaymentErrorCode()).CANOTDOTHISOP_WHENSUPPLIERFREEZE().getMessage());
  1773. }
  1774. } else if ("endorse".equals(operateKey)) {
  1775. if (payerAcctBank != null && PayBillCrossHelper.isIfmBankAcc(payerAcctBank)) {
  1776. throw new KDBizException(ResManager.loadKDString("内部账户请选择内部结算付款。", "PaymentErrorCode_48", "fi-cas-business", new Object[0]));
  1777. }
  1778. if (PaymentBillPluginHelper.checkPayeeTypeFreeze(Collections.singletonList(this.getModel().getDataEntity()))) {
  1779. throw new KDBizException((new PaymentErrorCode()).CANOTDOTHISOP_WHENSUPPLIERFREEZE().getMessage());
  1780. }
  1781. } else if ("pay".equals(operateKey)) {
  1782. String draftIds = op.getOption().getVariableValue("draftids", "");
  1783. if (kd.bos.dataentity.utils.StringUtils.isEmpty(draftIds)) {
  1784. orgData = (DynamicObject)this.getValue("org");
  1785. Long pkValue = (Long)orgData.getPkValue();
  1786. boolean selectDraftFlag = SystemParameterHelper.getParameterBoolean(pkValue, "cs122");
  1787. DynamicObject data = this.getModel().getDataEntity(true);
  1788. if (selectDraftFlag && PaymentBillPluginHelper.needSelectedDraft(data)) {
  1789. FormShowParameter showParameter = new FormShowParameter();
  1790. showParameter.setAppId("cas");
  1791. showParameter.setFormId("cas_payment_selectdraft");
  1792. showParameter.setCustomParam("payBillId", data.getPkValue());
  1793. showParameter.getOpenStyle().setShowType(ShowType.Modal);
  1794. showParameter.setCloseCallBack(new CloseCallBack(this, "CALLBACK_SELECTDRAFT"));
  1795. this.getView().showForm(showParameter);
  1796. args.setCancel(true);
  1797. } else if (!DraftHelper.isAllPayDrafBill((DynamicObjectCollection)this.getModel().getValue("draftbill")) && !(Boolean)this.getModel().getValue("feepay")) {
  1798. String payConfirm = op.getOption().getVariableValue("payConfirm", "");
  1799. if (kd.bos.dataentity.utils.StringUtils.isEmpty(payConfirm)) {
  1800. this.pay(args);
  1801. }
  1802. }
  1803. }
  1804. }
  1805. } else if (!this.isBeConfirmOK) {
  1806. this.storeFields();
  1807. }
  1808. if ("submit".equals(operateKey)) {
  1809. FormUtils.deleteEmptyRows(this.getModel(), new String[]{"e_payableamt"});
  1810. }
  1811. if (Arrays.asList("unaudit", "chargeback", "invalid", "delete", "pay").contains(operateKey) && PayBillHepler.getViewSettle(this.getModel().getDataEntity()).size() > 0) {
  1812. this.getView().showErrorNotification(String.format(ResManager.loadKDString("%s已存在结算记录,导致操作失败。如需继续执行操作,请先反结算。", "PaymentBillList_36", "fi-cas-formplugin", new Object[0]), ""));
  1813. args.setCancel(true);
  1814. }
  1815. }
  1816. public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
  1817. super.confirmCallBack(messageBoxClosedEvent);
  1818. String id = messageBoxClosedEvent.getCallBackId();
  1819. MessageBoxResult res = messageBoxClosedEvent.getResult();
  1820. if (id.equals("CONFIRM_CANCELPAY_CALLBACK") && MessageBoxResult.Yes.equals(res)) {
  1821. String billno = (String)this.getModel().getValue("billno");
  1822. DynamicObject payObj = BusinessDataServiceHelper.loadSingle("nckd_cas_arbill", "id,billno", new QFilter[]{new QFilter("billno", "=", billno)});
  1823. if (!this.cancelPayCheckSettle(payObj)) {
  1824. this.getView().invokeOperation("cancelpay");
  1825. }
  1826. }
  1827. if (id.equals("CONFIRM_CANCELPAY_SETTLE_CALLBACK") && MessageBoxResult.Yes.equals(res)) {
  1828. this.getView().invokeOperation("cancelpay");
  1829. }
  1830. if (id.equals("CONFIRM_DEL_CALLBACK")) {
  1831. OperateOption option = OperateOption.create();
  1832. if (MessageBoxResult.Yes.equals(res)) {
  1833. option.setVariableValue("delrecpay", "1");
  1834. this.getView().invokeOperation("delete", option);
  1835. }
  1836. }
  1837. }
  1838. private void storeFields() {
  1839. IBillModel model = (IBillModel)this.getModel();
  1840. String entrance = (String)model.getValue("entrance");
  1841. if (PaymentTypeEnum.OTR.name().equals(entrance)) {
  1842. DynamicObject paymentType = (DynamicObject)model.getValue("paymenttype");
  1843. if (paymentType != null && !paymentType.getBoolean("ispartpayment")) {
  1844. int count = model.getEntryRowCount("entry");
  1845. for(int i = 0; i < count; ++i) {
  1846. this.setValue("e_discountamt", (Object)null, i);
  1847. this.setValue("e_discountlocamt", (Object)null, i);
  1848. this.setValue("e_corebilltype", (Object)null, i);
  1849. this.setValue("e_corebillno", (Object)null, i);
  1850. this.setValue("e_corebillentryseq", (Object)null, i);
  1851. this.setValue("e_lockamt", (Object)null, i);
  1852. this.setValue("e_unlockamt", (Object)null, i);
  1853. this.setValue("e_settledamt", (Object)null, i);
  1854. this.setValue("e_unsettledamt", (Object)null, i);
  1855. }
  1856. }
  1857. } else if (PaymentTypeEnum.SYN.name().equals(entrance) || PaymentTypeEnum.CASH.name().equals(entrance) || PaymentTypeEnum.SPAN.name().equals(entrance)) {
  1858. int count = model.getEntryRowCount("entry");
  1859. if (count < 1) {
  1860. this.getView().updateView("entry");
  1861. this.getView().invokeOperation("newentry");
  1862. }
  1863. this.setValue("e_payableamt", this.getBigDecimal("actpayamt"), 0);
  1864. this.setValue("e_fundflowitem", this.getValue("fundflowitem"), 0);
  1865. }
  1866. }
  1867. public void afterDoOperation(AfterDoOperationEventArgs arg) {
  1868. super.afterDoOperation(arg);
  1869. AbstractOperate op = (AbstractOperate)arg.getSource();
  1870. OperationResult operationResult = arg.getOperationResult();
  1871. String key = op.getOperateKey();
  1872. if ("copyentryrow".equals(key)) {
  1873. EntryGrid entry = (EntryGrid)this.getControl("entry");
  1874. if (entry.getSelectRows().length == 0) {
  1875. this.getView().showTipNotification(ResManager.loadKDString("请选中一行再进行操作", "PaymentBillEdit_12", "fi-cas-formplugin", new Object[0]));
  1876. return;
  1877. }
  1878. this.calculateAmt();
  1879. } else if (!"beforesubmit".equals(key) && !"beforesubmitnew".equals(key)) {
  1880. if ("newentry".equals(key)) {
  1881. this.settleOrg(false);
  1882. } else {
  1883. IFormView view;
  1884. if ("refundsave".equals(key) && arg.getOperationResult().isSuccess()) {
  1885. view = this.getView().getParentView();
  1886. view.close();
  1887. this.getView().sendFormAction(view);
  1888. return;
  1889. }
  1890. if ("delete".equals(key) && arg.getOperationResult().isSuccess()) {
  1891. view = this.getView();
  1892. view.close();
  1893. this.getView().sendFormAction(view);
  1894. } else if (("unsubmit".equals(key) || "unaudit".equals(key)) && arg.getOperationResult().isSuccess()) {
  1895. this.getView().setStatus(OperationStatus.EDIT);
  1896. } else {
  1897. String reason;
  1898. if (!"pay".equals(key) && !"cancelpay".equals(key)) {
  1899. if ("receipt".equals(key) && arg.getOperationResult().isSuccess()) {
  1900. this.viewReceipt();
  1901. } else if ("chargebacknoreason".equals(key)) {
  1902. reason = ResManager.loadKDString("自动退单", "PaymentBillList_37", "fi-cas-formplugin", new Object[0]);
  1903. List<Object> successPkIds = operationResult.getSuccessPkIds();
  1904. Map<String, Object> data = new HashMap(16);
  1905. data.put("billid", successPkIds);
  1906. data.put("reason", reason);
  1907. data.put("operateKey", "chargeback");
  1908. PayBillListPlugnHelper.closeCallBack("CALLBACK_CHARGEBACK", this.getView(), data);
  1909. }
  1910. } else {
  1911. reason = arg.getOperationResult().getMessage();
  1912. if (!arg.getOperationResult().isSuccess() && !(new CasErrorCode()).VOUCHER_NOT_CHECK().getMessage().equals(reason)) {
  1913. this.getModel().setValue("billstatus", "pay".equals(key) ? BillStatusEnum.AUDIT.getValue() : BillStatusEnum.PAY.getValue());
  1914. }
  1915. if ("pay".equals(key) && (Boolean)this.getValue("isdiffcur")) {
  1916. this.getView().updateView("dpamt");
  1917. this.getView().updateView("agreedrate");
  1918. this.getView().updateView("dplocalamt");
  1919. this.getView().updateView("lossamt");
  1920. this.getView().updateView("billstatus");
  1921. this.getView().updateView("exchangerate");
  1922. this.getView().updateView("dpexchangerate");
  1923. this.getView().updateView("localamt");
  1924. this.getView().updateView("paydate");
  1925. this.getView().updateView("feeactbank");
  1926. this.getView().updateView("feecurrency");
  1927. this.getView().updateView("singlestream");
  1928. this.getView().updateView("fee");
  1929. for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
  1930. this.getView().updateView("e_payablelocamt", i);
  1931. this.getView().updateView("e_discountlocamt", i);
  1932. this.getView().updateView("e_localamt", i);
  1933. }
  1934. }
  1935. this.getView().updateView("draftbill");
  1936. if (arg.getOperationResult().isSuccess()) {
  1937. this.getView().invokeOperation("refresh", OperateOption.create());
  1938. }
  1939. }
  1940. }
  1941. }
  1942. } else if ("beforesubmit".equals(key)) {
  1943. IDataModel model = this.getModel();
  1944. if (!CasHelper.isEmpty(model.getValue("entrustorg"))) {
  1945. model.setValue("payeracctbank", (Object)null);
  1946. model.setValue("payerbank", (Object)null);
  1947. ((Label)this.getControl("payerbanknumv")).setText("");
  1948. ((Label)this.getControl("payerbanknamev")).setText("");
  1949. model.setValue("settletype", (Object)null);
  1950. }
  1951. if (arg.getOperationResult().isSuccess()) {
  1952. DynamicObject company = (DynamicObject)model.getValue("org");
  1953. boolean isNotCheckBeBankNumb = SystemParameterHelper.getParameterBoolean(company.getLong("id"), "cs125");
  1954. if (this.isBeiBePay() && CasHelper.isEmpty(this.getString("recbanknumber")) && !isNotCheckBeBankNumb && this.isCrossTranType()) {
  1955. this.getView().showTipNotification(ResManager.loadKDString(String.format("单号%s的付款单支付渠道为银企互联,收款行行号不能为空,请补充。", this.getModel().getValue("billno")), "PaymentBillEdit_29", "fi-cas-formplugin", new Object[0]));
  1956. return;
  1957. }
  1958. List<Object> pks = arg.getOperationResult().getSuccessPkIds();
  1959. if (!EmptyUtil.isEmpty(pks)) {
  1960. this.getView().invokeOperation("submit");
  1961. }
  1962. }
  1963. }
  1964. if (Arrays.asList("save", "submit").contains(key) && arg.getOperationResult().isSuccess()) {
  1965. this.getView().updateView("entrustorg");
  1966. this.getView().updateView("totalpayamt");
  1967. for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
  1968. this.getView().updateView("e_lockAmt", i);
  1969. this.getView().updateView("e_unlockAmt", i);
  1970. }
  1971. }
  1972. if ("unaudit".equals(key)) {
  1973. this.getView().invokeOperation("refresh", OperateOption.create());
  1974. }
  1975. PaymentBillPluginHelper.fillToolBar(this, this.getModel(), this.getView());
  1976. this.ctrChangeLableVisible();
  1977. PaymentBillPluginHelper.isSchePayEditable(this, this.getModel());
  1978. }
  1979. private boolean isCrossTranType() {
  1980. boolean type = (Boolean)this.getValue("iscrosspay");
  1981. DynamicObject dentify = (DynamicObject)this.getValue("paymentidentify");
  1982. return !type || null == dentify || !"0".equals(dentify.getString("type"));
  1983. }
  1984. public void beforeClosed(BeforeClosedEvent e) {
  1985. super.beforeClosed(e);
  1986. try {
  1987. BillShowParameter billShowParameter = (BillShowParameter)this.getView().getFormShowParameter();
  1988. String billStatus = (String)this.getModel().getValue("billstatus");
  1989. if (!BillStatusEnum.SAVE.getValue().equals(billStatus) || billShowParameter.getStatus() == OperationStatus.VIEW) {
  1990. e.setCheckDataChange(false);
  1991. }
  1992. } catch (Exception var4) {
  1993. }
  1994. }
  1995. private void cancelPay() {
  1996. String billno = (String)this.getModel().getValue("billno");
  1997. DynamicObject payObj = BusinessDataServiceHelper.loadSingle("nckd_cas_arbill", "id,billno,isvoucher,billstatus,org", new QFilter[]{new QFilter("billno", "=", billno)});
  1998. String billstatus = payObj.getString("billstatus");
  1999. if (!billstatus.equals("D")) {
  2000. this.getView().invokeOperation("cancelpay");
  2001. } else {
  2002. Object org = this.getModel().getValue("org");
  2003. if (org != null) {
  2004. int CS116 = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs116");
  2005. Boolean isv = payObj.getBoolean("isvoucher");
  2006. if (3 == CS116 && isv) {
  2007. this.getView().showConfirm(String.format(ResManager.loadKDString("(%s)单据已经生成凭证,是否继续取消付款?", "PaymentBillEdit_15", "fi-cas-formplugin", new Object[0]), billno), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_CANCELPAY_CALLBACK", this));
  2008. } else if (!this.cancelPayCheckSettle(payObj)) {
  2009. this.getView().invokeOperation("cancelpay");
  2010. }
  2011. }
  2012. }
  2013. }
  2014. protected String recPayAccount() {
  2015. return "payeracctbank";
  2016. }
  2017. private void settleOrg(boolean isOrg) {
  2018. if (!this.isLockSettleOrg()) {
  2019. DynamicObject paymenttype = (DynamicObject)this.getModel().getValue("paymenttype");
  2020. if (null != paymenttype && paymenttype.getBoolean("ispartpayment")) {
  2021. Object openOrg = this.getModel().getValue("openorg");
  2022. if (openOrg != null) {
  2023. DynamicObject accountOrg = (DynamicObject)openOrg;
  2024. for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
  2025. if (isOrg || CasHelper.isEmpty(this.getModel().getValue("settleorg", i))) {
  2026. this.setValue("settleorg", accountOrg.getPkValue(), i);
  2027. }
  2028. }
  2029. }
  2030. }
  2031. }
  2032. }
  2033. private boolean isHwControl() {
  2034. return this.getPageCache().getAll().containsKey("isHwControl");
  2035. }
  2036. private void setRecInfo(String key, Object value, Boolean isCheckDiff) {
  2037. if (isCheckDiff) {
  2038. Boolean isDiffCur = (Boolean)this.getModel().getValue("isdiffcur");
  2039. if (!isDiffCur) {
  2040. this.getModel().setValue(key, value);
  2041. }
  2042. } else {
  2043. this.getModel().setValue(key, value);
  2044. }
  2045. }
  2046. private void setDiffCurInfo() {
  2047. Boolean isDiffCur = (Boolean)this.getModel().getValue("isdiffcur");
  2048. if (!isDiffCur) {
  2049. this.setValueIfAbsent("dpcurrency", this.getModel().getValue("currency"));
  2050. this.setValueIfAbsent("dpamt", this.getModel().getValue("actpayamt"));
  2051. if (!FeePayerEnum.REC.getValue().equals(this.getString("feepayer"))) {
  2052. this.setValueIfAbsent("feeactbank", this.getModel().getValue("payeracctbank"));
  2053. this.setValueIfAbsent("feecurrency", this.getModel().getValue("currency"));
  2054. }
  2055. }
  2056. }
  2057. private void setExratetableVisibility() {
  2058. Long currencyId = this.getPk("currency");
  2059. Long dpCurrencyId = this.getPk("dpcurrency");
  2060. Long basecurrencyId = this.getPk("basecurrency");
  2061. if ((currencyId == null || currencyId.equals(basecurrencyId)) && (dpCurrencyId == null || dpCurrencyId.equals(basecurrencyId))) {
  2062. this.getView().setVisible(false, new String[]{"exratetable"});
  2063. this.getView().setVisible(false, new String[]{"exratedate"});
  2064. } else {
  2065. this.getView().setVisible(true, new String[]{"exratetable"});
  2066. this.getView().setVisible(true, new String[]{"exratedate"});
  2067. }
  2068. }
  2069. private void setSettleTypeValue(DynamicObject payerAcctBank) {
  2070. if (payerAcctBank != null) {
  2071. DynamicObjectCollection settlementypes = payerAcctBank.getDynamicObjectCollection("settlementtype");
  2072. if (settlementypes != null && settlementypes.size() > 0) {
  2073. Set<Long> idSet = new HashSet();
  2074. Iterator var4 = settlementypes.iterator();
  2075. DynamicObject settletype;
  2076. while(var4.hasNext()) {
  2077. settletype = (DynamicObject)var4.next();
  2078. idSet.add(((DynamicObject)settletype.get("fbasedataid")).getLong("id"));
  2079. }
  2080. DynamicObject settleType = this.getDynamicObject("settletype");
  2081. if (idSet.size() == 1) {
  2082. settletype = BusinessDataServiceHelper.loadSingleFromCache(idSet.iterator().next(), "bd_settlementtype", "id,settlementtype");
  2083. if (!BaseDataHelper.isSettleTypeCash(settletype)) {
  2084. this.setValue("settletype", idSet.iterator().next());
  2085. }
  2086. } else if (settleType != null && !idSet.contains((Long)settleType.getPkValue())) {
  2087. this.setValue("settletype", (Object)null);
  2088. }
  2089. }
  2090. }
  2091. }
  2092. private void setCrossPayValue() {
  2093. this.getView().setEnable(true, new String[]{"iscrosspay"});
  2094. DynamicObject payCountry = this.getDynamicObject("paycountry");
  2095. DynamicObject recCountry = this.getDynamicObject("reccountry");
  2096. if ((payCountry == null || CountryHelper.isChina(payCountry)) && (recCountry == null || CountryHelper.isChina(recCountry))) {
  2097. this.setValue("iscrosspay", Boolean.FALSE);
  2098. } else {
  2099. this.setValue("iscrosspay", Boolean.TRUE);
  2100. }
  2101. }
  2102. private void isDiffCurVisibility() {
  2103. DynamicObject settleType = this.getDynamicObject("settletype");
  2104. if (CasHelper.isNotEmpty(settleType) && BaseDataHelper.isSettleTypeCash(settleType)) {
  2105. this.setValue("isdiffcur", "0");
  2106. this.getView().setVisible(false, new String[]{"isdiffcur"});
  2107. } else {
  2108. this.getView().setVisible(true, new String[]{"isdiffcur"});
  2109. }
  2110. }
  2111. private void setCountryValue() {
  2112. DynamicObject payerBank = this.getDynamicObject("payerbank");
  2113. if (payerBank != null) {
  2114. this.setValueIfAbsent("paycountry", payerBank.getDynamicObject("country"));
  2115. this.setCrossPayValue();
  2116. }
  2117. }
  2118. private void pay(BeforeDoOperationEventArgs evt) {
  2119. long orgId = (Long)this.getDynamicObject("org").getPkValue();
  2120. Set<String> cs1046 = SystemParameterHelper.getParameterComboxs(orgId, "cs1046");
  2121. DynamicObject payBill = this.getModel().getDataEntity();
  2122. (new PaymentPayImpl()).validate(payBill);
  2123. if (PaymentBillPluginHelper.isShowPayConfirm(payBill, cs1046)) {
  2124. FormShowParameter para = new FormShowParameter();
  2125. para.setFormId("cas_paybill_diffpay");
  2126. para.setCloseCallBack(new CloseCallBack(this, "KEY_DIFFPAY_CALLBACK"));
  2127. para.getOpenStyle().setShowType(ShowType.Modal);
  2128. DataEntityPropertyCollection properties = EntityMetadataCache.getDataEntityType("cas_paybill_diffpay").getProperties();
  2129. Map<String, Object> customParams = new HashMap(properties.size());
  2130. Iterator var9 = properties.iterator();
  2131. while(var9.hasNext()) {
  2132. IDataEntityProperty property = (IDataEntityProperty)var9.next();
  2133. String propName = property.getName();
  2134. if (this.getModel().getProperty(propName) != null) {
  2135. Object value = this.getValue(propName);
  2136. if (value instanceof DynamicObject) {
  2137. customParams.put(propName, ((DynamicObject)value).getPkValue());
  2138. } else {
  2139. customParams.put(propName, value);
  2140. }
  2141. }
  2142. }
  2143. para.setCustomParams(customParams);
  2144. para.setCustomParam("payamount", payBill.getBigDecimal("actpayamt"));
  2145. para.setCustomParam("payamt", payBill.getBigDecimal("dpamt"));
  2146. para.setCustomParam("matchFlag", payBill.getString("matchflag"));
  2147. para.setCustomParam("sourcebilltype", payBill.getString("sourcebilltype"));
  2148. para.setCustomParam("payBillId", payBill.getString("id"));
  2149. this.getView().showForm(para);
  2150. evt.setCancel(true);
  2151. }
  2152. }
  2153. private void setPaymentType(QFilter[] qFilters) {
  2154. DynamicObject paymentType = BusinessDataServiceHelper.loadSingleFromCache("cas_paymentbilltype", "id,fundflowitem", qFilters);
  2155. if (paymentType != null) {
  2156. this.setValue("paymenttype", paymentType.getLong("id"));
  2157. DynamicObject fundflowitem = paymentType.getDynamicObject("fundflowitem");
  2158. this.fillFundflowItem(true, fundflowitem);
  2159. } else {
  2160. this.setValue("paymenttype", (Object)null);
  2161. }
  2162. }
  2163. private void viewReceipt() {
  2164. Long billId = (Long)this.getModel().getDataEntity().getPkValue();
  2165. if (billId == 0L) {
  2166. this.getView().showTipNotification(ResManager.loadKDString("暂无对应的电子回单记录!", "ViewReceiptService_0", "fi-cas-business", new Object[0]));
  2167. } else {
  2168. ViewReceiptService viewService = new ViewReceiptService();
  2169. viewService.viewReceipt(this.getView(), "nckd_cas_arbill", billId);
  2170. }
  2171. }
  2172. private void viewSettle() {
  2173. Long billId = (Long)this.getModel().getDataEntity().getPkValue();
  2174. if (billId == 0L) {
  2175. this.getView().showTipNotification(ResManager.loadKDString("暂无结算记录。", "PaymentBillList_5", "fi-cas-formplugin", new Object[0]));
  2176. } else {
  2177. List<Long> mainSettleIds = SettleRecordQueryHelperForCas.getSettleIdsByMain("ap_settlerecord", "nckd_cas_arbill", new Object[]{billId});
  2178. List<Long> asstSettleIds = SettleRecordQueryHelperForCas.getSettleIdsByAsst("ap_settlerecord", "nckd_cas_arbill", new Object[]{billId});
  2179. Set<Long> settleRecordIds = new HashSet();
  2180. settleRecordIds.addAll(mainSettleIds);
  2181. settleRecordIds.addAll(asstSettleIds);
  2182. if (settleRecordIds.size() > 0) {
  2183. ListShowParameter parameter = new ListShowParameter();
  2184. parameter.setBillFormId("ap_settlerecord");
  2185. parameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
  2186. ListFilterParameter param = new ListFilterParameter();
  2187. param.setFilter(new QFilter("id", "in", settleRecordIds));
  2188. parameter.setListFilterParameter(param);
  2189. parameter.setCustomParam("checkKey", true);
  2190. this.getView().showForm(parameter);
  2191. } else {
  2192. this.getView().showTipNotification(ResManager.loadKDString("暂无结算记录。", "PaymentBillList_5", "fi-cas-formplugin", new Object[0]));
  2193. }
  2194. }
  2195. }
  2196. public void afterAddRow(AfterAddRowEventArgs e) {
  2197. super.afterAddRow(e);
  2198. EntryProp entryProp = e.getEntryProp();
  2199. String entryName = entryProp.getName();
  2200. if ("entry".equals(entryName)) {
  2201. RowDataEntity[] rows = e.getRowDataEntities();
  2202. if (rows.length > 0) {
  2203. RowDataEntity[] var5 = rows;
  2204. int var6 = rows.length;
  2205. for(int var7 = 0; var7 < var6; ++var7) {
  2206. RowDataEntity row = var5[var7];
  2207. this.getModel().setValue("e_sourcebillid", this.getValue("sourcebillid"), row.getRowIndex());
  2208. this.getModel().setValue("e_sourcebillentryid", this.getValue("sourceentryid"), row.getRowIndex());
  2209. }
  2210. }
  2211. }
  2212. }
  2213. private void isOnlinebankVisibility() {
  2214. String paymentchannel = (String)this.getValue("paymentchannel");
  2215. if (paymentchannel != null && this.isAcctBankExistOnlineBankAcct()) {
  2216. this.getView().setVisible(true, new String[]{"netbankacct"});
  2217. } else {
  2218. this.getView().setVisible(false, new String[]{"netbankacct"});
  2219. }
  2220. }
  2221. private Boolean cancelPayCheckSettle(DynamicObject payObj) {
  2222. Boolean result = Boolean.FALSE;
  2223. boolean exists = SettleRecordQueryHelperForCas.isExistsSettlesByMain("ap_settlerecord", "nckd_cas_arbill", new Object[]{payObj.getPkValue()}, (QFilter)null);
  2224. boolean exists2 = SettleRecordQueryHelperForCas.isExistsSettlesByAsst("ap_settlerecord", "nckd_cas_arbill", new Object[]{payObj.getPkValue()}, (QFilter)null);
  2225. if (exists || exists2) {
  2226. StringBuilder settleSb = new StringBuilder();
  2227. String billno = payObj.getString("billno");
  2228. settleSb.append(String.format(ResManager.loadKDString("(%s)单据已经完成结算", "PaymentBillList_28", "fi-cas-formplugin", new Object[0]), billno));
  2229. this.getView().showConfirm(settleSb.append(ResManager.loadKDString(",如果继续操作将会自动反结算对应的结算记录,是否继续?", "PaymentBillList_29", "fi-cas-formplugin", new Object[0])).toString(), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_CANCELPAY_SETTLE_CALLBACK", this));
  2230. result = Boolean.TRUE;
  2231. }
  2232. return result;
  2233. }
  2234. public String getPayeeOrPayerInfoNumber(Object payeeOrPayer, Object payeeOrPayerType, String billName) {
  2235. String payeenumber = "";
  2236. String entityNameTemp = "";
  2237. String addressPropName = "";
  2238. if (isSupplier(payeeOrPayerType)) {
  2239. entityNameTemp = AsstActTypeEnum.SUPPLIER.getValue();
  2240. addressPropName = "supplieraddress";
  2241. }
  2242. if (isCustomer(payeeOrPayerType)) {
  2243. entityNameTemp = AsstActTypeEnum.CUSTOMER.getValue();
  2244. addressPropName = "customeraddress";
  2245. }
  2246. if (!CasHelper.isEmpty(entityNameTemp) && !CasHelper.isEmpty(payeeOrPayer)) {
  2247. DynamicObject supplierCustDO = BusinessDataServiceHelper.loadSingleFromCache(payeeOrPayer, entityNameTemp, "number,entry_bank.isdefault_bank,entry_bank.bankaccount,entry_bank.bank,entry_bank.accountname,entry_address." + addressPropName);
  2248. if (!CasHelper.isEmpty(supplierCustDO)) {
  2249. payeenumber = supplierCustDO.getString("number");
  2250. }
  2251. }
  2252. return payeenumber;
  2253. }
  2254. public String getUserOrOrgNumber(Object id, Object type) {
  2255. String entityNameTemp = "";
  2256. String payeenumber = "";
  2257. if (isUser(type)) {
  2258. entityNameTemp = AsstActTypeEnum.EMPLOYEE.getValue();
  2259. }
  2260. if (isOrg(type)) {
  2261. entityNameTemp = AsstActTypeEnum.COMPANY.getValue();
  2262. }
  2263. if (!CasHelper.isEmpty(entityNameTemp) && !CasHelper.isEmpty(id)) {
  2264. DynamicObject userOrgDO = BusinessDataServiceHelper.loadSingleFromCache(id, entityNameTemp, "number");
  2265. if (!CasHelper.isEmpty(userOrgDO)) {
  2266. payeenumber = userOrgDO.getString("number");
  2267. }
  2268. }
  2269. return payeenumber;
  2270. }
  2271. private void fillFundflowItem(boolean isCover, DynamicObject defaultFundsItem) {
  2272. if (defaultFundsItem != null) {
  2273. for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
  2274. if (isCover) {
  2275. this.setValue("e_fundflowitem", defaultFundsItem.getPkValue(), i);
  2276. } else {
  2277. this.setValueIfAbsent("e_fundflowitem", defaultFundsItem.getPkValue(), i);
  2278. }
  2279. }
  2280. }
  2281. }
  2282. private static boolean isSupplier(Object payeeType) {
  2283. return isAimType(AsstActTypeEnum.SUPPLIER, payeeType);
  2284. }
  2285. private static boolean isCustomer(Object payeeType) {
  2286. return isAimType(AsstActTypeEnum.CUSTOMER, payeeType);
  2287. }
  2288. private static boolean isUser(Object payeeType) {
  2289. return isAimType(AsstActTypeEnum.EMPLOYEE, payeeType);
  2290. }
  2291. private static boolean isOrg(Object payeeType) {
  2292. return isAimType(AsstActTypeEnum.COMPANY, payeeType);
  2293. }
  2294. private static boolean isOther(Object payeeType) {
  2295. return isAimType(AsstActTypeEnum.OTHER, payeeType);
  2296. }
  2297. private static boolean isAimType(AsstActTypeEnum asstactType, Object payeeType) {
  2298. return asstactType.getValue().equals(payeeType);
  2299. }
  2300. private boolean isLockSettleOrg() {
  2301. String sourceBillType = this.getString("sourcebilltype");
  2302. return "ap_finapbill".equals(sourceBillType) || "ar_finarbill".equals(sourceBillType) || "ap_payapply".equals(sourceBillType) || "pm_purorderbill".equals(sourceBillType);
  2303. }
  2304. private boolean isClearFeeSettleType() {
  2305. DynamicObject settleType = (DynamicObject)this.getModel().getValue("settletype");
  2306. if (settleType == null) {
  2307. return true;
  2308. } else {
  2309. String settlementType = settleType.getString("settlementtype");
  2310. return Objects.equals(settlementType, SettleMentTypeEnum.BANK.getValue()) || Objects.equals(settlementType, SettleMentTypeEnum.BUSINESS.getValue()) || Objects.equals(settlementType, SettleMentTypeEnum.CHECK.getValue());
  2311. }
  2312. }
  2313. private boolean hasPayeeInfo() {
  2314. String payeeformid = this.getString("payeetype");
  2315. Long payeeId = Long.parseLong(this.getValue("payee") == null ? "0" : this.getValue("payee").toString());
  2316. String payeeType = this.getString("payeetype");
  2317. if (isOther(payeeType)) {
  2318. return kd.bos.dataentity.utils.StringUtils.isNotBlank(this.getValue("payeename"));
  2319. } else {
  2320. return CasHelper.isNotEmpty(payeeformid) && CasHelper.isNotEmpty(payeeId);
  2321. }
  2322. }
  2323. public void signCallback(SignCallbackEvent evt) {
  2324. if (evt.getCallbackId().equals("signbeforecommitbe")) {
  2325. ClientMethodResult ret = evt.getResult();
  2326. if (ret.getSuccess()) {
  2327. OperateOption operateOption = OperateOption.create();
  2328. operateOption.setVariableValue("ishasright", "true");
  2329. operateOption.setVariableValue("signCallbackFlag", "true");
  2330. operateOption.setVariableValue("signFirstSave", "false");
  2331. operateOption.setVariableValue("signResult", SerializationUtils.toJsonString(evt.getResult().getResult()));
  2332. operateOption.setVariableValue("clearResult", evt.getClearText());
  2333. OperationResult operationResult = this.getView().invokeOperation("beforecommitbe", operateOption);
  2334. if (operationResult.isSuccess()) {
  2335. this.getView().invokeOperation("commitbe");
  2336. } else {
  2337. logger.info(" signcallback fail ");
  2338. if (EmptyUtil.isNoEmpty(operationResult.getMessage())) {
  2339. evt.getView().showTipNotification(operationResult.getMessage());
  2340. }
  2341. }
  2342. } else {
  2343. logger.info(" signbeforecommitbe SignCallbackEvent fail ");
  2344. }
  2345. }
  2346. }
  2347. }