采购建议报表新增计量单位
This commit is contained in:
		
							parent
							
								
									85fcb27194
								
							
						
					
					
						commit
						e866ab8f27
					
				|  | @ -0,0 +1,104 @@ | |||
| package tqq9.lc123.cloud.app.api.controller; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.drew.lang.annotations.NotNull; | ||||
| import kd.bos.dataentity.OperateOption; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.operate.result.IOperateInfo; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiController; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiPostMapping; | ||||
| import kd.bos.openapi.common.result.CustomApiResult; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.OperationServiceHelper; | ||||
| import tqq9.lc123.cloud.app.api.utils.ApiResultExt; | ||||
| import tqq9.lc123.cloud.app.api.utils.Constants; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * 应收结算记录反结算接口 | ||||
|  */ | ||||
| @ApiController(value = "ArSettleRecordController", desc = "应收结算记录api接口,自定义插件") | ||||
| public class ArSettleRecordController { | ||||
|     private final static Log logger = LogFactory.getLog(ArSettleRecordController.class); | ||||
|     public static final String LC_SETTLERECORD_PROPERTIES = "id,billno,org,mainbillid,mainbillentryid,totalsettleamt,localtotalsettleamt,settlerelation,settletype,mainbilltype," + | ||||
|             "exchangerate,settledate,corebillid,corebillentryid,settleentry,billentity,billstatus,isvoucher,entry.billtype,entry.currency,entry.settleamt,entry.billid,entry.billentryid," + | ||||
|             "entry.e_exchangerate,entry.billnum,e_settleentry,iswrittenoff,hadwrittenoff,e_hadwrittenoff,e_billentity,settleseq,mainpayableamt,entry.payableamt,entry.localsettleamt,autosettletype"; //应收结算记录 | ||||
| 
 | ||||
| 
 | ||||
|     @ApiPostMapping(value = "/ArSettleRecord_Unsettle", desc = "应收结算记录反结算api接口") | ||||
|     public CustomApiResult<ApiResultExt> LC_ArSettleRecord_Unsettle | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") ArrayList<String> data) { | ||||
| 
 | ||||
| 
 | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         QFilter qFilter = new QFilter("entry.billnum", QCP.in, data); | ||||
|         qFilter.and("billstatus", QCP.equals, "C"); | ||||
|         DynamicObject[] ar_settlerecords = BusinessDataServiceHelper.load(Constants.AR_SETTLERECORD, LC_SETTLERECORD_PROPERTIES, qFilter.toArray()); | ||||
|         HashMap<String,String> map=new HashMap<String,String>(); | ||||
|         for (DynamicObject ar_settlerecord : ar_settlerecords) { | ||||
|             DynamicObjectCollection entry = ar_settlerecord.getDynamicObjectCollection("entry"); | ||||
|             for (DynamicObject dynamicObject : entry) { | ||||
|                 map.put(dynamicObject.getString("billnum"),ar_settlerecord.getString("id")); | ||||
|             } | ||||
|         } | ||||
|         Integer index=0; | ||||
|         for (int i = 0; i < data.size(); i++) { | ||||
|             String billno = data.get(i); | ||||
|             JSONObject keys = new JSONObject(); | ||||
|             keys.put("billno",billno); | ||||
|             ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|             ApiResultExt.Error error = new ApiResultExt.Error(); | ||||
|             error.setRowMsg(new ArrayList<String>()); | ||||
|             resultBean.setBillIndex(i); | ||||
|             resultBean.setKeys(keys); | ||||
|             resultBean.setNumber(billno); | ||||
|             resultBean.setType(Constants.TYPE_UNSETTLE); | ||||
|             if(map.containsKey(billno)){ | ||||
|                 resultBean.setId(map.get(billno)); | ||||
|                 resultBean.setBillStatus(true); | ||||
|             }else{ | ||||
|                 List<String> rowMsg = error.getRowMsg(); | ||||
|                 rowMsg.add("根据传入编号:"+billno+"未找到对应结算记录,请核销后再进行反核销"); | ||||
|                 error.setRowMsg(rowMsg); | ||||
|                 error.setEntityKey(Constants.AR_SETTLERECORD); | ||||
|                 error.setKeys(keys); | ||||
|                 resultBean.setId(""); | ||||
|                 resultBean.setBillStatus(false); | ||||
|                 index++; | ||||
|             } | ||||
|             resultBean.setErrors(error); | ||||
|             results.add(resultBean); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         OperateOption option = OperateOption.create(); | ||||
|         OperationResult unsettleResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSETTLE, Constants.AR_SETTLERECORD, ar_settlerecords, option); | ||||
|         List<IOperateInfo> allErrorOrValidateInfo = unsettleResult.getAllErrorOrValidateInfo(); | ||||
|         if (!allErrorOrValidateInfo.isEmpty()) { | ||||
|             index++; | ||||
|         } | ||||
|         for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) { | ||||
|             HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, Constants.AR_SETTLERECORD); | ||||
|             results= (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList"); | ||||
|         } | ||||
|         int failCount = index;//失败数量 | ||||
|         int successCount = data.size() - index;//成功数量 | ||||
|         resultExt.setFailCount(failCount); | ||||
|         resultExt.setSuccessCount(successCount); | ||||
|         resultExt.setResult(results); | ||||
|         return CustomApiResult.success(resultExt); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -0,0 +1,157 @@ | |||
| package tqq9.lc123.cloud.app.api.controller; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.drew.lang.annotations.NotNull; | ||||
| import kd.bos.dataentity.OperateOption; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.operate.result.IOperateInfo; | ||||
| import kd.bos.entity.operate.result.OperateInfo; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiController; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiPostMapping; | ||||
| import kd.bos.openapi.common.result.CustomApiResult; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.OperationServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import tqq9.lc123.cloud.app.api.utils.ApiResultExt; | ||||
| import tqq9.lc123.cloud.app.api.utils.Constants; | ||||
| 
 | ||||
| import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.*; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * 应收结算记录反结算接口 | ||||
|  */ | ||||
| @ApiController(value = "CasPaybillController", desc = "付款单api接口,自定义插件") | ||||
| public class CasPaybillController { | ||||
|     public static final String LC_PAYBILL_PROPERTIES = "billno,id,billstatus,bizdate,billtype,paymenttype,payeetype,description,issingle,org,payeracctcash,payeracctbank,payerbank," + | ||||
|             "payee,payeeformid,payeename,payeeaccformid,payeeacctbank,payeebanknum,payeebank,payeebankname,actpayamt,currency,exchangerate,localamt,settletype,settletnumber,fundflowitem,usage," + | ||||
|             "expectdate,reccountry,recprovince,reccity,recaccbankname,recbanknumber,sourcetype,sourcebilltype,sourcebillid,cashier,paydate,bankcheckflag,bankcheckflag_tag,entrance,entrustorg," + | ||||
|             "applyorg,e_actamt,e_localamt,e_fundflowitem,e_remark,e_payableAmt,e_payablelocamt,e_discountamt,e_discountlocamt,e_sourcebillentryid,e_unsettledamt,e_settledamt,e_unsettledlocalamt," + | ||||
|             "e_unlockamt,e_material,e_expenseitem,e_corebillno,e_corebillentryseq,e_sourcebillid,e_corebillid,e_corebillentryid,e_corebilltype,conbillid,conbillentryid,settleorg,paymentchannel," + | ||||
|             "payeetype,payee,isvoucher,isdiffcur,dpamt,agreedrate,fee,dpcurrency,iscrosspay,dplocalamt,dpexchangerate,feecurrency,feeactbank,lossamt,draftbill,exratetable,exratedate,inneraccount," + | ||||
|             "acttradedate,feepayer,createtime,payeeacctcash,openorg,totalpayamt,payquotation,dppayquotation,agreedquotation,settletype,settletype.settlementtype,settletnumber,singlestream,basecurrency," + | ||||
|             "paymentidentify,feepaydate,feepay,matchamountpay,unmatchamountpay,unmatchamountrec,matchamountrec,matchflag,bizdate,auditdate,sourcebilltype,entry,entry.e_sourcebillid,cas_draftinfo.draftbillinfo," + | ||||
|             "cas_draftinfo.transamount,cas_draftinfo.draftbilllogid,entry.e_scheid,cas_draftinfo.srcbillindex,cas_draftinfo.paybillcurrency,entry.e_dpamt,tqq9_digital_receipt,tqq9_billstatus,iswaitsche,priority,changestatus," + | ||||
|             "istop,entry.e_refundamt,entry.e_remainrefundamt,totalrefundedamt,totalremainrefundamt,localrefundedamt,localremainrefundamt"; //应收结算记录 | ||||
|     private final static Log logger = LogFactory.getLog(CasPaybillController.class); | ||||
| 
 | ||||
|     @ApiPostMapping(value = "/CasPaybill_StatusChange", desc = "付款单状态变更api接口") | ||||
|     public CustomApiResult<ApiResultExt> LC_CasPaybill_StatusChange | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") List<HashMap<String, Object>> data) throws ParseException { | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<String> billnos = new ArrayList<>(); | ||||
|         HashMap<String, String> billStatusMap = new HashMap<>(); | ||||
|         HashMap<String, String> billIdMap = new HashMap<>(); | ||||
|         Set<String> validValues = new HashSet<>(); | ||||
|         validValues.add("4"); | ||||
|         validValues.add("5"); | ||||
|         validValues.add("6"); | ||||
|         validValues.add("7"); | ||||
|         validValues.add("8"); | ||||
|         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");  // 目标日期格式 | ||||
|         for (int i = 0; i < data.size(); i++) { | ||||
|             HashMap<String, Object> dataMap = data.get(i); | ||||
|             String billno = (String) dataMap.get("billno"); | ||||
|             billnos.add(billno); | ||||
|             billStatusMap.put(billno, (String) dataMap.get("billstatus")); | ||||
|         } | ||||
|         QFilter qFilter = new QFilter("billno", QCP.in, billnos); | ||||
|         DynamicObject[] cas_paybills = BusinessDataServiceHelper.load(Constants.CAS_PAYBILL, LC_PAYBILL_PROPERTIES, qFilter.toArray()); | ||||
|         Integer index = 0; | ||||
|         for (int i = 0; i < data.size(); i++) { | ||||
|             HashMap<String, Object> dataMap = data.get(i); | ||||
|             String billno = (String) dataMap.get("billno"); | ||||
|             JSONObject keys = new JSONObject(); | ||||
|             keys.put("billno", billno); | ||||
|             ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|             ApiResultExt.Error error = new ApiResultExt.Error(); | ||||
|             error.setRowMsg(new ArrayList<String>()); | ||||
|             resultBean.setBillIndex(i); | ||||
|             resultBean.setKeys(keys); | ||||
|             resultBean.setNumber(billno); | ||||
|             resultBean.setType(Constants.TYPE_UPDATE); | ||||
|             Boolean iserror = true; | ||||
|             for (DynamicObject cas_paybill : cas_paybills) { | ||||
|                 if (billno.equals(cas_paybill.getString("billno"))) { | ||||
|                     Date bizdate = dateFormat.parse(dataMap.get("bizdate").toString()); | ||||
| //                    cas_paybill.set("bizdate", bizdate); | ||||
| //                    cas_paybill.set("openorg.number", dataMap.get("openorg_number")); | ||||
| //                    cas_paybill.set("settletype.number", dataMap.get("settletype_number")); | ||||
| //                    cas_paybill.set("payeracctbank.number", dataMap.get("bankaccountnumber")); | ||||
| //                    cas_paybill.set("tqq9_billstatus", dataMap.get("billstatus")); | ||||
|                     cas_paybill.set("description", dataMap.get("description")); | ||||
|                     cas_paybill.set("tqq9_digital_receipt", dataMap.get("tqq9_digital_receipt")); | ||||
|                     resultBean.setId(cas_paybill.getString("id")); | ||||
|                     resultBean.setBillStatus(true); | ||||
|                     iserror = false; | ||||
|                     if(!validValues.contains((String)dataMap.get("billstatus"))){ | ||||
|                         List<String> rowMsg = error.getRowMsg(); | ||||
|                         rowMsg.add("传入编号:" + billno + "的交易状态有误"); | ||||
|                         error.setRowMsg(rowMsg); | ||||
|                         error.setEntityKey(Constants.CAS_PAYBILL); | ||||
|                         error.setKeys(keys); | ||||
|                         resultBean.setId(""); | ||||
|                         resultBean.setBillStatus(false); | ||||
|                         index++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if (iserror) { | ||||
|                 List<String> rowMsg = error.getRowMsg(); | ||||
|                 rowMsg.add("根据传入编号:" + billno + "未找到对应付款单"); | ||||
|                 error.setRowMsg(rowMsg); | ||||
|                 error.setEntityKey(Constants.CAS_PAYBILL); | ||||
|                 error.setKeys(keys); | ||||
|                 resultBean.setId(""); | ||||
|                 resultBean.setBillStatus(false); | ||||
|                 index++; | ||||
|             } | ||||
|             resultBean.setErrors(error); | ||||
|             results.add(resultBean); | ||||
|         } | ||||
|         OperateOption option = OperateOption.create(); | ||||
| 
 | ||||
|         for (DynamicObject cas_paybill : cas_paybills) { | ||||
|             String billstatus = billStatusMap.get(cas_paybill.getString("billno")); | ||||
|             if (StringUtils.equals("5", billstatus)) { | ||||
| //                cas_paybill.set("billstatus", "D"); | ||||
|                 OperationResult payResult = OperationServiceHelper.executeOperate(Constants.TYPE_PAY, Constants.CAS_PAYBILL, new DynamicObject[]{cas_paybill}, option); | ||||
|                 List<IOperateInfo> allErrorOrValidateInfo = payResult.getAllErrorOrValidateInfo(); | ||||
|                 if (!allErrorOrValidateInfo.isEmpty()) { | ||||
|                     index++; | ||||
|                 } | ||||
|                 for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) { | ||||
|                     HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, Constants.CAS_PAYBILL); | ||||
|                     results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList"); | ||||
|                 } | ||||
|             } else if (StringUtils.equals("4", billstatus) || StringUtils.equals("6", billstatus)) { | ||||
|                 cas_paybill.set("billstatus", "F"); | ||||
|                 SaveServiceHelper.save(new DynamicObject[]{cas_paybill}); | ||||
|             } else if (StringUtils.equals("7", billstatus)) { | ||||
|                 cas_paybill.set("billstatus", "E"); | ||||
|                 SaveServiceHelper.save(new DynamicObject[]{cas_paybill}); | ||||
|             } else if (StringUtils.equals("8", billstatus)) { | ||||
|                 cas_paybill.set("billstatus", "G"); | ||||
|                 SaveServiceHelper.save(new DynamicObject[]{cas_paybill}); | ||||
|             } | ||||
|         } | ||||
|         int failCount = index;//失败数量 | ||||
|         int successCount = data.size() - index;//成功数量 | ||||
|         resultExt.setFailCount(failCount); | ||||
|         resultExt.setSuccessCount(successCount); | ||||
|         resultExt.setResult(results); | ||||
|         return CustomApiResult.success(resultExt); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -0,0 +1,213 @@ | |||
| package tqq9.lc123.cloud.app.api.utils; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.operate.result.IOperateInfo; | ||||
| import kd.bos.entity.operate.result.OperateErrorInfo; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiModel; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.*; | ||||
| 
 | ||||
| @ApiModel | ||||
| public class ApiResultExt implements Serializable { | ||||
|     @ApiParam("操作失败数量") | ||||
|     private int failCount; | ||||
|     @ApiParam("操作成功数量") | ||||
|     private int successCount; | ||||
|     @ApiParam("返回结果") | ||||
|     private List<ResultBean> result; | ||||
| 
 | ||||
|     public int getFailCount() { | ||||
|         return failCount; | ||||
|     } | ||||
| 
 | ||||
|     public void setFailCount(int failCount) { | ||||
|         this.failCount = failCount; | ||||
|     } | ||||
| 
 | ||||
|     public int getSuccessCount() { | ||||
|         return successCount; | ||||
|     } | ||||
| 
 | ||||
|     public void setSuccessCount(int successCount) { | ||||
|         this.successCount = successCount; | ||||
|     } | ||||
| 
 | ||||
|     public List<ResultBean> getResult() { | ||||
|         return result; | ||||
|     } | ||||
| 
 | ||||
|     public void setResult(List<ResultBean> result) { | ||||
|         this.result = result; | ||||
|     } | ||||
| 
 | ||||
|     @ApiModel | ||||
|     public static class ResultBean implements Serializable { | ||||
| 
 | ||||
| 
 | ||||
|         @ApiParam("数据索引") | ||||
|         private int billIndex; | ||||
|         @ApiParam("接口操作是否成功") | ||||
|         private boolean billStatus; | ||||
|         @ApiParam("错误信息") | ||||
|         private Error errors; | ||||
|         @ApiParam("金蝶单据id") | ||||
|         private String id; | ||||
|         @ApiParam("候选键信息") | ||||
|         private JSONObject keys; | ||||
|         @ApiParam("金蝶单据编号") | ||||
|         private String number; | ||||
|         @ApiParam("接口操作类型") | ||||
|         private String type; | ||||
| 
 | ||||
|         public int getBillIndex() { | ||||
|             return billIndex; | ||||
|         } | ||||
| 
 | ||||
|         public void setBillIndex(int billIndex) { | ||||
|             this.billIndex = billIndex; | ||||
|         } | ||||
| 
 | ||||
|         public boolean isBillStatus() { | ||||
|             return billStatus; | ||||
|         } | ||||
| 
 | ||||
|         public void setBillStatus(boolean billStatus) { | ||||
|             this.billStatus = billStatus; | ||||
|         } | ||||
| 
 | ||||
|         public Error getErrors() { | ||||
|             return errors; | ||||
|         } | ||||
| 
 | ||||
|         public void setErrors(Error errors) { | ||||
|             this.errors = errors; | ||||
|         } | ||||
| 
 | ||||
|         public String getId() { | ||||
|             return id; | ||||
|         } | ||||
| 
 | ||||
|         public void setId(String id) { | ||||
|             this.id = id; | ||||
|         } | ||||
| 
 | ||||
|         public JSONObject getKeys() { | ||||
|             return keys; | ||||
|         } | ||||
| 
 | ||||
|         public void setKeys(JSONObject keys) { | ||||
|             this.keys = keys; | ||||
|         } | ||||
| 
 | ||||
|         public String getNumber() { | ||||
|             return number; | ||||
|         } | ||||
| 
 | ||||
|         public void setNumber(String number) { | ||||
|             this.number = number; | ||||
|         } | ||||
| 
 | ||||
|         public String getType() { | ||||
|             return type; | ||||
|         } | ||||
| 
 | ||||
|         public void setType(String type) { | ||||
|             this.type = type; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static class Error implements Serializable { | ||||
|         private String entityKey; | ||||
|         private String entryRowIndex; | ||||
|         private JSONObject keys; | ||||
|         private List<String> rowMsg; | ||||
|         private String subEntryRowIndex; | ||||
| 
 | ||||
|         // Getter 和 Setter | ||||
|         public String getEntityKey() { | ||||
|             return entityKey; | ||||
|         } | ||||
| 
 | ||||
|         public void setEntityKey(String entityKey) { | ||||
|             this.entityKey = entityKey; | ||||
|         } | ||||
| 
 | ||||
|         public String getEntryRowIndex() { | ||||
|             return entryRowIndex; | ||||
|         } | ||||
| 
 | ||||
|         public void setEntryRowIndex(String entryRowIndex) { | ||||
|             this.entryRowIndex = entryRowIndex; | ||||
|         } | ||||
| 
 | ||||
|         public JSONObject getKeys() { | ||||
|             return keys; | ||||
|         } | ||||
| 
 | ||||
|         public void setKeys(JSONObject keys) { | ||||
|             this.keys = keys; | ||||
|         } | ||||
| 
 | ||||
|         public List<String> getRowMsg() { | ||||
|             return rowMsg; | ||||
|         } | ||||
| 
 | ||||
|         public void setRowMsg(List<String> rowMsg) { | ||||
|             this.rowMsg = rowMsg; | ||||
|         } | ||||
| 
 | ||||
|         public String getSubEntryRowIndex() { | ||||
|             return subEntryRowIndex; | ||||
|         } | ||||
| 
 | ||||
|         public void setSubEntryRowIndex(String subEntryRowIndex) { | ||||
|             this.subEntryRowIndex = subEntryRowIndex; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public HashMap<String,Object> addErrorToResultBeanByNumber(List<ResultBean> resultBeans, IOperateInfo iOperateInfo, String entityKey) { | ||||
|         Set<String> idSet = new HashSet<>(); | ||||
|         for (ResultBean resultBean : resultBeans) { | ||||
|             Error error = resultBean.getErrors(); | ||||
|             resultBean.setBillStatus(false); | ||||
|             String message = iOperateInfo.getMessage(); | ||||
|             String id  = iOperateInfo.getPkValue().toString(); | ||||
|             if (StringUtils.equals(resultBean.getId(),id)) { | ||||
|                 if (error == null) { | ||||
|                     error = new Error(); | ||||
|                     error.setRowMsg(new ArrayList<String>()); | ||||
|                 } | ||||
|                 error.setKeys(resultBean.getKeys()); | ||||
|                 error.setEntityKey(entityKey); | ||||
|                 List<String> rowMsg = error.getRowMsg(); | ||||
|                 rowMsg.add(message); | ||||
|                 error.setRowMsg(rowMsg); | ||||
|                 resultBean.setErrors(error); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         HashMap<String, Object> returnMap = new HashMap<>(); | ||||
|         returnMap.put("ResultBeanList",resultBeans); | ||||
|         return returnMap; | ||||
|     } | ||||
| 
 | ||||
|     public static DynamicObject[] removeBillByBillno(DynamicObject[] bills, Set<String> idSet) { | ||||
|         DynamicObject[] tempBills = new DynamicObject[bills.length]; | ||||
|         int index = 0; | ||||
| 
 | ||||
|         // 遍历原数组,复制不需要删除的元素到 tempBills | ||||
|         for (DynamicObject bill : bills) { | ||||
|             if (!idSet.contains(bill.getString("id"))) { | ||||
|                 tempBills[index++] = bill; | ||||
|             } | ||||
|         } | ||||
|         // 使用 Arrays.copyOf 修剪数组到实际大小 | ||||
|         return Arrays.copyOf(tempBills, index); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,17 @@ | |||
| package tqq9.lc123.cloud.app.api.utils; | ||||
| 
 | ||||
| public class Constants { | ||||
|     //单据类型 | ||||
|     public static final String AR_SETTLERECORD = "ar_settlerecord";   //应收结算记录 | ||||
|     public static final String CAS_PAYBILL = "cas_paybill";   //付款处理 | ||||
| 
 | ||||
|     //操作类型 | ||||
|     public static final String TYPE_SAVE = "save";   //保存类型 | ||||
|     public static final String TYPE_SUBMIT = "submit";   //提交类型 | ||||
|     public static final String TYPE_AUDIT = "audit";    //审核类型 | ||||
| 
 | ||||
|     public static final String TYPE_UPDATE = "update";   //更新类型 | ||||
|     public static final String TYPE_ADD = "add";   //新增类型 | ||||
|     public static final String TYPE_UNSETTLE = "unsettle";   //反结算类型 | ||||
|     public static final String TYPE_PAY = "pay";   //付款类型 | ||||
| } | ||||
|  | @ -222,6 +222,7 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi | |||
|                 dynamicObject1.set("seq",i+1);//分录号 | ||||
|                 dynamicObject1.set("material",materialpurchaseinfo);//物料 | ||||
|                 dynamicObject1.set("materialname",tqq9_sku.getString("name"));//物料名称 | ||||
|                 dynamicObject1.set("unit",tqq9_sku.getDynamicObject("baseunit"));//计量单位 | ||||
|                 dynamicObject1.set("baseunit",tqq9_sku.getDynamicObject("baseunit"));//基本单位 | ||||
|                 dynamicObject1.set("rowclosestatus","A");//行关闭状态 | ||||
|                 dynamicObject1.set("rowterminatestatus","A");//行终止状态 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue