丽知:调拨订单修改单价取数逻辑内部转移价(取bd_produce-》nbzyj)
This commit is contained in:
parent
b2cbf07916
commit
215997007a
|
@ -1,7 +1,7 @@
|
|||
package com.hzya.frame.plugin.lets.dao;
|
||||
|
||||
import com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* (IA_MONTHLEDGER: table)表数据库访问层
|
||||
|
@ -10,6 +10,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
* @since 2024-09-03 11:16:01
|
||||
*/
|
||||
public interface IIaMonthledgerDao extends IBaseDao<IaMonthledgerEntity, String> {
|
||||
public String queryNbzyjByPkInvmandoc(String pkInvmandoc);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
package com.hzya.frame.plugin.lets.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity;
|
||||
import com.hzya.frame.plugin.lets.dao.IIaMonthledgerDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (IaMonthledger)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-03 11:16:01
|
||||
*/
|
||||
public class IaMonthledgerDaoImpl extends MybatisGenericDao<IaMonthledgerEntity, String> implements IIaMonthledgerDao{
|
||||
|
||||
public class IaMonthledgerDaoImpl extends MybatisGenericDao<IaMonthledgerEntity, String> implements IIaMonthledgerDao {
|
||||
|
||||
@DS("lets_u8c")
|
||||
@Override
|
||||
public String queryNbzyjByPkInvmandoc(String pkInvmandoc) {
|
||||
String nbzyj = (String) selectOne("com.hzya.frame.plugin.lets.dao.impl.IaMonthledgerDaoImpl.queryNbzyjByPkInvmandoc", pkInvmandoc);
|
||||
return nbzyj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -499,5 +499,9 @@ update IA_MONTHLEDGER set sts= 'N' ,modify_time = #{modify_time},modify_user_id
|
|||
delete from IA_MONTHLEDGER where CMONTHLEDGERID = #{cmonthledgerid}
|
||||
</delete>
|
||||
|
||||
<select id="queryNbzyjByPkInvmandoc" parameterType="String" resultType="String">
|
||||
SELECT nbzyj FROM bd_produce WHERE dr=0 AND pk_invbasdoc=#{pkInvmandoc}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -373,11 +373,14 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
|||
|
||||
//nprice 单价(含税单价),取上一次结账的单价 nmny金额 nnotaxmny无税金额 nnotaxprice 无税单价
|
||||
//202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
||||
//202502121700:妮妮姐说:取bd_produce-》nbzyj
|
||||
String nabprice = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode(), ofsTranseferOrder.getHeader().getFacilityCode());
|
||||
if (nabprice == null) {
|
||||
Assert.state(false, "公司:{},货品:{},SKU编码:{},无结存价、起初价、采购价,请维护!", ofsTranseferOrder.getHeader().getCompanyCode(), ofsDetail.getSkuName(), ofsDetail.getSkuCode());
|
||||
// Assert.state(false, "公司:{},货品:{},SKU编码:{},无结存价、起初价、采购价,请维护!", ofsTranseferOrder.getHeader().getCompanyCode(), ofsDetail.getSkuName(), ofsDetail.getSkuCode());
|
||||
Assert.state(false, "公司:{},货品:{},SKU编码:{},无内部转移价,请维护!", ofsTranseferOrder.getHeader().getCompanyCode(), ofsDetail.getSkuName(), ofsDetail.getSkuCode());
|
||||
} else {
|
||||
children.setNprice(nabprice);
|
||||
// children.setNprice(nabprice);//单价(含税单价)
|
||||
children.setNnotaxprice(nabprice);
|
||||
}
|
||||
//ntaxrate 税率
|
||||
children.setNtaxrate("13");
|
||||
|
@ -614,65 +617,75 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
|||
Assert.state(false, "根据OFS仓库编码:{},查询U8C仓库不存在。请检查U8C档案", facilityCode);
|
||||
}
|
||||
|
||||
//结存价(月份)
|
||||
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());
|
||||
// }
|
||||
// return iaMonthledgerEntityList.get(0);
|
||||
|
||||
if (iaMonthledgerEntityList.size() != 0) {
|
||||
return iaMonthledgerEntityList.get(0).getNabprice();
|
||||
}
|
||||
|
||||
|
||||
//取期初价格,需要总价nabmny/数量nabnum,保留四位小数 因为存在多个仓库
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||
iaPeriodaccountEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
||||
iaPeriodaccountEntity.setCwarehouseid(bdStordocEntity.getPkStordoc());
|
||||
iaPeriodaccountEntity.setCaccountmonth("00");
|
||||
iaPeriodaccountEntity.setDr("0");
|
||||
iaPeriodaccountEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = iIaPeriodaccountDao.query(iaPeriodaccountEntity);
|
||||
if (iaPeriodaccountEntityList.size() != 0) {
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity1 = iaPeriodaccountEntityList.get(0);
|
||||
BigDecimal nabmny = new BigDecimal(iaPeriodaccountEntity1.getNabmny());
|
||||
BigDecimal nabnum = new BigDecimal(iaPeriodaccountEntity1.getNabnum());
|
||||
// 检查分母是否为0,避免出现算术异常
|
||||
if (nabnum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
Assert.state(false, "公司编码:{},物料编码:{},取期初价格时,数量为0,请检查", companyCode, sku.getSkuCode());
|
||||
}
|
||||
BigDecimal result = nabmny.divide(nabnum, 4, RoundingMode.HALF_UP);
|
||||
return result.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
|
||||
//取采购价
|
||||
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 {
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//202502121700:妮妮姐说:取bd_produce-》nbzyj
|
||||
String nbzyj = iaMonthledgerDao.queryNbzyjByPkInvmandoc(bdInvmandocEntity.getPkInvmandoc());
|
||||
if (nbzyj == null) {
|
||||
return null;
|
||||
}
|
||||
return nbzyj;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //结存价(月份)
|
||||
// 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());
|
||||
//// }
|
||||
//// return iaMonthledgerEntityList.get(0);
|
||||
//
|
||||
// if (iaMonthledgerEntityList.size() != 0) {
|
||||
// return iaMonthledgerEntityList.get(0).getNabprice();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //取期初价格,需要总价nabmny/数量nabnum,保留四位小数 因为存在多个仓库
|
||||
// IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||
// iaPeriodaccountEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
||||
// iaPeriodaccountEntity.setCwarehouseid(bdStordocEntity.getPkStordoc());
|
||||
// iaPeriodaccountEntity.setCaccountmonth("00");
|
||||
// iaPeriodaccountEntity.setDr("0");
|
||||
// iaPeriodaccountEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
// List<IaPeriodaccountEntity> iaPeriodaccountEntityList = iIaPeriodaccountDao.query(iaPeriodaccountEntity);
|
||||
// if (iaPeriodaccountEntityList.size() != 0) {
|
||||
// IaPeriodaccountEntity iaPeriodaccountEntity1 = iaPeriodaccountEntityList.get(0);
|
||||
// BigDecimal nabmny = new BigDecimal(iaPeriodaccountEntity1.getNabmny());
|
||||
// BigDecimal nabnum = new BigDecimal(iaPeriodaccountEntity1.getNabnum());
|
||||
// // 检查分母是否为0,避免出现算术异常
|
||||
// if (nabnum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
// Assert.state(false, "公司编码:{},物料编码:{},取期初价格时,数量为0,请检查", companyCode, sku.getSkuCode());
|
||||
// }
|
||||
// BigDecimal result = nabmny.divide(nabnum, 4, RoundingMode.HALF_UP);
|
||||
// return result.stripTrailingZeros().toPlainString();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //取采购价
|
||||
// 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;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue