From 6e3183ee67b875aa086311a2931de407230a9d74 Mon Sep 17 00:00:00 2001 From: mzr Date: Thu, 24 Apr 2025 10:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/so/m30/APISaleOrderMaitainImpl.java | 354 +++++++++++------- 1 file changed, 228 insertions(+), 126 deletions(-) diff --git a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java index ff14922..040b9a1 100644 --- a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java +++ b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java @@ -6,7 +6,6 @@ import nc.bs.dao.DAOException; import nc.bs.framework.common.NCLocator; import nc.bs.trade.business.HYSuperDMO; import nc.impl.pubapp.pattern.data.bill.BillQuery; -import nc.itf.fi.pub.Currency; import nc.itf.scmpub.reference.uap.bd.customer.CustomerPubService; import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil; import nc.itf.so.m30.self.ISaleOrderMaintain; @@ -159,7 +158,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { childrenVO.setFtaxtypeflag(1); UFDouble nexchangerate = getUFDouble_NullAsOne(childrenVO.getNexchangerate()); childrenVO.setNexchangerate(nexchangerate); - // 处理单价(4位)和金额(2位) + // 处理数量、单价(4位)和金额(2位) // 含税单价 UFDouble nqtorigtaxprice = childrenVO.getNqtorigtaxprice(); nqtorigtaxprice = nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP); @@ -186,7 +185,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { childrenVO.setNorigprice(norigprice); // 主含税净价 UFDouble norigtaxnetprice = childrenVO.getNorigtaxnetprice(); - norigprice = norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + norigtaxnetprice = norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); childrenVO.setNorigtaxnetprice(norigtaxnetprice); // 主无税净价 UFDouble norignetprice = childrenVO.getNorignetprice(); @@ -247,7 +246,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { childrenVO.setNnetprice(nnetprice); Map goodsMap = getMaterlInfo(childrenVO.getCmaterialid()); String measrate = "1/1"; - if (goodsMap != null && StringUtils.isEmpty(goodsMap.getOrDefault("measrate","") + "")) { + if (goodsMap != null && StringUtils.isEmpty(goodsMap.getOrDefault("measrate", "") + "")) { measrate = goodsMap.get("measrate") + ""; } childrenVO.setVchangerate(measrate);// 换算率 @@ -518,7 +517,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { } } - private void updateFields(SaleOrderVO target, SaleOrderVO source) { + private void updateFields(SaleOrderVO target, SaleOrderVO source) throws BusinessException { // 更新 SaleOrderHVO 字段 SaleOrderHVO targetHVO = target.getParentVO(); SaleOrderHVO sourceHVO = source.getParentVO(); @@ -569,25 +568,122 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { if (sourceBVO != null) { int status = targetBVO.getStatus(); if (VOStatus.UPDATED == status) { - // 数量 - UFDouble nnum = sourceBVO.getNnum(); - targetBVO.setNnum(nnum); - targetBVO.setNastnum(nnum); - // targetBVO.setNqtunitnum(nnum); - // 价税合计 - targetBVO.setNorigtaxmny(sourceBVO.getNorigtaxmny()); - targetBVO.setCmaterialvid(sourceBVO.getCmaterialvid()); // 是否赠品 targetBVO.setBlargessflag(sourceBVO.getBlargessflag()); // 折本汇率 UFDouble nexchangerate = getUFDouble_NullAsOne(sourceBVO.getNexchangerate()); targetBVO.setNexchangerate(nexchangerate); // 物料编码 + targetBVO.setCmaterialvid(sourceBVO.getCmaterialvid()); String cmaterialvid = sourceBVO.getCmaterialvid(); // 物料关联字段赋值 if (cmaterialvid != null && !cmaterialvid.isEmpty()) { setMaterl(targetBVO); } + // 处理数量、单价(4位)和金额(2位) + // 含税单价 + UFDouble nqtorigtaxprice = sourceBVO.getNqtorigtaxprice(); + nqtorigtaxprice = nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtorigtaxprice(nqtorigtaxprice); + // 无税单价 + UFDouble nqtorigprice = sourceBVO.getNqtorigprice(); + nqtorigprice = nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtorigprice(nqtorigprice); + // 含税净价 + UFDouble nqtorigtaxnetprc = sourceBVO.getNqtorigtaxnetprc(); + nqtorigtaxnetprc = nqtorigtaxnetprc.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtorigtaxnetprc(nqtorigtaxnetprc); + // 无税净价 + UFDouble nqtorignetprice = sourceBVO.getNqtorignetprice(); + nqtorignetprice = nqtorignetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtorignetprice(nqtorignetprice); + // 主含税单价 + UFDouble norigtaxprice = sourceBVO.getNorigtaxprice(); + norigtaxprice = norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNorigtaxprice(norigtaxprice); + // 主无税单价 + UFDouble norigprice = sourceBVO.getNorigprice(); + norigprice = norigprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNorigprice(norigprice); + // 主含税净价 + UFDouble norigtaxnetprice = sourceBVO.getNorigtaxnetprice(); + norigtaxnetprice = norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNorigtaxnetprice(norigtaxnetprice); + // 主无税净价 + UFDouble norignetprice = sourceBVO.getNorignetprice(); + norignetprice = norignetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNorignetprice(norignetprice); + // 本币无税金额 + UFDouble nmny = sourceBVO.getNmny(); + nmny = nmny.setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNmny(nmny); + targetBVO.setNcaltaxmny(nmny);// 计税金额 + // 本币价税合计 + UFDouble ntaxmny = sourceBVO.getNtaxmny(); + ntaxmny = ntaxmny.setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNtaxmny(ntaxmny); + // 税额 + UFDouble ntax = sourceBVO.getNtax(); + ntax = ntax.setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNtax(ntax); + // 无税金额 + UFDouble norigmny = sourceBVO.getNorigmny(); + norigmny = norigmny.setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNorigmny(norigmny); + // 价税合计 + UFDouble norigtaxmny = sourceBVO.getNorigtaxmny(); + norigtaxmny = norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNorigtaxmny(norigtaxmny); + // 本币含税单价 + UFDouble nqttaxprice = sourceBVO.getNqttaxprice(); + nqttaxprice = nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqttaxprice(nqttaxprice); + // 本币无税单价 + UFDouble nqtprice = sourceBVO.getNqtprice(); + nqtprice = nqtprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtprice(nqtprice); + // 本币含税净价 + UFDouble nqttaxnetprice = sourceBVO.getNqttaxnetprice(); + nqttaxnetprice = nqttaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqttaxnetprice(nqttaxnetprice); + // 本币无税净价 + UFDouble nqtnetprice = sourceBVO.getNqtnetprice(); + nqtnetprice = nqtnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNqtnetprice(nqtnetprice); + // 主本币含税单价 + UFDouble ntaxprice = sourceBVO.getNtaxprice(); + ntaxprice = ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNtaxprice(ntaxprice); + // 主本币无税单价 + UFDouble nprice = sourceBVO.getNprice(); + nprice = nprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNprice(nprice); + // 主本币含税净价 + UFDouble ntaxnetprice = sourceBVO.getNtaxnetprice(); + ntaxnetprice = ntaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNtaxnetprice(ntaxnetprice); + // 主本币无税净价 + UFDouble nnetprice = sourceBVO.getNnetprice(); + nnetprice = nnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + targetBVO.setNnetprice(nnetprice); + String measrate = "1/1"; + if (StringUtils.isNotEmpty(targetBVO.getVchangerate())) { + measrate = targetBVO.getVchangerate(); + } + // targetBVO.setVchangerate(measrate);// 换算率 + // targetBVO.setVqtunitrate(measrate);// 报价换算率 + UFDouble[] measrateNums = HslParseUtil.parseHsl(measrate); + UFDouble measrateNum = UFDouble.ONE_DBL; + if (null != measrateNums && measrateNums.length != 0) { + measrateNum = measrateNums[0].div(measrateNums[1]).setScale(2, 4); + } + // 主数量 + UFDouble nnum = sourceBVO.getNnum().setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNnum(nnum); + UFDouble nastnum = nnum.multiply(measrateNum).setScale(2, UFDouble.ROUND_HALF_UP); + targetBVO.setNastnum(nastnum);// 数量 + targetBVO.setNqtunitnum(nastnum);// 报价单位数量 + // 自定义项赋值 String vbdef1 = sourceBVO.getVbdef1();// 合同编号 Map defList = getDefList("zdy-001"); @@ -820,7 +916,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { */ private void setMaterl(SaleOrderBVO bVO) { String cmaterialvid = bVO.getCmaterialvid(); - UFDouble nnum = bVO.getNnum(); + // UFDouble nnum = bVO.getNnum(); UFDouble ntaxrate = bVO.getNtaxrate(); try { String sql = " select a.pk_material,a.pk_source, a.pk_measdoc cunitid,nvl(b.pk_measdoc,a.pk_measdoc) castunitid,nvl(b.measrate,'1/1') measrate " @@ -830,8 +926,8 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { if (map == null) { throw new BusinessException(cmaterialvid + "物料未查到"); } - NCCForUAPLogger.debug(String.format("setMaterl: cqtunitid = [%S], cunitid = [%S], castunitid = [%S]", - map.get("cqtunitid"), map.get("cunitid"), map.get("castunitid"))); + // NCCForUAPLogger.debug(String.format("setMaterl: cqtunitid = [%S], cunitid = [%S], castunitid = [%S]", + // map.get("cqtunitid"), map.get("cunitid"), map.get("castunitid"))); bVO.setAttributeValue("castunitid", map.get("castunitid")); bVO.setAttributeValue("vchangerate", map.get("vchangerate")); @@ -841,13 +937,15 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { bVO.setAttributeValue("cmaterialid", map.get("pk_material")); bVO.setAttributeValue("cmaterialvid", map.get("pk_material")); + bVO.setVchangerate(map.get("measrate") + "");// 换算率 + bVO.setVqtunitrate(map.get("measrate") + "");// 报价换算率 - UFDouble nqtunitnum = BFPubTools.getUFDouble_NullAsZero(nnum) - .div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])); - bVO.setAttributeValue("nqtunitnum", nqtunitnum); + // UFDouble nqtunitnum = BFPubTools.getUFDouble_NullAsZero(nnum) + // .div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])); + // bVO.setAttributeValue("nqtunitnum", nqtunitnum); sql = "select sl.pk_taxcode from bd_taxrate sl inner join bd_taxcode sm on sl.pk_taxcode=sm.pk_taxcode where sl.taxrate=" - + ntaxrate + " and sm.pk_group<>'~' " + ""; + + ntaxrate + " and sm.pk_group<>'~' "; String o_pk_project = (String) new BaseDAO().executeQuery(sql, new ColumnProcessor()); // 税码 @@ -860,6 +958,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { /** * 获取物料的信息 + * * @param pk_material * @return * @throws BusinessException @@ -904,11 +1003,8 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { for (Object body : bodyArr) { Map bodydata = (Map) body; if ("add".equals(bodydata.get("status"))) { - String pkOrgV = hvo.getPk_org_v(); - String pkOrg = hvo.getPk_org(); String pk_group = AppContext.getInstance().getPkGroup(); // 新数据的实体 - // SaleOrderBVO newBvo = (SaleOrderBVO) bvos[0].clone(); SaleOrderBVO newBvo = new SaleOrderBVO(); newBvo.setStatus(VOStatus.NEW); newBvo.setAttributeValue("pk_group", pk_group); @@ -921,128 +1017,134 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { cprojectid = (String) new BaseDAO().executeQuery(sql, new ColumnProcessor()); } newBvo.setAttributeValue("cprojectid", cprojectid); - // newBvo.setAttributeValue("ctrafficorgvid", pkOrg); - // newBvo.setAttributeValue("csendstockorgvid", pkOrg); - // newBvo.setAttributeValue("csendstordocid", pkOrg); - // newBvo.setAttributeValue("csendstockorgid", pkOrg); - // newBvo.setAttributeValue("carorgid", pkOrg); - // newBvo.setAttributeValue("carorgvid", pkOrg); - // newBvo.setAttributeValue("csettleorgid", pkOrg); - // newBvo.setAttributeValue("csettleorgvid", pkOrg); newBvo.setAttributeValue("ctaxcountryid", "CN"); newBvo.setAttributeValue("crececountryid", "CN"); newBvo.setAttributeValue("csendcountryid", "CN"); newBvo.setAttributeValue("fbuysellflag", 1); + // 折本汇率 UFDouble nexchangerateBip = getUFDouble_NullAsOne(bodydata.get("nexchangerate")); newBvo.setNexchangerate(nexchangerateBip); // 设置物料的关联字段的值 newBvo.setCmaterialvid(bodydata.get("cmaterialvid") + ""); UFDouble ntaxrate = BFPubTools.getUFDouble_NullAsZero(bodydata.get("ntaxrate")); - UFDouble nnum = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum")); newBvo.setAttributeValue("ntaxrate", ntaxrate); - newBvo.setAttributeValue("nnum", nnum); newBvo.setVbdef11(bodydata.getOrDefault("vbdef11", "") + ""); - - UFDouble norigtaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("norigtaxprice")); - newBvo.setAttributeValue("norigtaxprice", norigtaxprice); - UFDouble norigprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("norigprice")); - newBvo.setAttributeValue("norigprice", norigprice); - setMaterl(newBvo); newBvo.setCsaleorderbid(null); - newBvo.setCcurrencyid(ybpk); - String zbbz = newBvo.getCcurrencyid(); - newBvo.setFtaxtypeflag(1); - - // 折本汇率 - UFDouble nexchangerate = newBvo.getNexchangerate(); - // 含税单价 - UFDouble nqtorigtaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); - newBvo.setAttributeValue("nqtorigtaxprice", nqtorigtaxprice); - // 无税单价 - UFDouble nqtorigprice = nqtorigtaxprice.div(UFDouble.ONE_DBL.add(ntaxrate.div(100))); - // 价税合计 - UFDouble norigtaxmny = nqtorigtaxprice.multiply(newBvo.getNqtunitnum()).setScale(2, 4); - newBvo.setNorigtaxmny(norigtaxmny); - // 无税金额 - UFDouble norigmny = nqtorigprice.multiply(newBvo.getNqtunitnum()); - - newBvo.setNorigmny(nc.itf.fi.pub.Currency.getFormaUfValue(ybpk, norigmny)); - // 税额 - newBvo.setNqtorigprice(nqtorigprice.setScale(4, 4)); - - // 无税本币金额单价 - UFDouble taxspric = nqtorigtaxprice.div(UFDouble.ONE_DBL.add(ntaxrate.div(100))); - - nqtorigprice = nqtorigprice.setScale(4, 4); - // nqtorigtaxnetprc--含税净价 - newBvo.setNqtorigtaxnetprc(nqtorigtaxprice); - // ,nqtorignetprice --无税净价 - newBvo.setNqtorignetprice(nqtorigprice); - String Vqtunitrate = newBvo.getVqtunitrate(); - UFDouble dVqtunitrate = UFDouble.ONE_DBL; - if (Vqtunitrate != null) { - dVqtunitrate = BFPubTools.getUFDouble_NullAsZero(Vqtunitrate.split("/")[0]); - } - // ,norigtaxprice --主含税单价 - - UFDouble wsje = taxspric.multiply(nexchangerate).multiply(newBvo.getNqtunitnum()); - if (ybpk.equals(zbbz) && BFPubTools.getString_TrimAsNull(newBvo.getCqtunitid()) - .equals(BFPubTools.getString_TrimAsNull(newBvo.getCastunitid()))) { - wsje = taxspric.multiply(nexchangerate).multiply(newBvo.getNqtunitnum()); - } - - wsje = nc.itf.fi.pub.Currency.getFormaUfValue(zbbz, wsje); - // 本币无税金额 - newBvo.setNorigtaxprice(nqtorigtaxprice.div(dVqtunitrate).setScale(4, 4)); - // ,norigprice --主无税单价 - newBvo.setNorigprice(nqtorigprice.div(dVqtunitrate).setScale(4, 4)); - // ,norigtaxnetprice --主含税净价 - newBvo.setNorigtaxnetprice(newBvo.getNorigtaxprice()); - // ,norignetprice --主无税净价 - newBvo.setNorignetprice(newBvo.getNorigprice()); - // ncaltaxmny --计税金额 - - // ,nqttaxprice --本币含税单价 - newBvo.setNqttaxprice(nqtorigtaxprice.multiply(nexchangerate)); - // ,nqtprice --本币无税单价 - UFDouble bbwsd = nqtorigtaxprice.div(UFDouble.ONE_DBL.add(ntaxrate.div(100))) - .multiply(nexchangerate); - newBvo.setNqtprice(bbwsd.setScale(4, 4)); - // , nqttaxnetprice --本币含税净价 - newBvo.setNqttaxnetprice(nqtorigtaxprice.multiply(nexchangerate)); - // ,nqtnetprice --本币无税净价 - UFDouble Nqtnetprice = nqtorigtaxprice.div(UFDouble.ONE_DBL.add(ntaxrate.div(100))) - .multiply(nexchangerate); - newBvo.setNqtnetprice(Nqtnetprice.setScale(4, 4)); - // ,ntaxprice --主本币含税单价 , nprice --主本币无税单价 - newBvo.setNtaxprice(nqtorigtaxprice.div(dVqtunitrate).multiply(nexchangerate).setScale(4, 4)); - UFDouble Nprice = nqtorigtaxprice.div(dVqtunitrate).div(UFDouble.ONE_DBL.add(ntaxrate.div(100))) - .multiply(nexchangerate); - newBvo.setNprice(Nprice.setScale(4, 4)); - // ,ntaxnetprice --主本币含税净价 - newBvo.setNtaxnetprice( - nqtorigtaxprice.div(dVqtunitrate).multiply(nexchangerate).setScale(4, 4)); - // ,nnetprice --主本币无税净价 - UFDouble nnetprice = nqtorigtaxprice.div(UFDouble.ONE_DBL.add(ntaxrate.div(100))) - .div(dVqtunitrate); - nnetprice = nnetprice.multiply(nexchangerate).setScale(4, 4); - newBvo.setNnetprice(nnetprice); - // nmny --本币无税金额 - // ntaxmny-- 本币价税合计 - newBvo.setNmny(Currency.getFormaUfValue(zbbz, norigmny.multiply(nexchangerate))); - newBvo.setNtaxmny(nqtorigtaxprice.multiply(nexchangerate).multiply(newBvo.getNqtunitnum()) - .setScale(2, 4)); - newBvo.setNcaltaxmny(wsje); - UFDouble ntax = norigtaxmny.multiply(nexchangerate).sub(wsje); - newBvo.setNtax(ntax.setScale(2, 4)); + // 行号 newBvo.setCrowno(bodydata.get("crowno") + ""); // 是否赠品 String blargessflag = bodydata.getOrDefault("blargessflag", "N") + ""; newBvo.setBlargessflag(UFBoolean.valueOf(blargessflag)); + + setMaterl(newBvo); + + // 处理数量、单价(4位)和金额(2位) + // 含税单价 + UFDouble nqtorigtaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtorigtaxprice = nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtorigtaxprice(nqtorigtaxprice); + // 无税单价 + UFDouble nqtorigprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtorigprice = nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtorigprice(nqtorigprice); + // 含税净价 + UFDouble nqtorigtaxnetprc = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtorigtaxnetprc = nqtorigtaxnetprc.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtorigtaxnetprc(nqtorigtaxnetprc); + // 无税净价 + UFDouble nqtorignetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtorignetprice = nqtorignetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtorignetprice(nqtorignetprice); + // 主含税单价 + UFDouble norigtaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norigtaxprice = norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNorigtaxprice(norigtaxprice); + // 主无税单价 + UFDouble norigprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norigprice = norigprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNorigprice(norigprice); + // 主含税净价 + UFDouble norigtaxnetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norigprice = norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNorigtaxnetprice(norigtaxnetprice); + // 主无税净价 + UFDouble norignetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norignetprice = norignetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNorignetprice(norignetprice); + // 本币无税金额 + UFDouble nmny = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nmny = nmny.setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNmny(nmny); + newBvo.setNcaltaxmny(nmny);// 计税金额 + // 本币价税合计 + UFDouble ntaxmny = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + ntaxmny = ntaxmny.setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNtaxmny(ntaxmny); + // 税额 + UFDouble ntax = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + ntax = ntax.setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNtax(ntax); + // 无税金额 + UFDouble norigmny = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norigmny = norigmny.setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNorigmny(norigmny); + // 价税合计 + UFDouble norigtaxmny = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + norigtaxmny = norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNorigtaxmny(norigtaxmny); + // 本币含税单价 + UFDouble nqttaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqttaxprice = nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqttaxprice(nqttaxprice); + // 本币无税单价 + UFDouble nqtprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtprice = nqtprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtprice(nqtprice); + // 本币含税净价 + UFDouble nqttaxnetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqttaxnetprice = nqttaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqttaxnetprice(nqttaxnetprice); + // 本币无税净价 + UFDouble nqtnetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nqtnetprice = nqtnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNqtnetprice(nqtnetprice); + // 主本币含税单价 + UFDouble ntaxprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + ntaxprice = ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNtaxprice(ntaxprice); + // 主本币无税单价 + UFDouble nprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nprice = nprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNprice(nprice); + // 主本币含税净价 + UFDouble ntaxnetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + ntaxnetprice = ntaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNtaxnetprice(ntaxnetprice); + // 主本币无税净价 + UFDouble nnetprice = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nqtorigtaxprice")); + nnetprice = nnetprice.setScale(4, UFDouble.ROUND_HALF_UP); + newBvo.setNnetprice(nnetprice); + String measrate = "1/1"; + if (StringUtils.isNotEmpty(newBvo.getVchangerate())) { + measrate = newBvo.getVchangerate(); + } + // newBvo.setVchangerate(measrate);// 换算率 + // newBvo.setVqtunitrate(measrate);// 报价换算率 + UFDouble[] measrateNums = HslParseUtil.parseHsl(measrate); + UFDouble measrateNum = UFDouble.ONE_DBL; + if (null != measrateNums && measrateNums.length != 0) { + measrateNum = measrateNums[0].div(measrateNums[1]).setScale(2, 4); + } + // 主数量 + UFDouble nnum = BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum")).setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNnum(nnum); + UFDouble nastnum = nnum.multiply(measrateNum).setScale(2, UFDouble.ROUND_HALF_UP); + newBvo.setNastnum(nastnum);// 数量 + newBvo.setNqtunitnum(nastnum);// 报价单位数量 bvoList.add(newBvo); } } @@ -1052,7 +1154,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { } // 填充默认值 - new SaleOrderSaveFillValue().setDefValue(copyVOs); + new SaleOrderSaveFillValue().setDefValue1(copyVOs); Map> listMap = new HashMap<>(); for (SaleOrderVO copyVO : copyVOs) { List newBvoList = new ArrayList<>();