diff --git a/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java b/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java index 5ee0548..a31a86b 100644 --- a/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java +++ b/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java @@ -99,8 +99,16 @@ public class GatheringbillRestResource extends ArapBaseRestResource { // 税码 String ctaxcode = ""; BaseDAO dao = new BaseDAO(); - // 销售订单号 + // 销售订单号 从表体拿 String csaleorderid = ""; + List> itemMaps = (List) billMap.get("items"); + List itemvos = new ArrayList(); + if (itemMaps != null && itemMaps.size() > 0) { + for (Map item : itemMaps) { + GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class); + csaleorderid = itemvo.getDef37(); + } + } try { HYPubBO hybo = new HYPubBO(); headvo.setIsinit(new UFBoolean(false)); @@ -113,10 +121,10 @@ public class GatheringbillRestResource extends ArapBaseRestResource { // 往来对象0-客户 2-部门 3-业务员 默认客户 headvo.setObjtype(0); // 销售订单号 - csaleorderid = headvo.getDef3(); if (StringUtils.isEmpty(csaleorderid)) { throw new BusinessException("销售订单不能为空"); - // return ResultMessageUtil.exceptionToJSON("销售订单不能为空", APIErrCodeEnum.BUSINESSEXCCODE.getCode()); + // return ResultMessageUtil.exceptionToJSON("销售订单不能为空", + // APIErrCodeEnum.BUSINESSEXCCODE.getCode()); } // 客户 Object customerid = hybo.findColValue("so_saleorder", "ccustomerid", @@ -181,8 +189,6 @@ public class GatheringbillRestResource extends ArapBaseRestResource { return ResultMessageUtil.exceptionToJSON(e); } - List> itemMaps = (List) billMap.get("items"); - List itemvos = new ArrayList(); if (itemMaps != null && itemMaps.size() > 0) { for (Map item : itemMaps) { GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class); @@ -229,7 +235,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource { // UFDouble notax_cr = money_cr.sub(local_tax_cr); itemvo.setNotax_cr(notax_cr); - //zhangxinah增加组织本币无税金额(贷方) + // zhangxinah增加组织本币无税金额(贷方) itemvo.setLocal_notax_cr(notax_cr); // itemvo.setRate(UFDouble.ZERO_DBL); diff --git a/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java b/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java index 20eab06..64d0734 100644 --- a/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java +++ b/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java @@ -9,6 +9,8 @@ import nc.jdbc.framework.PersistenceManager; import nc.jdbc.framework.exception.DbException; import nc.jdbc.framework.processor.MapListProcessor; import nc.jdbc.framework.processor.MapProcessor; +import nccloud.commons.lang.StringUtils; +import nccloud.framework.core.exception.ExceptionUtils; import nccloud.framework.service.ServiceLocator; import nccloud.framework.web.action.itf.ICommonAction; import nccloud.framework.web.container.IRequest; @@ -172,7 +174,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { "left join bd_cust_supplier df on cmp.pk_oppunit=df.pk_cust_sup " + "left join org_financeorg org on cmp.pk_org = org.pk_financeorg " + "left join bd_balatype jstype on jstype.pk_balatype =cmp.pk_balatype " + - "left join bd_currtype bz on cmp.pk_currtype=bz.pk_currtype"+ + "left join bd_currtype bz on cmp.pk_currtype=bz.pk_currtype" + " where cmp.pk_informer in(" + result + ") "; List> results = (List>) getQueryService().executeQuery(sql, new MapListProcessor()); @@ -188,18 +190,16 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { } if ("撤回".equals(def01)) { vmao.put("publishStatus", "再次发布"); - } else { vmao.put("publishStatus", ""); - } String pjlsh; if (row.get("transerial") != null) { - pjlsh = row.get("transerial").toString(); + pjlsh = row.get("transerial"); } else if (row.get("note_no") != null) { - pjlsh = row.get("note_no").toString(); + pjlsh = row.get("note_no"); } else { resultMap.put("flag", "false"); resultMap.put("message", "票据与流水号不可同时为空"); @@ -211,20 +211,23 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { vmao.put("bankNum", row.get("accnum")); vmao.put("transactionDate", row.get("infodate")); vmao.put("paymentReceiptStatus", row.get("direction")); - vmao.put("currencyCode", row.get("nzcode") ); + vmao.put("currencyCode", row.get("nzcode")); vmao.put("transactionAmount", row.get("moneyy")); vmao.put("pendingClaimAmount", 0); vmao.put("oppAccount", row.get("oppbankaccount")); vmao.put("oppAccountName", row.get("oppunitname")); vmao.put("oppBank", row.get("dfcode")); vmao.put("oppBankName", row.get("dfname")); - vmao.put("description", row.get("memo")); + vmao.put("description", "--"); + if (StringUtils.isNotEmpty(row.get("memo"))) { + vmao.put("description", row.get("memo")); + } vmao.put("bankTransactionNumber", pjlsh); vmao.put("accountType", "默认类型"); vmao.put("orgCode", row.get("orgcode")); vmao.put("billNumber", row.get("note_no")); - if (row.get("pk_balatype") != null && row.get("pk_balatype") != "" && row.get("pk_balatype") != "~") { + if (row.get("pk_balatype") != null && !Objects.equals(row.get("pk_balatype"), "") && !Objects.equals(row.get("pk_balatype"), "~")) { vmao.put("paymentMethod", row.get("pk_balatype")); } else { vmao.put("paymentMethod", "10"); @@ -238,6 +241,10 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { Map access_token = (Map) map.get("data"); String urls2 = urlpath + "/iuap-api-gateway/" + tenant + "/current_yonbip_default_sys/KKAPI/paymentNotice/addBatch?access_token=" + access_token.get("access_token"); Map mapjson = httpFW(urls2, jsonString1); + Logger.error("myBtnClickAction-mapjson = " + mapjson); + if (!"200".equals(mapjson.getOrDefault("code", "") + "")) { + throw new Exception(mapjson.getOrDefault("message", "推送失败") + ""); + } Map datas = (Map) mapjson.get("data"); JSONArray faijsonist = (JSONArray) datas.get("failData"); @@ -273,17 +280,13 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { String message = datas.get("successData") + "成功" + message1 + ",失败:" + failData; resultMap.put("flag", "true"); resultMap.put("message", message); - // 调用服务工具类的deletePrcplInterest方法,尝试删除利息计划 - System.out.println("year" + mapjson); ins.close(); } catch (Exception ex) { // 捕获异常,并记录错误日志 - Logger.error("123" + ex.getMessage(), ex); - resultMap.put("flag", "0"); - resultMap.put("message", ex.getMessage()); + Logger.error("myBtnClickAction-exp:" + ex.getMessage(), ex); + ExceptionUtils.wrapBusinessException(ex.getMessage()); } - // 返回结果映射 return resultMap; } @@ -300,7 +303,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { hmacSHA256.init(secretKey); byte[] hashBytes = hmacSHA256.doFinal(data.getBytes()); String base64Hash = Base64.encodeBase64String(hashBytes); - return URLEncoder.encode(base64Hash, StandardCharsets.UTF_8.toString()); + return URLEncoder.encode(base64Hash, StandardCharsets.UTF_8); } diff --git a/purp/META-INF/.gitkeep b/purp/META-INF/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/purp/METADATA/.gitkeep b/purp/METADATA/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/purp/component.xml b/purp/component.xml new file mode 100644 index 0000000..cde11f8 --- /dev/null +++ b/purp/component.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/purp/resources/.gitkeep b/purp/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/purp/script/.gitkeep b/purp/script/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/purp/src/client/.gitkeep b/purp/src/client/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java b/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java new file mode 100644 index 0000000..bcaed47 --- /dev/null +++ b/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java @@ -0,0 +1,273 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.impl.pp.supplierprice.rule; + +import java.util.ArrayList; +import java.util.List; +import nc.vo.pp.report.entity.PurpReportTransMap; +import nc.vo.pp.report.util.PurpRptUtils; +import nc.vo.pp.supplierprice.entity.SupPriceRptConst; +import nc.vo.pp.util.StringUtils; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.query.ConditionVO; +import nc.vo.pubapp.AppContext; +import nc.vo.scmpub.util.ArrayUtil; +import nc.vo.util.CloneUtil; + +/** + * 最新价格查询 + * 2005适配2312 + * + * @author mzr + * @date 2025/04/16 + */ +public class SupPriceQryRule { + public SupPriceQryRule() { + } + + public String getWhereCtForHis(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + if (ArrayUtil.isEmpty(convos)) { + return ""; + } else { + ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); + List list = new ArrayList(); + + for(ConditionVO vo : copyconvos) { + if (vo.getFieldCode().equals("pk_supplier")) { + vo.setFieldCode(htablealias + ".cvendorid"); + list.add(vo); + } else if (vo.getFieldCode().equals("tcreatetime")) { + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + + vo.setFieldCode(htablealias + ".creationtime"); + list.add(vo); + } else if (!vo.getFieldCode().equals("fpricesrctype")) { + if (vo.getFieldCode().equals("dvaliddate")) { + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + + vo.setFieldCode(htablealias + ".dbilldate"); + list.add(vo); + } else if (vo.getFieldCode().equals("dinvaliddate")) { + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + } else { + vo.setFieldCode(htablealias + "." + vo.getFieldCode()); + list.add(vo); + } + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); + this.addMarWhere(sql, tranMap, rptutils, btablealias); + return sql.toString(); + } + } + + public String getWhereCtForNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + if (ArrayUtil.isEmpty(convos)) { + return ""; + } else { + ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); + + for(ConditionVO vo : copyconvos) { + if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { + int month = Integer.valueOf(vo.getValue()); + UFDate curdate = AppContext.getInstance().getBusiDate(); + UFDate befdate = curdate.getDateBefore(month * 30); + vo.setFieldCode(htablealias + ".dbilldate"); + vo.setOperaCode("between"); + vo.setDataType(3); + String var10001 = befdate.toString(); + vo.setValue(var10001 + " ," + curdate.toString() + " "); + } else if (vo.getFieldCode().equals("pk_supplier")) { + vo.setFieldCode(htablealias + ".cvendorid"); + } else { + vo.setFieldCode(htablealias + "." + vo.getFieldCode()); + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr(copyconvos)); + this.addMarWhere(sql, tranMap, rptutils, btablealias); + return sql.toString(); + } + } + + public String getWhereOrderForHis(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { + List list = new ArrayList(); + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + if (ArrayUtil.isEmpty(convos)) { + return ""; + } else { + ConditionVO[] convosCt = (ConditionVO[])CloneUtil.deepClone(convos); + + for(ConditionVO vo : convosCt) { + if (!vo.getFieldCode().equals("bsc") && !vo.getFieldCode().equals("fpricesrctype")) { + if (vo.getFieldCode().equals("dinvaliddate")) { + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + } else if (vo.getFieldCode().equals("dvaliddate")) { + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + } else if (vo.getFieldCode().equals("tcreatetime")) { + vo.setFieldCode(htablealias + ".creationtime"); + if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + } + + list.add(vo); + } else { + vo.setFieldCode(htablealias + "." + vo.getFieldCode()); + list.add(vo); + } + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); + this.addMarWhere(sql, tranMap, rptutils, btablealias); + return sql.toString(); + } + } + + public String getWhereOrderForNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { + List list = new ArrayList(); + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + ConditionVO[] convosCt = (ConditionVO[])CloneUtil.deepClone(convos); + if (convosCt != null && convosCt.length > 0) { + for(ConditionVO vo : convosCt) { + if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { + int month = Integer.valueOf(vo.getValue()); + UFDate curdate = AppContext.getInstance().getBusiDate(); + UFDate befdate = curdate.getDateBefore(month * 30); + vo.setFieldCode(htablealias + ".dbilldate"); + vo.setOperaCode("between"); + vo.setDataType(3); + String var10001 = befdate.toString(); + vo.setValue(var10001 + " ," + curdate.toString() + " "); + list.add(vo); + } else if (!vo.getFieldCode().equals("bsc")) { + vo.setFieldCode(htablealias + "." + vo.getFieldCode()); + list.add(vo); + } + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); + this.addMarWhere(sql, tranMap, rptutils, btablealias); + return sql.toString(); + } + + public String getWhereSupPrice(PurpReportTransMap tranMap, PurpRptUtils rptutils, String tablealias) { + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + if (ArrayUtil.isEmpty(convos)) { + return ""; + } else { + ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); + + for(ConditionVO vo : copyconvos) { + if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { + int month = Integer.valueOf(vo.getValue()); + UFDate curdate = AppContext.getInstance().getBusiDate(); + UFDate befdate = curdate.getDateBefore(month * 30); + vo.setFieldCode(tablealias + ".dvaliddate"); + vo.setOperaCode("between"); + vo.setDataType(3); + String var10001 = befdate.toString(); + vo.setValue(var10001 + " ," + curdate.toString() + " "); + } else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + vo.setFieldCode(tablealias + "." + vo.getFieldCode()); + } else { + vo.setFieldCode(tablealias + "." + vo.getFieldCode()); + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr(copyconvos)); + this.addMarWhere(sql, tranMap, rptutils, tablealias); + return sql.toString(); + } + } + + public String getWhereSupPriceNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String tablealias) { + ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); + if (ArrayUtil.isEmpty(convos)) { + return ""; + } else { + ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); + List list = new ArrayList(); + + for(ConditionVO vo : copyconvos) { + if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { + int month = Integer.valueOf(vo.getValue()); + UFDate curdate = AppContext.getInstance().getBusiDate(); + UFDate befdate = curdate.getDateBefore(month * 30); + vo.setFieldCode(tablealias + ".dinvaliddate"); + vo.setOperaCode("between"); + vo.setDataType(3); + String var10001 = befdate.toString(); + vo.setValue(var10001 + " ," + curdate.toString() + " "); + ConditionVO newvo = new ConditionVO(); + newvo.setLogic(false); + newvo.setFieldCode(tablealias + ".dvaliddate"); + newvo.setOperaCode("between"); + newvo.setDataType(3); + var10001 = befdate.toString(); + newvo.setValue(var10001 + " ," + curdate.toString() + " "); + list.add(vo); + list.add(newvo); + } else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { + UFDate date = new UFDate(vo.getValue()); + vo.setValue(date.toLocalString()); + vo.setFieldCode(tablealias + "." + vo.getFieldCode()); + list.add(vo); + } else { + vo.setFieldCode(tablealias + "." + vo.getFieldCode()); + list.add(vo); + } + } + + StringBuilder sql = new StringBuilder(""); + sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[0]))); + this.addMarWhere(sql, tranMap, rptutils, tablealias); + return sql.toString(); + } + } + + private void addMarWhere(StringBuilder sql, PurpReportTransMap tranMap, PurpRptUtils rptutils, String btablealias) { + String[] marQryKeys = new String[]{SupPriceRptConst.MARBASCLASS, SupPriceRptConst.MATERIALCODE, SupPriceRptConst.MARTERIALNAME}; + String marwhere = rptutils.getWhereForMar(tranMap, btablealias, marQryKeys); + if (!StringUtils.isEmpty(marwhere)) { + sql.append(" and " + marwhere); + } + + } + + private ConditionVO[] getInitQryCondVOs(PurpReportTransMap tranMap, PurpRptUtils rptutils) { + ConditionVO[] generalvos = tranMap.getConditionVOs(SupPriceRptConst.SUPPRICE_GENERALCOND); + ConditionVO[] logicalvos = tranMap.getConditionVOs(SupPriceRptConst.SUPPRICE_LOGICALCOND); + return rptutils.combineCondVOs(generalvos, logicalvos); + } +} diff --git a/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java b/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java new file mode 100644 index 0000000..fcfae47 --- /dev/null +++ b/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java @@ -0,0 +1,175 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.vo.pp.report.util; + +import java.util.HashMap; +import java.util.Map; +import nc.bs.ic.icreport.pub.RPMetaDataUtil; +import nc.bs.pubapp.report.ReportPermissionUtils; +import nc.pub.smart.context.SmartContext; +import nc.pub.smart.data.DataSet; +import nc.pub.smart.metadata.MetaData; +import nc.vo.ml.MultiLangUtil; +import nc.vo.ml.NCLangRes4VoTransl; +import nc.vo.pp.report.entity.PurpReportTransMap; +import nc.vo.pub.ISuperVO; +import nc.vo.pub.query.ConditionVO; +import nc.vo.pubapp.pattern.model.entity.view.AbstractDataView; +import nc.vo.pubapp.pattern.model.meta.entity.view.IDataViewMeta; +import nc.vo.scmbd.pub.SCMESAPI; +import nc.vo.scmpub.util.ArrayUtil; + +/** + * 最新价格查询 + * 2005适配2312 + * + * @author mzr + * @date 2025/04/16 + */ +public class PurpRptUtils { + public static final int UFDATEDATATIMETYPE = 8; + public static final int UFDATEDATATYPE = 3; + + public PurpRptUtils() { + } + + public ConditionVO[] combineCondVOs(ConditionVO[] generalvos, ConditionVO[] logicalvos) { + ConditionVO[] endvos = null; + if (!ArrayUtil.isEmpty(generalvos)) { + endvos = generalvos; + } + + if (!ArrayUtil.isEmpty(logicalvos) && ArrayUtil.isEmpty(endvos)) { + endvos = logicalvos; + } else if (!ArrayUtil.isEmpty(logicalvos) && endvos != null && endvos.length > 0) { + System.arraycopy(logicalvos, 0, endvos, endvos.length, logicalvos.length); + } + + return endvos; + } + + public DataSet convertDataSet(IDataViewMeta md, AbstractDataView[] vos) { + String[] fields = md.getAttributeNames(); + MetaData mtd = new MetaData(); + RPMetaDataUtil.addVOMetaFieldByKeys(mtd, md, fields); + if (vos != null && vos.length > 0) { + Object[][] datas = new Object[vos.length][fields.length]; + + for(int i = 0; i < vos.length; ++i) { + if (vos[i] != null) { + for(int k = 0; k < fields.length; ++k) { + datas[i][k] = vos[i].getAttributeValue(fields[k]); + } + } + } + + return new DataSet(mtd, datas); + } else { + DataSet ds = new DataSet(); + ds.setMetaData(mtd); + return ds; + } + } + + public String getChnNo() { + return NCLangRes4VoTransl.getNCLangRes().getStrByID("40050004", "1400500040031"); + } + + public String getChnYes() { + return NCLangRes4VoTransl.getNCLangRes().getStrByID("40050004", "1400500040030"); + } + + public String getPermisionInnerJoin(SmartContext context, Class marclass, String btablealias) { + ReportPermissionUtils utils = new ReportPermissionUtils(context); + Map, String> beanMap = new HashMap(); + beanMap.put(marclass, btablealias); + return utils.getPermissionSQL(beanMap); + } + + public String getWhereForMar(PurpReportTransMap tranMap, String btablealias, String[] marQryKeys) { + String marclassKey = marQryKeys[0]; + String marcodeKey = marQryKeys[1]; + String marnameKey = marQryKeys[2]; + ConditionVO codeVO = this.getMarCondVO(tranMap, marcodeKey); + ConditionVO nameVO = this.getMarCondVO(tranMap, marnameKey); + ConditionVO classVO = this.getMarCondVO(tranMap, marclassKey); + if (null == codeVO && null == nameVO && null == classVO) { + return ""; + } else { + StringBuilder wheresql = new StringBuilder(); + wheresql.append(btablealias + ".pk_material in ( select bd_material.pk_material from bd_material bd_material where bd_material.dr=0 "); + if (codeVO != null) { + wheresql.append(" and "); + this.setMarWhere(codeVO, "bd_material.code", wheresql); + } + + if (nameVO != null) { + String langseq = MultiLangUtil.getCurrentLangSeqSuffix(); + wheresql.append(" and "); + this.setMarWhere(nameVO, "bd_material.name" + langseq, wheresql); + } + + if (classVO != null) { + wheresql.append(" and "); + this.setMarWhere(classVO, "bd_material.pk_marbasclass", wheresql); + } + + wheresql.append(" ) "); + return wheresql.toString(); + } + } + + public ConditionVO updUFDateCondVO(ConditionVO condvo, String qryDlgWhereSql, String dateField) { + if (!qryDlgWhereSql.contains(dateField)) { + return null; + } else { + String[] conds = qryDlgWhereSql.split(dateField); + StringBuilder valueBuilder = new StringBuilder(); + String first = conds[1].split("'")[1]; + if (condvo.getOperaCode().equalsIgnoreCase("between")) { + if (condvo.getValue().toLowerCase().contains("isnull")) { + if (condvo.getValue().toLowerCase().startsWith("isnull")) { + valueBuilder.append(first); + condvo.setOperaCode("<="); + } else { + valueBuilder.append(first); + condvo.setOperaCode(">="); + } + + condvo.setValue(valueBuilder.toString()); + return condvo; + } + + String end = conds[2].split("'")[1]; + valueBuilder.append(first); + valueBuilder.append(","); + valueBuilder.append(end); + } else { + valueBuilder.append(first); + } + + condvo.setValue(valueBuilder.toString()); + return condvo; + } + } + + private ConditionVO getMarCondVO(PurpReportTransMap tranMap, String key) { + ConditionVO[] tempvos = tranMap.getConditionVOs(key); + return ArrayUtil.isEmpty(tempvos) ? null : tempvos[0]; + } + + private void setMarWhere(ConditionVO condvo, String field, StringBuilder wheresql) { + if (condvo.getOperaCode().equals("in")) { + wheresql.append(field + " in " + condvo.getValue()); + } else if (condvo.getOperaCode().equals("=")) { + wheresql.append(field + " = '" + SCMESAPI.sqlEncodeGeneral(condvo.getValue()) + "' "); + } else if (condvo.getOperaCode().equals("left like")) { + String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", ""); + wheresql.append(field + " like '" + SCMESAPI.sqlEncodeGeneral(value) + "%' "); + } + + } +} diff --git a/so/META-INF/saleinvoice.rest b/so/META-INF/saleinvoice.rest index 94b8e77..8e9487b 100644 --- a/so/META-INF/saleinvoice.rest +++ b/so/META-INF/saleinvoice.rest @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java b/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java index 13202d1..a1355de 100644 --- a/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java +++ b/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java @@ -60,7 +60,9 @@ public class SyncBipBillRuleForDelete implements IRule { appKey = bipParamMap.get("appKey"); appSecret = bipParamMap.get("appSecret"); toBipUrl = bipParamMap.get("updateInvoice"); - NCCForUAPLogger.debug(String.format("SyncBipBillRuleForDelete-baseUrl = [%s],appKey1 = [%s],appSecret = [%s],", + NCCForUAPLogger.debug(String.format("SyncBipBillRuleForDelete-baseUrl = [%s],appKey = [%s],appSecret = [%s],", + baseUrl, appKey, appSecret)); + Logger.error(String.format("SyncBipBillRuleForDelete-baseUrl = [%s],appKey = [%s],appSecret = [%s],", baseUrl, appKey, appSecret)); String access_token = getAccessToken(); for (SaleInvoiceVO invoiceVO : vos) { @@ -132,6 +134,7 @@ public class SyncBipBillRuleForDelete implements IRule { String signature = URLEncoder.encode(base64String, "UTF-8"); params.put("signature", signature); String responseString = doGet(baseUrl + tokenUrl, params); + Logger.error("SyncBipBillRuleForDelete-responseString = " + responseString); Gson gson = new Gson(); Map result = gson.fromJson(responseString, Map.class); if (StringUtils.equals("00000", result.getOrDefault("code", "") + "")) { diff --git a/so/src/public/nc/vo/so/m32/saleinvoice/operator/billSaveAction.java b/so/src/public/nccloud/api/so/saleinvoice/operator/BillSaveAction.java similarity index 68% rename from so/src/public/nc/vo/so/m32/saleinvoice/operator/billSaveAction.java rename to so/src/public/nccloud/api/so/saleinvoice/operator/BillSaveAction.java index 022b886..7b706c6 100644 --- a/so/src/public/nc/vo/so/m32/saleinvoice/operator/billSaveAction.java +++ b/so/src/public/nccloud/api/so/saleinvoice/operator/BillSaveAction.java @@ -1,4 +1,4 @@ -package nc.vo.so.m32.saleinvoice.operator; +package nccloud.api.so.saleinvoice.operator; import com.alibaba.fastjson.JSONObject; import nc.bs.framework.common.NCLocator; @@ -40,13 +40,14 @@ import java.util.List; * * @author lj * @date 2025/03/14 + * @update 20250415 mzr修改 */ @Path("so/saleinvoice/operator") -public class billSaveAction extends AbstractNCCRestResource { +public class BillSaveAction extends AbstractNCCRestResource { public static String fplxStr = "";// 开票申请发票类型 - public billSaveAction() { + public BillSaveAction() { } @@ -84,13 +85,14 @@ public class billSaveAction extends AbstractNCCRestResource { if (bject == null) { return ResultMessageUtil.exceptionToJSON(new NullPointerException("billhead:null")); } - String csaleinvoiceid = bject.getString("csaleinvoiceid"); // 销售发票id + // 销售发票id + String csaleinvoiceid = bject.getString("vdef40"); // 根据销售发票主实体id查询销售发票 String[] ids = {csaleinvoiceid}; SaleInvoiceVO[] saleInvoiceVOs = NCLocator.getInstance().lookup(ISaleinvoiceQueryAPI.class) .queryVOByIDs(ids); - if (saleInvoiceVOs.length <= 0) { - return ResultMessageUtil.exceptionToJSON(new NullPointerException("未查询到Erp对应的销售发票")); + if (saleInvoiceVOs == null || saleInvoiceVOs.length <= 0) { + return ResultMessageUtil.exceptionToJSON(new NullPointerException("未在系统中查询到对应的销售发票")); } try { // 调用函数根据原销售发票组装新红冲发票 @@ -109,7 +111,7 @@ public class billSaveAction extends AbstractNCCRestResource { context.setBillVos(returnSaveSaleInvoiceVOs); context.setActionName("APPROVE"); SaleInvoiceVO[] returnApproveSaleInvoiceVOs = (SaleInvoiceVO[]) flowService.exeScriptPFlow(context); - if (returnApproveSaleInvoiceVOs == null && returnApproveSaleInvoiceVOs.length <= 0) { + if (returnApproveSaleInvoiceVOs == null || returnApproveSaleInvoiceVOs.length <= 0) { throw new BusinessException("生成销售发票审核失败"); } /** @@ -144,8 +146,8 @@ public class billSaveAction extends AbstractNCCRestResource { Exception e = new Exception("接口调用失败"); return ResultMessageUtil.exceptionToJSON(e); } - } catch (BusinessException e) { - Logger.error("writeBack Error: ", e); + } catch (Exception e) { + Logger.error("billSaveRp-exp: ", e); return ResultMessageUtil.exceptionToJSON(e); } } @@ -153,17 +155,25 @@ public class billSaveAction extends AbstractNCCRestResource { /** * 构造红冲发票VO * - * @param originalSaleInvoiceVO + * @param originalVO * @param bject * @return * @throws Exception */ - public static SaleInvoiceVO makeNewRedRushSaleInvoice(SaleInvoiceVO originalSaleInvoiceVO, JSONObject bject) throws Exception { + public static SaleInvoiceVO makeNewRedRushSaleInvoice(SaleInvoiceVO originalVO, JSONObject bject) throws Exception { try { SaleInvoiceVO saleInvoiceVO = new SaleInvoiceVO(); - SaleInvoiceHVO saleInvoiceHVO = originalSaleInvoiceVO.getParentVO(); // 主实体 - SaleInvoiceBVO[] saleInvoiceBVOs = originalSaleInvoiceVO.getChildrenVO(); // 子实体 - SaleInvoiceHVO newSaleInvoiceHVO = new SaleInvoiceHVO(); // 新主实体 + // 发票主实体 + SaleInvoiceHVO saleInvoiceHVO = originalVO.getParentVO(); + // 发票子实体数组 + SaleInvoiceBVO[] saleInvoiceBVOs = originalVO.getChildrenVO(); + // 发票新主实体 + SaleInvoiceHVO newSaleInvoiceHVO = new SaleInvoiceHVO(); + + // 单据日期 + UFDate dbilldate = new UFDate(bject.getString("dbilldate")); + // 制单日期 + UFDate dmakedate = new UFDate(bject.getString("creationtime")); // 子实体属性赋值 UFDouble sumNum = new UFDouble(); // 合计数量 @@ -172,48 +182,48 @@ public class billSaveAction extends AbstractNCCRestResource { UFDouble sumNorigmny = new UFDouble(); // 合计无税金额 UFDouble sumNorigtaxmny = new UFDouble(); // 合计价税合计 int i = 0; - com.alibaba.fastjson.JSONArray paramsSaleInvoiceBVOsJSA = (com.alibaba.fastjson.JSONArray) bject.get("SaleInvoiceBVOs"); // 参数子实体数组 - List paramsSaleInvoiceBVOs = paramsSaleInvoiceBVOsJSA.toJavaList(JSONObject.class); - SaleInvoiceBVO[] newSaleInvoiceBVOs = new SaleInvoiceBVO[paramsSaleInvoiceBVOs.size()]; // 新子实体 + // 参数子实体数组 + com.alibaba.fastjson.JSONArray bvoJsonArr = (com.alibaba.fastjson.JSONArray) bject.get("csaleinvoicebid"); + List bvoList = bvoJsonArr.toJavaList(JSONObject.class); + SaleInvoiceBVO[] newSaleInvoiceBVOs = new SaleInvoiceBVO[bvoList.size()]; // 新子实体 for (SaleInvoiceBVO saleInvoiceBVO : saleInvoiceBVOs) { String csaleinvoicebid = saleInvoiceBVO.getCsaleinvoicebid(); // 子表id // 筛选参数红冲的子表集合 - List newParamsSaleInvoiceBVOs = paramsSaleInvoiceBVOs.stream().filter(item -> { - String parCsaleinvoicebid = item.getString("csaleinvoicebid") + ""; + List newBvoArr = bvoList.stream().filter(item -> { + String parCsaleinvoicebid = item.getString("vbdef15") + ""; // 子表id return csaleinvoicebid.equals(parCsaleinvoicebid); }).toList(); - if (newParamsSaleInvoiceBVOs.size() <= 0) { + if (newBvoArr.size() <= 0) { continue; } - JSONObject paramSaleInvoiceBVO = newParamsSaleInvoiceBVOs.get(0); // 参数子表 - SaleInvoiceBVO newSaleInvoiceBVO = new SaleInvoiceBVO(); -// BeanUtil.copyProperties(saleInvoiceBVO,newSaleInvoiceBVO); + JSONObject bipBvoJson = newBvoArr.get(0); // 参数子表 + SaleInvoiceBVO newInvBVO = new SaleInvoiceBVO(); // 克隆取值原子表销售发票 - newSaleInvoiceBVO = (SaleInvoiceBVO) CloneUtil.depthClone(saleInvoiceBVO); + newInvBVO = (SaleInvoiceBVO) CloneUtil.depthClone(saleInvoiceBVO); // 赋值之后修改子实体红冲时字段 - newSaleInvoiceBVO.setCsaleinvoicebid(null); // 发票子实体id - newSaleInvoiceBVO.setDbilldate(newSaleInvoiceHVO.getDbilldate()); // 开票日期 - newSaleInvoiceBVO.setNastnum(new UFDouble(paramSaleInvoiceBVO.getString("nastnum"))); // 数量 - newSaleInvoiceBVO.setNnum(new UFDouble(paramSaleInvoiceBVO.getString("nnum"))); // 主数量 - newSaleInvoiceBVO.setNtax(new UFDouble(paramSaleInvoiceBVO.getString("ntax"))); // 税额 - newSaleInvoiceBVO.setNmny(new UFDouble(paramSaleInvoiceBVO.getString("nmny"))); // 本币无税金额 - newSaleInvoiceBVO.setNtaxmny(new UFDouble(paramSaleInvoiceBVO.getString("ntaxmny"))); // 本币价税合计 - newSaleInvoiceBVO.setNcaltaxmny(new UFDouble(paramSaleInvoiceBVO.getString("ncaltaxmny"))); // 计税金额 - newSaleInvoiceBVO.setNorigmny(new UFDouble(paramSaleInvoiceBVO.getString("norigmny"))); // 无税金额 - newSaleInvoiceBVO.setNorigtaxmny(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny"))); // 价税合计 - newSaleInvoiceBVO.setCopposesrcbid(paramSaleInvoiceBVO.getString("csaleinvoicebid")); // 对冲来源子表id - newSaleInvoiceBVO.setNqtunitnum(null); // 报价数量 - newSaleInvoiceBVO.setCsaleinvoiceid(null); // 发票关联主表id - newSaleInvoiceBVO.setNtotalcostnum(null); // 累计成本结算数量 - newSaleInvoiceBVO.setNtotalincomemny(null); // 累计确认应收金额 - newSaleInvoiceBVO.setNtotalincomenum(null); // 累计确认应收数量 - newSaleInvoiceBVO.setVchangerate("1.00/1.00"); // 换算率 - newSaleInvoiceBVOs[i++] = newSaleInvoiceBVO; - sumNum = sumNum.add(new UFDouble(paramSaleInvoiceBVO.getString("nnum"))); - sumNtax = sumNtax.add(new UFDouble(paramSaleInvoiceBVO.getString("ntax"))); - sumNcaltaxmny = sumNcaltaxmny.add(new UFDouble(paramSaleInvoiceBVO.getString("ncaltaxmny"))); - sumNorigmny = sumNorigmny.add(new UFDouble(paramSaleInvoiceBVO.getString("norigmny"))); - sumNorigtaxmny = sumNorigtaxmny.add(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny"))); + newInvBVO.setCsaleinvoicebid(null); // 发票子实体id + newInvBVO.setDbilldate(dbilldate); // 开票日期 + newInvBVO.setNastnum(new UFDouble(bipBvoJson.getString("nastnum"))); // 数量 + newInvBVO.setNnum(new UFDouble(bipBvoJson.getString("nnum"))); // 主数量 + newInvBVO.setNtax(new UFDouble(bipBvoJson.getString("ntax"))); // 税额 + newInvBVO.setNmny(new UFDouble(bipBvoJson.getString("nmny"))); // 本币无税金额 + newInvBVO.setNtaxmny(new UFDouble(bipBvoJson.getString("ntaxmny"))); // 本币价税合计 + newInvBVO.setNcaltaxmny(new UFDouble(bipBvoJson.getString("ncaltaxmny"))); // 计税金额 + newInvBVO.setNorigmny(new UFDouble(bipBvoJson.getString("norigmny"))); // 无税金额 + newInvBVO.setNorigtaxmny(new UFDouble(bipBvoJson.getString("norigtaxmny"))); // 价税合计 + newInvBVO.setCopposesrcbid(bipBvoJson.getString("vbdef15")); // 对冲来源子表id + newInvBVO.setNqtunitnum(null); // 报价数量 + newInvBVO.setCsaleinvoiceid(null); // 发票关联主表id + newInvBVO.setNtotalcostnum(null); // 累计成本结算数量 + newInvBVO.setNtotalincomemny(null); // 累计确认应收金额 + newInvBVO.setNtotalincomenum(null); // 累计确认应收数量 + newInvBVO.setVchangerate("1.00/1.00"); // 换算率 + newSaleInvoiceBVOs[i++] = newInvBVO; + sumNum = sumNum.add(new UFDouble(bipBvoJson.getString("nnum"))); + sumNtax = sumNtax.add(new UFDouble(bipBvoJson.getString("ntax"))); + sumNcaltaxmny = sumNcaltaxmny.add(new UFDouble(bipBvoJson.getString("ncaltaxmny"))); + sumNorigmny = sumNorigmny.add(new UFDouble(bipBvoJson.getString("norigmny"))); + sumNorigtaxmny = sumNorigtaxmny.add(new UFDouble(bipBvoJson.getString("norigtaxmny"))); } // 克隆取值原子表销售发票 @@ -221,8 +231,8 @@ public class billSaveAction extends AbstractNCCRestResource { // 赋值之后修改主实体红冲时字段 newSaleInvoiceHVO.setCsaleinvoiceid(null); // 发票主实体id newSaleInvoiceHVO.setVbillcode(null); // 发票号 - newSaleInvoiceHVO.setDbilldate(new UFDate()); // 开票日期 - newSaleInvoiceHVO.setDmakedate(new UFDate()); // 制单日期 + newSaleInvoiceHVO.setDbilldate(dbilldate); // 开票日期 + newSaleInvoiceHVO.setDmakedate(dmakedate); // 制单日期 newSaleInvoiceHVO.setBsubunitflag(UFBoolean.TRUE); // 冲抵标记 newSaleInvoiceHVO.setFopposeflag(2); // 对冲标记 (2:对冲生成) newSaleInvoiceHVO.setFstatusflag(1); // 单据状态 (1:自由态) @@ -246,16 +256,16 @@ public class billSaveAction extends AbstractNCCRestResource { /** * 构造红冲开票申请VO * - * @param ivApplicationHeadVO 原开票申请主实体 + * @param applyHeadVO 原开票申请主实体 * @param ivApplicationBodyVOS 原开票申请子实体 * @param bject bip参数 * @param returnApproveSaleInvoiceVOs 新生成的红冲销售发票实体 * @return * @throws Exception */ - public static IVApplicationAggVO makeNewRedRushIVApplicationAggVO(IVApplicationHeadVO ivApplicationHeadVO, IVApplicationBodyVO[] ivApplicationBodyVOS, JSONObject bject, SaleInvoiceVO[] returnApproveSaleInvoiceVOs) throws Exception { + public static IVApplicationAggVO makeNewRedRushIVApplicationAggVO(IVApplicationHeadVO applyHeadVO, IVApplicationBodyVO[] ivApplicationBodyVOS, JSONObject bject, SaleInvoiceVO[] returnApproveSaleInvoiceVOs) throws Exception { try { - IVApplicationAggVO ivApplicationAggVO = new IVApplicationAggVO(); + IVApplicationAggVO applicationAggVO = new IVApplicationAggVO(); IVApplicationHeadVO newivApplicationHeadVO = new IVApplicationHeadVO(); // 新主实体 // 取新生成红冲发票的主实体数据 @@ -266,13 +276,12 @@ public class billSaveAction extends AbstractNCCRestResource { SaleInvoiceHVO rpSaleInvoiceHVO = rpSaleInvoiceVOs[0].getParentVO(); // 主实体属性赋值 -// BeanUtil.copyProperties(ivApplicationHeadVO,newivApplicationHeadVO, CopyOptions.create().setIgnoreNullValue(true)); // 克隆取值原子表开票申请 - newivApplicationHeadVO = (IVApplicationHeadVO) CloneUtil.depthClone(ivApplicationHeadVO); + newivApplicationHeadVO = (IVApplicationHeadVO) CloneUtil.depthClone(applyHeadVO); // 根据参数判断是否为部分红冲 boolean isPartHCFlag = false; UFDouble paramNtotalorigmny = new UFDouble(bject.getString("ntotalorigmny")); // 参数价税合计(主表红冲金额) - UFDouble ntotalorigmny = ivApplicationHeadVO.getJshj(); // 原开票申请主表价税合计 + UFDouble ntotalorigmny = applyHeadVO.getJshj(); // 原开票申请主表价税合计 // 红冲金额与开票申请源价税合计比较如果和值大于零,则为部分红冲 if (ntotalorigmny.add(paramNtotalorigmny).compareTo(UFDouble.ZERO_DBL) > 0) { isPartHCFlag = true; @@ -284,20 +293,21 @@ public class billSaveAction extends AbstractNCCRestResource { UFDouble sumSe = new UFDouble(); // 合计税额 // 子实体属性赋值 int i = 0; - com.alibaba.fastjson.JSONArray paramsSaleInvoiceBVOsJSA = (com.alibaba.fastjson.JSONArray) bject.get("SaleInvoiceBVOs"); // 参数子实体数组 - List paramsSaleInvoiceBVOs = paramsSaleInvoiceBVOsJSA.toJavaList(JSONObject.class); - IVApplicationBodyVO[] newivApplicationBodyVOS = new IVApplicationBodyVO[paramsSaleInvoiceBVOs.size()]; // 新子实体 + // 参数子实体数组 + com.alibaba.fastjson.JSONArray bvoJsonArr = (com.alibaba.fastjson.JSONArray) bject.get("csaleinvoicebid"); + List bvoList = bvoJsonArr.toJavaList(JSONObject.class); + IVApplicationBodyVO[] newivApplicationBodyVOS = new IVApplicationBodyVO[bvoList.size()]; // 新子实体 for (IVApplicationBodyVO ivApplicationBodyVO : ivApplicationBodyVOS) { String src_pkdetail = ivApplicationBodyVO.getSrc_pkdetail(); // 来源单据行id // 筛选参数红冲的子表集合 - List newParamsSaleInvoiceBVOs = paramsSaleInvoiceBVOs.stream().filter(item -> { - String parCsaleinvoicebid = item.getString("csaleinvoicebid") + ""; + List newBvoArr = bvoList.stream().filter(item -> { + String parCsaleinvoicebid = item.getString("vbdef15") + ""; // 子表id return src_pkdetail.equals(parCsaleinvoicebid); }).toList(); - if (newParamsSaleInvoiceBVOs.size() <= 0) { + if (newBvoArr.size() <= 0) { continue; } - JSONObject paramSaleInvoiceBVO = newParamsSaleInvoiceBVOs.get(0); // 参数子表 + JSONObject bipBvoJson = newBvoArr.get(0); // 参数子表 IVApplicationBodyVO newivApplicationBodyVO = new IVApplicationBodyVO(); // BeanUtil.copyProperties(ivApplicationBodyVO,newivApplicationBodyVO, CopyOptions.create().setIgnoreNullValue(true)); // 克隆取值原子表开票申请 @@ -305,22 +315,23 @@ public class billSaveAction extends AbstractNCCRestResource { // 赋值之后修改子实体红冲时字段 newivApplicationBodyVO.setPk_ivappdetail(null); // 开票申请子实体id newivApplicationBodyVO.setBillno(null); // 开票申请子实体单据号 - newivApplicationBodyVO.setSe(new UFDouble(paramSaleInvoiceBVO.getString("ntax"))); // 税额 - newivApplicationBodyVO.setXmsl(new UFDouble(paramSaleInvoiceBVO.getString("nnum"))); // 数量 - newivApplicationBodyVO.setXmje(new UFDouble(paramSaleInvoiceBVO.getString("norigmny"))); // 金额 - newivApplicationBodyVO.setXmjshj(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny"))); // 价税合计 - newivApplicationBodyVO.setBchcje(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny")).multiply(new UFDouble(-1))); // 本次红冲金额 = 本次参数红冲金额 + newivApplicationBodyVO.setSe(new UFDouble(bipBvoJson.getString("ntax"))); // 税额 + newivApplicationBodyVO.setXmsl(new UFDouble(bipBvoJson.getString("nnum"))); // 数量 + newivApplicationBodyVO.setXmje(new UFDouble(bipBvoJson.getString("norigmny"))); // 金额 + newivApplicationBodyVO.setXmjshj(new UFDouble(bipBvoJson.getString("norigtaxmny"))); // 价税合计 + // 本次红冲金额 = 本次参数红冲金额 + newivApplicationBodyVO.setBchcje(new UFDouble(bipBvoJson.getString("norigtaxmny")).multiply(new UFDouble(-1))); newivApplicationBodyVOS[i++] = newivApplicationBodyVO; - sumSe = sumSe.add(new UFDouble(paramSaleInvoiceBVO.getString("ntax"))); - sumXmsl = sumXmsl.add(new UFDouble(paramSaleInvoiceBVO.getString("nnum"))); - sumXmje = sumXmje.add(new UFDouble(paramSaleInvoiceBVO.getString("norigmny"))); - sumXmjshj = sumXmjshj.add(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny"))); - sumBchcje = sumBchcje.add(new UFDouble(paramSaleInvoiceBVO.getString("norigtaxmny")).multiply(new UFDouble(-1))); + sumSe = sumSe.add(new UFDouble(bipBvoJson.getString("ntax"))); + sumXmsl = sumXmsl.add(new UFDouble(bipBvoJson.getString("nnum"))); + sumXmje = sumXmje.add(new UFDouble(bipBvoJson.getString("norigmny"))); + sumXmjshj = sumXmjshj.add(new UFDouble(bipBvoJson.getString("norigtaxmny"))); + sumBchcje = sumBchcje.add(new UFDouble(bipBvoJson.getString("norigtaxmny")).multiply(new UFDouble(-1))); } // 赋值之后修改主实体红冲时字段 newivApplicationHeadVO.setPk_ivapplication(null); // 开票申请单主实体id newivApplicationHeadVO.setBillno(null); // 单据号 - newivApplicationHeadVO.setPreparedate(new UFDate()); // 单据日期 + newivApplicationHeadVO.setPreparedate(new UFDate(bject.getString("dbilldate"))); // 单据日期 newivApplicationHeadVO.setJshj(sumXmjshj); // 价税合计 newivApplicationHeadVO.setHjje(sumXmje); // 合计金额 newivApplicationHeadVO.setHjse(sumSe); // 合计税额 @@ -334,9 +345,9 @@ public class billSaveAction extends AbstractNCCRestResource { newivApplicationHeadVO.setHcyy("2"); // 红冲原因:2(开票有误) // 组装VO - ivApplicationAggVO.setParentVO(newivApplicationHeadVO); - ivApplicationAggVO.setChildrenVO(newivApplicationBodyVOS); - return ivApplicationAggVO; + applicationAggVO.setParentVO(newivApplicationHeadVO); + applicationAggVO.setChildrenVO(newivApplicationBodyVOS); + return applicationAggVO; } catch (Exception e) { throw new BusinessException(e.getMessage()); } diff --git a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java index 76848f3..024f16d 100644 --- a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java +++ b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java @@ -195,10 +195,13 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { mapInit(original); AggBomVO agg = aggInit(paramMap); - //2025年4月11日14点35分 --重新赋值上制单人创建人 --start + //2025年4月11日14点35分 --重新赋值上制单人创建人+默认 --start agg.getParentVO().setAttributeValue("billmaker", original.getParent().getAttributeValue("billmaker")); agg.getParentVO().setAttributeValue("creator", original.getParent().getAttributeValue("creator")); - //2025年4月11日14点35分 --重新赋值上制单人创建人 --end + if(bom.get("hbdefault")==null){ + agg.getParentVO().setAttributeValue("hbdefault", original.getParent().getAttributeValue("hbdefault")); + } + //2025年4月11日14点35分 --重新赋值上制单人创建人+默认 --end JSONString checkInfo = requiredCheck(agg); if (checkInfo != null) { return checkInfo; @@ -645,7 +648,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype()) && !head.getCbomid().equals(headvo.getCbomid())) { //sdlizheng --添加独立判断--plm三方越过此校验 - if ("plm".equals(userCode)) { + if ("plm".equals(userCode)||"dlkght".equals(userCode)) { // AggBomVO afterVO = service.canceldefault(aggBomVO); } else { return UFBoolean.TRUE; @@ -699,7 +702,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1)); agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1)); agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1)); - if ("plm".equals(userCode)) { + if ("plm".equals(userCode)||"dlkght".equals(userCode)) { //sdlizheng 1、对于之前不存在的BOM,新增时:如果是传自由态,不默认且无效,走标准逻辑,如果传的是审批态默认且有效。2025年4月11日16点28分 start if (fbillstatus != null && "1".equals(fbillstatus.toString())) { agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));