销售订单和销售发票保存接口-单价金额等字段取值调整
This commit is contained in:
		
							parent
							
								
									9169a5cb9a
								
							
						
					
					
						commit
						399bc55d04
					
				|  | @ -11,6 +11,7 @@ import nc.itf.scmpub.reference.uap.bd.customer.CustomerPubService; | |||
| import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil; | ||||
| import nc.itf.so.m30.self.ISaleOrderMaintain; | ||||
| import nc.itf.so.m30.self.ISaleOrderScriptMaintain; | ||||
| import nc.itf.uap.IUAPQueryBS; | ||||
| import nc.itf.uap.pf.IPFBusiAction; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.jdbc.framework.processor.MapProcessor; | ||||
|  | @ -25,6 +26,7 @@ import nc.vo.pub.lang.UFBoolean; | |||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.AppContext; | ||||
| import nc.vo.pubapp.calculator.HslParseUtil; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule; | ||||
| import nc.vo.scmpub.fill.pricemny.INumPriceMnyCalculator; | ||||
|  | @ -44,6 +46,7 @@ import nccloud.api.impl.so.m30.fill.SaleOrderNPriceMnyCal; | |||
| import nccloud.api.impl.so.m30.fill.SaleOrderSaveFillValue; | ||||
| import nccloud.api.so.m30.IAPISaleOrderMaitain; | ||||
| import nccloud.baseapp.core.log.NCCForUAPLogger; | ||||
| import nccloud.commons.lang.StringUtils; | ||||
| import nccloud.openapi.scmpub.pub.TransferCodeToPKTool; | ||||
| import nccloud.openapi.scmpub.pub.TransferMapToVOTool; | ||||
| import nccloud.putitf.riart.billtype.IBilltypeService; | ||||
|  | @ -193,6 +196,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { | |||
|             UFDouble nmny = childrenVO.getNmny(); | ||||
|             nmny = nmny.setScale(2, UFDouble.ROUND_HALF_UP); | ||||
|             childrenVO.setNmny(nmny); | ||||
|             childrenVO.setNcaltaxmny(nmny);// 计税金额 | ||||
|             // 本币价税合计 | ||||
|             UFDouble ntaxmny = childrenVO.getNtaxmny(); | ||||
|             ntaxmny = ntaxmny.setScale(2, UFDouble.ROUND_HALF_UP); | ||||
|  | @ -241,9 +245,25 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { | |||
|             UFDouble nnetprice = childrenVO.getNnetprice(); | ||||
|             nnetprice = nnetprice.setScale(4, UFDouble.ROUND_HALF_UP); | ||||
|             childrenVO.setNnetprice(nnetprice); | ||||
| 
 | ||||
|             UFDouble nastnum = childrenVO.getNastnum(); | ||||
|             sumnum = sumnum.add(nastnum); | ||||
|             Map<String, Object> goodsMap = getMaterlInfo(childrenVO.getCmaterialid()); | ||||
|             String measrate = "1/1"; | ||||
|             if (goodsMap != null && StringUtils.isEmpty(goodsMap.getOrDefault("measrate","") + "")) { | ||||
|                 measrate = goodsMap.get("measrate") + ""; | ||||
|             } | ||||
|             childrenVO.setVchangerate(measrate);// 换算率 | ||||
|             childrenVO.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 = childrenVO.getNnum().setScale(2, UFDouble.ROUND_HALF_UP); | ||||
|             childrenVO.setNnum(nnum); | ||||
|             UFDouble nastnum = nnum.multiply(measrateNum).setScale(2, UFDouble.ROUND_HALF_UP); | ||||
|             childrenVO.setNastnum(nastnum);// 数量 | ||||
|             childrenVO.setNqtunitnum(nastnum);// 报价单位数量 | ||||
|             sumnum = sumnum.add(nnum); | ||||
|             sumnny = sumnny.add(norigtaxmny); | ||||
| 
 | ||||
|         } | ||||
|  | @ -838,6 +858,23 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 获取物料的信息 | ||||
|      * @param pk_material | ||||
|      * @return | ||||
|      * @throws BusinessException | ||||
|      */ | ||||
|     private Map<String, Object> getMaterlInfo(String pk_material) throws BusinessException { | ||||
|         if (pk_material == null || pk_material.isEmpty()) { | ||||
|             return null; | ||||
|         } | ||||
|         IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class); | ||||
|         String sql = " select nvl(measrate, '1/1') measrate" + | ||||
|                 " from bd_materialconvert" + | ||||
|                 " where pk_material='" + pk_material + "' "; | ||||
|         return (Map<String, Object>) queryBS.executeQuery(sql, new MapProcessor()); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 修订销售订单的时候新增销售订单物料行的数据 | ||||
|      */ | ||||
|  |  | |||
|  | @ -337,7 +337,7 @@ public class IAPISaleInvMaitainImpl { | |||
|                 otherJson.put("nexchangerate", nexchangerate); | ||||
| 
 | ||||
|                 // 输入参数:从你的 item 获取各个字段 | ||||
|                 BigDecimal nastnum = new BigDecimal(item.getString("nastnum")); // 数量 | ||||
|                 BigDecimal nastnum = new BigDecimal(item.getString("nnum")); // 数量 | ||||
|                 nastnum = nastnum.setScale(4, RoundingMode.HALF_UP); | ||||
|                 BigDecimal nqtorigtaxprice = new BigDecimal(item.getString("nqtorigtaxprice")); // 含税单价 | ||||
|                 nqtorigtaxprice = nqtorigtaxprice.setScale(4, RoundingMode.HALF_UP); | ||||
|  | @ -376,22 +376,22 @@ public class IAPISaleInvMaitainImpl { | |||
|                 // 税额 | ||||
|                 ntax = ntaxmny.subtract(nmny).setScale(2, RoundingMode.HALF_UP); | ||||
| 
 | ||||
|                 UFDouble nastnum1 = new UFDouble(item.getString("nastnum")); | ||||
|                 UFDouble nnum = new UFDouble(item.getString("nnum"));// 主数量 | ||||
| 
 | ||||
|                 itemDetails.put("nnum", nastnum1);// 主数量 | ||||
|                 itemDetails.put("nqtorigprice", nqtorigprice);// 无税单价 | ||||
|                 itemDetails.put("norigprice", nqtorigprice);// 主无税单价 | ||||
|                 itemDetails.put("norigmny", norigmny);// 无税金额 | ||||
|                 itemDetails.put("nmny", nmny);// 本币无税金额 | ||||
|                 itemDetails.put("norigtaxmny", norigtaxmny);// 价税合计 | ||||
|                 itemDetails.put("norigtaxprice", norigtaxprice);// 主含税单价 | ||||
|                 itemDetails.put("norignetprice", norignetprice);// 主无税净价 | ||||
|                 itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);// 含税单价 | ||||
|                 itemDetails.put("ntax", ntax);// 税额 | ||||
|                 itemDetails.put("ncaltaxmny", ncaltaxmny);// 计税金额 | ||||
|                 itemDetails.put("norigtaxnetprice", norigtaxnetprice);// 主含税净价 | ||||
|                 itemDetails.put("nnetprice", nnetprice);// 主本币无税净价 | ||||
|                 itemDetails.put("ntaxmny", ntaxmny);// 本币价税合计 | ||||
|                 itemDetails.put("nastnum", nnum);// 数量 | ||||
|                 // itemDetails.put("nqtorigprice", nqtorigprice);// 无税单价 | ||||
|                 // itemDetails.put("norigprice", nqtorigprice);// 主无税单价 | ||||
|                 // itemDetails.put("norigmny", norigmny);// 无税金额 | ||||
|                 // itemDetails.put("nmny", nmny);// 本币无税金额 | ||||
|                 // itemDetails.put("norigtaxmny", norigtaxmny);// 价税合计 | ||||
|                 // itemDetails.put("norigtaxprice", norigtaxprice);// 主含税单价 | ||||
|                 // itemDetails.put("norignetprice", norignetprice);// 主无税净价 | ||||
|                 // itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);// 含税单价 | ||||
|                 // itemDetails.put("ntax", ntax);// 税额 | ||||
|                 // itemDetails.put("ncaltaxmny", ncaltaxmny);// 计税金额 | ||||
|                 // itemDetails.put("norigtaxnetprice", norigtaxnetprice);// 主含税净价 | ||||
|                 // itemDetails.put("nnetprice", nnetprice);// 主本币无税净价 | ||||
|                 // itemDetails.put("ntaxmny", ntaxmny);// 本币价税合计 | ||||
|                 csaleinvoicebid.add(itemDetails); | ||||
| 
 | ||||
|             } | ||||
|  | @ -511,9 +511,9 @@ public class IAPISaleInvMaitainImpl { | |||
|                     vchangerateNum = vchangerateNums[0].div(vchangerateNums[1]).setScale(2, 4); | ||||
|                 } | ||||
|                 // BIP合同平台的数量对应BIP2312的主数量,BIP2312的 数量=主数量*换算关系 | ||||
|                 UFDouble nastnum = new UFDouble(bipBvoJson.getString("nastnum")); | ||||
|                 newInvBVO.setNastnum(nastnum.multiply(vchangerateNum).setScale(2, 4)); // 数量 | ||||
|                 newInvBVO.setNnum(nastnum); // 主数量 | ||||
|                 UFDouble nnum = new UFDouble(bipBvoJson.getString("nnum")); | ||||
|                 newInvBVO.setNastnum(nnum.multiply(vchangerateNum).setScale(2, 4)); // 数量 | ||||
|                 newInvBVO.setNnum(nnum); // 主数量 | ||||
|                 newInvBVO.setNqtorigtaxprice(new UFDouble(bipBvoJson.getString("nqtorigtaxprice"))); // 含税单价 | ||||
|                 newInvBVO.setNqtorigprice(new UFDouble(bipBvoJson.getString("nqtorigprice"))); // 无税单价 | ||||
|                 newInvBVO.setNorigtaxprice(new UFDouble(bipBvoJson.getString("norigtaxprice"))); // 主含税单价 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue