销售订单保存接口-单价金额等字段取值调整
This commit is contained in:
parent
ee3a360da5
commit
45b8f4c7a2
|
@ -111,8 +111,8 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
String corigcurrencyid = hvo.getCorigcurrencyid();
|
||||
origcurrencyMap.put(vbillcode, corigcurrencyid);
|
||||
}
|
||||
// ĚîłäÄŹČĎÖľ
|
||||
new SaleOrderSaveFillValue().setDefValue(vos);
|
||||
// 填充默认值,重写setDefValue方法,去掉其中的价格金额计算
|
||||
new SaleOrderSaveFillValue().setDefValue1(vos);
|
||||
// 填充默认值的时候原币的值被覆盖,重新赋值为合同平台传过来的币种
|
||||
for (SaleOrderVO ordervo : vos) {
|
||||
SaleOrderHVO hvo = ordervo.getParentVO();
|
||||
|
@ -159,87 +159,87 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
// 处理单价(4位)和金额(2位)
|
||||
// 含税单价
|
||||
UFDouble nqtorigtaxprice = childrenVO.getNqtorigtaxprice();
|
||||
nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtorigtaxprice = nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtorigtaxprice(nqtorigtaxprice);
|
||||
// 无税单价
|
||||
UFDouble nqtorigprice = childrenVO.getNqtorigprice();
|
||||
nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtorigprice = nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtorigprice(nqtorigprice);
|
||||
// 含税净价
|
||||
UFDouble nqtorigtaxnetprc = childrenVO.getNqtorigtaxnetprc();
|
||||
nqtorigtaxnetprc.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtorigtaxnetprc = nqtorigtaxnetprc.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtorigtaxnetprc(nqtorigtaxnetprc);
|
||||
// 无税净价
|
||||
UFDouble nqtorignetprice = childrenVO.getNqtorignetprice();
|
||||
nqtorignetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtorignetprice = nqtorignetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtorignetprice(nqtorignetprice);
|
||||
// 主含税单价
|
||||
UFDouble norigtaxprice = childrenVO.getNorigtaxprice();
|
||||
norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
norigtaxprice = norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorigtaxprice(norigtaxprice);
|
||||
// 主无税单价
|
||||
UFDouble norigprice = childrenVO.getNorigprice();
|
||||
norigprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
norigprice = norigprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorigprice(norigprice);
|
||||
// 主含税净价
|
||||
UFDouble norigtaxnetprice = childrenVO.getNorigtaxnetprice();
|
||||
norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
norigprice = norigtaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorigtaxnetprice(norigtaxnetprice);
|
||||
// 主无税净价
|
||||
UFDouble norignetprice = childrenVO.getNorignetprice();
|
||||
norignetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
norignetprice = norignetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorignetprice(norignetprice);
|
||||
// 本币无税金额
|
||||
UFDouble nmny = childrenVO.getNmny();
|
||||
nmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
nmny = nmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNmny(nmny);
|
||||
// 本币价税合计
|
||||
UFDouble ntaxmny = childrenVO.getNtaxmny();
|
||||
ntaxmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
ntaxmny = ntaxmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNtaxmny(ntaxmny);
|
||||
// 税额
|
||||
UFDouble ntax = childrenVO.getNtax();
|
||||
ntax.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
ntax = ntax.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNtax(ntax);
|
||||
// 无税金额
|
||||
UFDouble norigmny = childrenVO.getNorigmny();
|
||||
norigmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
norigmny = norigmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorigmny(norigmny);
|
||||
// 价税合计
|
||||
UFDouble norigtaxmny = childrenVO.getNorigtaxmny();
|
||||
norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
norigtaxmny = norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNorigtaxmny(norigtaxmny);
|
||||
// 本币含税单价
|
||||
UFDouble nqttaxprice = childrenVO.getNqttaxprice();
|
||||
nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqttaxprice = nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqttaxprice(nqttaxprice);
|
||||
// 本币无税单价
|
||||
UFDouble nqtprice = childrenVO.getNqtprice();
|
||||
nqtprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtprice = nqtprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtprice(nqtprice);
|
||||
// 本币含税净价
|
||||
UFDouble nqttaxnetprice = childrenVO.getNqttaxnetprice();
|
||||
nqttaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqttaxnetprice = nqttaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqttaxnetprice(nqttaxnetprice);
|
||||
// 本币无税净价
|
||||
UFDouble nqtnetprice = childrenVO.getNqtnetprice();
|
||||
nqtnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nqtnetprice = nqtnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNqtnetprice(nqtnetprice);
|
||||
// 主本币含税单价
|
||||
UFDouble ntaxprice = childrenVO.getNtaxprice();
|
||||
ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
ntaxprice = ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNtaxprice(ntaxprice);
|
||||
// 主本币无税单价
|
||||
UFDouble nprice = childrenVO.getNprice();
|
||||
nprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nprice = nprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNprice(nprice);
|
||||
// 主本币含税净价
|
||||
UFDouble ntaxnetprice = childrenVO.getNtaxnetprice();
|
||||
ntaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
ntaxnetprice = ntaxnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNtaxnetprice(ntaxnetprice);
|
||||
// 主本币无税净价
|
||||
UFDouble nnetprice = childrenVO.getNnetprice();
|
||||
nnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
nnetprice = nnetprice.setScale(4, UFDouble.ROUND_HALF_UP);
|
||||
childrenVO.setNnetprice(nnetprice);
|
||||
|
||||
UFDouble nastnum = childrenVO.getNastnum();
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.api.impl.so.m30.fill;
|
||||
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.pubapp.AppBsContext;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.pubapp.pattern.pub.PubAppTool;
|
||||
import nc.vo.scmpub.fill.pricemny.INumPriceMnyCalculator;
|
||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
import nc.vo.so.m30.rule.DirectStoreRule;
|
||||
import nc.vo.so.m30.rule.PayTermRule;
|
||||
import nc.vo.so.pub.SOConstant;
|
||||
import nc.vo.so.pub.enumeration.BillStatus;
|
||||
import nc.vo.so.pub.keyvalue.IKeyValue;
|
||||
import nc.vo.so.pub.keyvalue.VOKeyValue;
|
||||
import nc.vo.so.pub.rule.*;
|
||||
import nc.vo.so.pub.util.ArrayUtil;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class SaleOrderSaveFillValue {
|
||||
public SaleOrderSaveFillValue() {
|
||||
}
|
||||
|
||||
public void setDefValue(SaleOrderVO[] vos) throws BusinessException {
|
||||
SaleOrgFillRule<SaleOrderVO> orgfill = new SaleOrgFillRule(vos);
|
||||
orgfill.setOrgEmplyDept();
|
||||
BusitypeFillRule<SaleOrderVO> busitypefill = new BusitypeFillRule(vos);
|
||||
busitypefill.setBusitype();
|
||||
MaterialFullRule<SaleOrderVO> materialfull = new MaterialFullRule(vos);
|
||||
materialfull.setMaterialOid();
|
||||
|
||||
for (SaleOrderVO salebillvo : vos) {
|
||||
IKeyValue keyValue = new VOKeyValue(salebillvo);
|
||||
this.setDefultInfo(keyValue);
|
||||
}
|
||||
|
||||
INumPriceMnyCalculator cal = new SaleOrderNPriceMnyCal(vos);
|
||||
cal.calculate();
|
||||
}
|
||||
|
||||
public void setDefValue1(SaleOrderVO[] vos) throws BusinessException {
|
||||
SaleOrgFillRule<SaleOrderVO> orgfill = new SaleOrgFillRule(vos);
|
||||
orgfill.setOrgEmplyDept();
|
||||
BusitypeFillRule<SaleOrderVO> busitypefill = new BusitypeFillRule(vos);
|
||||
busitypefill.setBusitype();
|
||||
MaterialFullRule<SaleOrderVO> materialfull = new MaterialFullRule(vos);
|
||||
materialfull.setMaterialOid();
|
||||
|
||||
for (SaleOrderVO salebillvo : vos) {
|
||||
IKeyValue keyValue = new VOKeyValue(salebillvo);
|
||||
this.setDefultInfo(keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefultInfo(IKeyValue keyValue) {
|
||||
this.setForceDefValue(keyValue);
|
||||
BodyValueRowRule bodycouuitl = new BodyValueRowRule(keyValue);
|
||||
SaleOrgRelationRule orgrelrule = new SaleOrgRelationRule(keyValue);
|
||||
int[] sendstockrows = bodycouuitl.getValueNullRows("csendstockorgvid");
|
||||
orgrelrule.setSendStockOrg(sendstockrows);
|
||||
int[] trafficrows = bodycouuitl.getValueNullRows("ctrafficorgvid");
|
||||
orgrelrule.setTrafficOrg(trafficrows);
|
||||
int[] finacerows = bodycouuitl.getValueNullRows("csettleorgvid");
|
||||
orgrelrule.setFinanceOrg(finacerows);
|
||||
SOProfitCenterValueRule profitRule = new SOProfitCenterValueRule(keyValue);
|
||||
profitRule.setProfitCenterValue("csprofitcentervid", "csprofitcenterid", sendstockrows);
|
||||
SOCurrencyRule currule = new SOCurrencyRule(keyValue);
|
||||
currule.setCurrency(finacerows);
|
||||
SOCustRelaDefValueRule custrefrule = new SOCustRelaDefValueRule(keyValue);
|
||||
custrefrule.setCustRelaDefValue();
|
||||
SOExchangeRateRule exrule = new SOExchangeRateRule(keyValue);
|
||||
exrule.calcBodyExchangeRates(finacerows);
|
||||
PayTermRule payTermRule = new PayTermRule(keyValue);
|
||||
payTermRule.setPayTermInfo();
|
||||
int[] custisnullrows = bodycouuitl.getValueNullRows("creceivecustid");
|
||||
custrefrule.setRelaReceiveCust(custisnullrows);
|
||||
int[] eiveaddrnullrows = bodycouuitl.getValueNullRows("creceiveaddrid");
|
||||
ReceiveCustDefAddrRule defaddrule = new ReceiveCustDefAddrRule(keyValue);
|
||||
defaddrule.setCustDefaultAddress(eiveaddrnullrows);
|
||||
int[] needchangerows = ArrayUtil.combinArrays(new int[][]{sendstockrows, finacerows});
|
||||
SOCountryInfoRule countryrule = new SOCountryInfoRule(keyValue);
|
||||
countryrule.setCountryInfo(needchangerows);
|
||||
SOBuysellTriaRule buyflgrule = new SOBuysellTriaRule(keyValue);
|
||||
buyflgrule.setBuysellAndTriaFlag(needchangerows);
|
||||
int[] rows = bodycouuitl.getMarNotNullRows();
|
||||
String ctrantypeid = keyValue.getHeadStringValue("ctrantypeid");
|
||||
if (!PubAppTool.isNull(ctrantypeid)) {
|
||||
DirectStoreRule dirstorerule = new DirectStoreRule(keyValue);
|
||||
dirstorerule.setDirectStore(rows);
|
||||
}
|
||||
|
||||
SOGlobalExchangeRate globalraterule = new SOGlobalExchangeRate(keyValue);
|
||||
globalraterule.calcGlobalExchangeRate(rows);
|
||||
SOGroupExchangeRate groupraterule = new SOGroupExchangeRate(keyValue);
|
||||
groupraterule.calcGroupExchangeRate(rows);
|
||||
}
|
||||
|
||||
private void setForceDefValue(IKeyValue keyValue) {
|
||||
keyValue.setHeadValue("fstatusflag", BillStatus.FREE.getIntegerValue());
|
||||
UFDouble discountrate = keyValue.getHeadUFDoubleValue("ndiscountrate");
|
||||
if (null == discountrate) {
|
||||
discountrate = SOConstant.ONEHUNDRED;
|
||||
keyValue.setHeadValue("ndiscountrate", discountrate);
|
||||
}
|
||||
|
||||
String invoicecust = keyValue.getHeadStringValue("cinvoicecustid");
|
||||
if (PubAppTool.isNull(invoicecust)) {
|
||||
SOCustRelaDefValueRule custrelarule = new SOCustRelaDefValueRule(keyValue);
|
||||
custrelarule.setCustRelaInvoiceCust();
|
||||
}
|
||||
|
||||
UFDate busdate = AppBsContext.getInstance().getBusiDate();
|
||||
if (keyValue.getHeadValue("dbilldate") == null) {
|
||||
keyValue.setHeadValue("dbilldate", busdate);
|
||||
}
|
||||
|
||||
String pk_group = AppBsContext.getInstance().getPkGroup();
|
||||
keyValue.setHeadValue("pk_group", pk_group);
|
||||
String pk_org = keyValue.getHeadStringValue("pk_org");
|
||||
String timeZone = InvocationInfoProxy.getInstance().getTimeZone();
|
||||
TimeZone zone = TimeZone.getTimeZone(timeZone);
|
||||
UFDate enddate = busdate.asEnd(zone);
|
||||
if (!InvocationInfoProxy.getInstance().getSensitiveTimeZone()) {
|
||||
enddate = busdate.asEnd();
|
||||
}
|
||||
|
||||
int bodycount = keyValue.getBodyCount();
|
||||
|
||||
for (int i = 0; i < bodycount; ++i) {
|
||||
keyValue.setBodyValue(i, "dbilldate", busdate);
|
||||
keyValue.setBodyValue(i, "pk_group", pk_group);
|
||||
keyValue.setBodyValue(i, "pk_org", pk_org);
|
||||
UFDate senddate = keyValue.getBodyUFDateValue(i, "dsenddate");
|
||||
if (null == senddate || senddate.ufBefore(busdate)) {
|
||||
keyValue.setBodyValue(i, "dsenddate", enddate);
|
||||
}
|
||||
|
||||
UFDate receivedate = keyValue.getBodyUFDateValue(i, "dreceivedate");
|
||||
if (null == receivedate || receivedate.ufBefore(busdate)) {
|
||||
keyValue.setBodyValue(i, "dreceivedate", enddate);
|
||||
}
|
||||
|
||||
UFDouble disrate = keyValue.getBodyUFDoubleValue(i, "ndiscountrate");
|
||||
if (null == disrate) {
|
||||
keyValue.setBodyValue(i, "ndiscountrate", discountrate);
|
||||
}
|
||||
|
||||
UFDouble itemdisrate = keyValue.getBodyUFDoubleValue(i, "nitemdiscountrate");
|
||||
if (null == itemdisrate) {
|
||||
keyValue.setBodyValue(i, "nitemdiscountrate", SOConstant.ONEHUNDRED);
|
||||
}
|
||||
|
||||
keyValue.setBodyValue(i, "frowstatus", BillStatus.FREE.getIntegerValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue