丽知:调拨出库价格取数逻辑修改
This commit is contained in:
parent
5ec6a10725
commit
9c1cca9eaa
|
@ -10,16 +10,14 @@ import com.hzya.frame.base.PluginBaseEntity;
|
|||
import com.hzya.frame.plugin.lets.constant.OverallConstant;
|
||||
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||
import com.hzya.frame.plugin.lets.dao.IIaMonthledgerDao;
|
||||
import com.hzya.frame.plugin.lets.entity.BdCorpEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.*;
|
||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
|
||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO;
|
||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsTransferOrderRequestVO;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.BillVO;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4IDto;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
|
||||
import com.hzya.frame.plugin.lets.util.BalanceUnitPriceUtil;
|
||||
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
|
||||
import com.hzya.frame.plugin.lets.util.QueryU8CEntityUtil;
|
||||
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
|
||||
|
@ -333,30 +331,42 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
|||
//vuserdef20 OFS调拨订单 id
|
||||
parentvo.setVdef20(ofsTranseferOrder.getHeader().getId());
|
||||
|
||||
boolean is_flag=false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
//子表
|
||||
List<OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB> ofsDetails = ofsTranseferOrder.getDetails();
|
||||
List<BillVO.Childrenvo> childrenvo = new ArrayList<>();
|
||||
for (OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB ofsDetail : ofsDetails) {
|
||||
BillVO.Childrenvo children = new BillVO.Childrenvo();
|
||||
//表体
|
||||
//cinvbasid 存货基本档案
|
||||
children.setCinvbasid(ofsDetail.getSkuCode());
|
||||
//nnum 数量
|
||||
children.setNnum(BigDecimal.valueOf(Long.parseLong(ofsDetail.getShipQty())));
|
||||
childrenvo.add(children);
|
||||
//ofs行id
|
||||
try {
|
||||
BillVO.Childrenvo children = new BillVO.Childrenvo();
|
||||
//表体
|
||||
//cinvbasid 存货基本档案
|
||||
children.setCinvbasid(ofsDetail.getSkuCode());
|
||||
//nnum 数量
|
||||
children.setNnum(BigDecimal.valueOf(Long.parseLong(ofsDetail.getShipQty())));
|
||||
childrenvo.add(children);
|
||||
//ofs行id
|
||||
// children.setPk_defdoc20(ofsDetail.getId());
|
||||
children.setVbdef20(ofsDetail.getId());
|
||||
children.setVbdef20(ofsDetail.getId());
|
||||
|
||||
//nprice 单价(含税单价),取上一次结账的单价 nmny金额 nnotaxmny无税金额 nnotaxprice 无税单价
|
||||
IaMonthledgerEntity iaMonthledgerEntity = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode());
|
||||
if(iaMonthledgerEntity==null){
|
||||
children.setNprice("0");
|
||||
}else {
|
||||
children.setNprice(iaMonthledgerEntity.getNabprice());
|
||||
//nprice 单价(含税单价),取上一次结账的单价 nmny金额 nnotaxmny无税金额 nnotaxprice 无税单价
|
||||
//202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
||||
String nabprice = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode());
|
||||
if (nabprice == null) {
|
||||
Assert.state(false, "货品:{},SKU编码:{},无结存价和采购价,请维护!",ofsDetail.getSkuName(),ofsDetail.getSkuCode());
|
||||
} else {
|
||||
children.setNprice(nabprice);
|
||||
}
|
||||
//ntaxrate 税率
|
||||
children.setNtaxrate("13");
|
||||
}catch (Exception eD){
|
||||
is_flag=true;
|
||||
stringBuffer.append(eD.getMessage());
|
||||
}
|
||||
//ntaxrate 税率
|
||||
children.setNtaxrate("13");
|
||||
}
|
||||
if(is_flag){
|
||||
Assert.state(false, String.valueOf(stringBuffer));
|
||||
}
|
||||
billVO.setParentvo(parentvo);
|
||||
billVO.setChildrenvo(childrenvo);
|
||||
|
@ -548,12 +558,14 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private BalanceUnitPriceUtil balanceUnitPriceUtil;
|
||||
/**
|
||||
* 202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
||||
* 根据存货管理档案档案,查询最后一次结算的单价,已根据ts 倒排,get(0)为最近一次核算价格
|
||||
*/
|
||||
public IaMonthledgerEntity queryIaMonthledger(OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB sku,String companyCode){
|
||||
|
||||
public String queryIaMonthledger(OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB sku,String companyCode) throws Exception {
|
||||
String totalPayAmount = null;
|
||||
//查询公司
|
||||
BdCorpEntity bdCorpEntity = queryU8CEntityUtil.queryBdCorpByUnitCode(companyCode);
|
||||
if(bdCorpEntity==null){
|
||||
|
@ -572,17 +584,44 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
|||
Assert.state(false,"根据U8C存货基本档案主键:{},U8C公司主键:{},查询U8C存货管理档案不存在。请检查U8C档案",bdInvbasdocEntity.getPkInvbasdoc(),bdCorpEntity.getPkCorp());
|
||||
}
|
||||
|
||||
//结存价
|
||||
IaMonthledgerEntity iaMonthledgerEntity = new IaMonthledgerEntity();
|
||||
iaMonthledgerEntity.setPkCorp(bdCorpEntity.getPkCorp());
|
||||
iaMonthledgerEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
||||
iaMonthledgerEntity.setFrecordtypeflag("3");
|
||||
iaMonthledgerEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<IaMonthledgerEntity> iaMonthledgerEntityList = iaMonthledgerDao.query(iaMonthledgerEntity);
|
||||
if (iaMonthledgerEntityList.size() == 0) {//没有也没事
|
||||
return null;
|
||||
// Assert.state(false, "该存货名称:{},编码:{},U8C基本档案主键:{},没有进行过结算,请检查",sku.getSkuName(),sku.getSkuCode(),bdInvbasdocEntity.getPkInvbasdoc());
|
||||
// if (iaMonthledgerEntityList.size() == 0) {//没有也没事
|
||||
// return null;
|
||||
//// Assert.state(false, "该存货名称:{},编码:{},U8C基本档案主键:{},没有进行过结算,请检查",sku.getSkuName(),sku.getSkuCode(),bdInvbasdocEntity.getPkInvbasdoc());
|
||||
// }
|
||||
// return iaMonthledgerEntityList.get(0);
|
||||
|
||||
if (iaMonthledgerEntityList.size() != 0) {
|
||||
return iaMonthledgerEntityList.get(0).getNabprice();
|
||||
}
|
||||
|
||||
|
||||
//取采购价
|
||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
|
||||
String nordernum = poOrderBEntityList.get(0).getNordernum();
|
||||
if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString()) || "0".equals(new BigDecimal(nordernum).stripTrailingZeros().toPlainString())) {
|
||||
//如果采购单价都为0,那么金额也为0
|
||||
totalPayAmount = "0";
|
||||
} else {
|
||||
BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
|
||||
BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
|
||||
BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
return totalPayAmount;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
return iaMonthledgerEntityList.get(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,10 @@ public class GeneralBillVO {
|
|||
* 备注
|
||||
*/
|
||||
private String vnote;
|
||||
/**
|
||||
* 单据日期
|
||||
*/
|
||||
private String dbilldate;
|
||||
private String pk_defdoc1;
|
||||
private String pk_defdoc10;
|
||||
private String pk_defdoc11;
|
||||
|
|
Loading…
Reference in New Issue