丽知:调拨订单新增期初价格查询
This commit is contained in:
parent
1ffef190ef
commit
61de821ebd
|
@ -164,10 +164,9 @@
|
||||||
<if test="vfree8 != null and vfree8 != ''"> and VFREE8 = #{vfree8} </if>
|
<if test="vfree8 != null and vfree8 != ''"> and VFREE8 = #{vfree8} </if>
|
||||||
<if test="vfree9 != null and vfree9 != ''"> and VFREE9 = #{vfree9} </if>
|
<if test="vfree9 != null and vfree9 != ''"> and VFREE9 = #{vfree9} </if>
|
||||||
<if test="vproducebatch != null and vproducebatch != ''"> and VPRODUCEBATCH = #{vproducebatch} </if>
|
<if test="vproducebatch != null and vproducebatch != ''"> and VPRODUCEBATCH = #{vproducebatch} </if>
|
||||||
and sts='Y'
|
-- and sts='Y'
|
||||||
</trim>
|
</trim>
|
||||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
ORDER BY TS DESC
|
||||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 查询符合条件的数量 -->
|
<!-- 查询符合条件的数量 -->
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.plugin.lets.constant.OverallConstant;
|
import com.hzya.frame.plugin.lets.constant.OverallConstant;
|
||||||
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||||
import com.hzya.frame.plugin.lets.dao.IIaMonthledgerDao;
|
import com.hzya.frame.plugin.lets.dao.IIaMonthledgerDao;
|
||||||
|
import com.hzya.frame.plugin.lets.dao.IIaPeriodaccountDao;
|
||||||
import com.hzya.frame.plugin.lets.entity.*;
|
import com.hzya.frame.plugin.lets.entity.*;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO;
|
||||||
|
@ -45,6 +46,7 @@ import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -104,6 +106,8 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IIaMonthledgerDao iaMonthledgerDao;
|
private IIaMonthledgerDao iaMonthledgerDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IIaPeriodaccountDao iIaPeriodaccountDao;
|
||||||
|
@Autowired
|
||||||
private QueryU8CEntityUtil queryU8CEntityUtil;
|
private QueryU8CEntityUtil queryU8CEntityUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -161,7 +165,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
queryOfsStockoutOrderRequestVO.setShipAt_end(endTimeStr);
|
queryOfsStockoutOrderRequestVO.setShipAt_end(endTimeStr);
|
||||||
queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
|
queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
|
||||||
List<StockoutOrderSearchResponse.StockoutOrder> transferOutOrder = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
|
List<StockoutOrderSearchResponse.StockoutOrder> transferOutOrder = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
|
||||||
if (transferOutOrder==null||transferOutOrder.size() == 0) {
|
if (transferOutOrder == null || transferOutOrder.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//过滤成功日志
|
//过滤成功日志
|
||||||
|
@ -241,7 +245,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : transferOutOrder) {
|
for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : transferOutOrder) {
|
||||||
StockoutOrderSearchResponse.StockoutOrder.StockoutH header = stockoutOrder.getHeader();
|
StockoutOrderSearchResponse.StockoutOrder.StockoutH header = stockoutOrder.getHeader();
|
||||||
//过滤"NMNS"\"YNS"\"HJ"
|
//过滤"NMNS"\"YNS"\"HJ"
|
||||||
if("NMNS".equals(header.getCompanyCode())||"YNS".equals(header.getCompanyCode())||"HJ".equals(header.getCompanyCode())){
|
if ("NMNS".equals(header.getCompanyCode()) || "YNS".equals(header.getCompanyCode()) || "HJ".equals(header.getCompanyCode())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String rootAppPk = header.getCode();
|
String rootAppPk = header.getCode();
|
||||||
|
@ -293,7 +297,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
create = stockoutH.getCreated();
|
create = stockoutH.getCreated();
|
||||||
modify = stockoutH.getLastUpdated();
|
modify = stockoutH.getLastUpdated();
|
||||||
//dbilldate 单据日期
|
//dbilldate 单据日期
|
||||||
parentvo.setDbilldate(modify.substring(0,10));
|
parentvo.setDbilldate(modify.substring(0, 10));
|
||||||
//dauditdate 审批日期
|
//dauditdate 审批日期
|
||||||
parentvo.setDauditdate(modify);
|
parentvo.setDauditdate(modify);
|
||||||
//coperatorid 制单人
|
//coperatorid 制单人
|
||||||
|
@ -325,18 +329,18 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
//pk_defdoc1 ofs调出店铺
|
//pk_defdoc1 ofs调出店铺
|
||||||
String outShop = locateShop(ofsTranseferOrder.getHeader().getCompanyCode());
|
String outShop = locateShop(ofsTranseferOrder.getHeader().getCompanyCode());
|
||||||
if(outShop==null){
|
if (outShop == null) {
|
||||||
Assert.state(false,"根据调出公司:{},未查询到对应的店铺,请维护(BDDP,调拨公司对应店铺)自定义项档案。", ofsTranseferOrder.getHeader().getCompanyCode());
|
Assert.state(false, "根据调出公司:{},未查询到对应的店铺,请维护(BDDP,调拨公司对应店铺)自定义项档案。", ofsTranseferOrder.getHeader().getCompanyCode());
|
||||||
}else {
|
} else {
|
||||||
//parentvo.setPk_defdoc1(ofsTranseferOrder.getHeader().getStoreCode());
|
//parentvo.setPk_defdoc1(ofsTranseferOrder.getHeader().getStoreCode());
|
||||||
parentvo.setPk_defdoc1(outShop);
|
parentvo.setPk_defdoc1(outShop);
|
||||||
}
|
}
|
||||||
|
|
||||||
//pk_defdoc4 ofs调入店铺
|
//pk_defdoc4 ofs调入店铺
|
||||||
String inShop = locateShop(ofsTranseferOrder.getHeader().getToCompanyCode());
|
String inShop = locateShop(ofsTranseferOrder.getHeader().getToCompanyCode());
|
||||||
if (inShop==null) {
|
if (inShop == null) {
|
||||||
Assert.state(false,"根据调入公司:{},未查询到对应的店铺,请维护(BDDP,调拨公司对应店铺)自定义项档案。", ofsTranseferOrder.getHeader().getCompanyCode());
|
Assert.state(false, "根据调入公司:{},未查询到对应的店铺,请维护(BDDP,调拨公司对应店铺)自定义项档案。", ofsTranseferOrder.getHeader().getCompanyCode());
|
||||||
}else {
|
} else {
|
||||||
//parentvo.setPk_defdoc4(ofsTranseferOrder.getHeader().getToStoreCode());
|
//parentvo.setPk_defdoc4(ofsTranseferOrder.getHeader().getToStoreCode());
|
||||||
parentvo.setPk_defdoc4(inShop);
|
parentvo.setPk_defdoc4(inShop);
|
||||||
}
|
}
|
||||||
|
@ -348,7 +352,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
//vuserdef20 OFS调拨订单 id
|
//vuserdef20 OFS调拨订单 id
|
||||||
parentvo.setVdef20(ofsTranseferOrder.getHeader().getId());
|
parentvo.setVdef20(ofsTranseferOrder.getHeader().getId());
|
||||||
|
|
||||||
boolean is_flag=false;
|
boolean is_flag = false;
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
|
||||||
//子表
|
//子表
|
||||||
|
@ -371,18 +375,18 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
//202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
//202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
||||||
String nabprice = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode());
|
String nabprice = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode());
|
||||||
if (nabprice == null) {
|
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());
|
||||||
} else {
|
} else {
|
||||||
children.setNprice(nabprice);
|
children.setNprice(nabprice);
|
||||||
}
|
}
|
||||||
//ntaxrate 税率
|
//ntaxrate 税率
|
||||||
children.setNtaxrate("13");
|
children.setNtaxrate("13");
|
||||||
}catch (Exception eD){
|
} catch (Exception eD) {
|
||||||
is_flag=true;
|
is_flag = true;
|
||||||
stringBuffer.append(eD.getMessage());
|
stringBuffer.append(eD.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(is_flag){
|
if (is_flag) {
|
||||||
Assert.state(false, String.valueOf(stringBuffer));
|
Assert.state(false, String.valueOf(stringBuffer));
|
||||||
}
|
}
|
||||||
billVO.setParentvo(parentvo);
|
billVO.setParentvo(parentvo);
|
||||||
|
@ -420,7 +424,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
integrationTaskLivingDetailsEntity.setBusinessDate(modify);
|
integrationTaskLivingDetailsEntity.setBusinessDate(modify);
|
||||||
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
|
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
|
||||||
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
|
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
|
||||||
integrationTaskLivingDetailsEntity.setNewSystemNumber(corpCode+"_"+vbillcode);//u8c调拨订单号
|
integrationTaskLivingDetailsEntity.setNewSystemNumber(corpCode + "_" + vbillcode);//u8c调拨订单号
|
||||||
integrationTaskLivingDetailsEntity.setNewSystemPrimary(cbillid);//u8c调拨订单号
|
integrationTaskLivingDetailsEntity.setNewSystemPrimary(cbillid);//u8c调拨订单号
|
||||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
|
@ -577,31 +581,35 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BalanceUnitPriceUtil balanceUnitPriceUtil;
|
private BalanceUnitPriceUtil balanceUnitPriceUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
* 202411091719:妮妮姐说:优先取结存价,没有的话取采购价,如果都没有就报错!!!
|
||||||
* 根据存货管理档案档案,查询最后一次结算的单价,已根据ts 倒排,get(0)为最近一次核算价格
|
* 根据存货管理档案档案,查询最后一次结算的单价,已根据ts 倒排,get(0)为最近一次核算价格
|
||||||
|
* <p>
|
||||||
|
* 202502071359:妮妮姐电话:取值顺序 结存->期初->采购
|
||||||
|
* eg:1月 如果结存价取结存价,如果没有取期初,如果没有再去最后一次采购
|
||||||
*/
|
*/
|
||||||
public String queryIaMonthledger(OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB sku,String companyCode) throws Exception {
|
public String queryIaMonthledger(OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB sku, String companyCode) throws Exception {
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
//查询公司
|
//查询公司
|
||||||
BdCorpEntity bdCorpEntity = queryU8CEntityUtil.queryBdCorpByUnitCode(companyCode);
|
BdCorpEntity bdCorpEntity = queryU8CEntityUtil.queryBdCorpByUnitCode(companyCode);
|
||||||
if(bdCorpEntity==null){
|
if (bdCorpEntity == null) {
|
||||||
Assert.state(false,"根据OFS公司编码:{},查询U8C公司不存在。请检查U8C档案",companyCode);
|
Assert.state(false, "根据OFS公司编码:{},查询U8C公司不存在。请检查U8C档案", companyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询存货基本档案主键
|
//查询存货基本档案主键
|
||||||
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(sku.getSkuCode());
|
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(sku.getSkuCode());
|
||||||
if(bdInvbasdocEntity==null){
|
if (bdInvbasdocEntity == null) {
|
||||||
Assert.state(false,"根据OFS SKU CODE:{},查询U8C存货基本档案不存在。请检查U8C档案",sku.getSkuCode());
|
Assert.state(false, "根据OFS SKU CODE:{},查询U8C存货基本档案不存在。请检查U8C档案", sku.getSkuCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询存货管理档案
|
//查询存货管理档案
|
||||||
BdInvmandocEntity bdInvmandocEntity = queryU8CEntityUtil.queryBdInvmandocByPkInvbasdocAndPkCorp(bdInvbasdocEntity.getPkInvbasdoc(), bdCorpEntity.getPkCorp());
|
BdInvmandocEntity bdInvmandocEntity = queryU8CEntityUtil.queryBdInvmandocByPkInvbasdocAndPkCorp(bdInvbasdocEntity.getPkInvbasdoc(), bdCorpEntity.getPkCorp());
|
||||||
if(bdInvmandocEntity==null){
|
if (bdInvmandocEntity == null) {
|
||||||
Assert.state(false,"根据U8C存货基本档案主键:{},U8C公司主键:{},查询U8C存货管理档案不存在。请检查U8C档案",bdInvbasdocEntity.getPkInvbasdoc(),bdCorpEntity.getPkCorp());
|
Assert.state(false, "根据U8C存货基本档案主键:{},U8C公司主键:{},查询U8C存货管理档案不存在。请检查U8C档案", bdInvbasdocEntity.getPkInvbasdoc(), bdCorpEntity.getPkCorp());
|
||||||
}
|
}
|
||||||
|
|
||||||
//结存价
|
//结存价(月份)
|
||||||
IaMonthledgerEntity iaMonthledgerEntity = new IaMonthledgerEntity();
|
IaMonthledgerEntity iaMonthledgerEntity = new IaMonthledgerEntity();
|
||||||
iaMonthledgerEntity.setPkCorp(bdCorpEntity.getPkCorp());
|
iaMonthledgerEntity.setPkCorp(bdCorpEntity.getPkCorp());
|
||||||
iaMonthledgerEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
iaMonthledgerEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
||||||
|
@ -619,6 +627,26 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//取期初价格,需要总价nabmny/数量nabnum,保留四位小数
|
||||||
|
IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||||
|
iaPeriodaccountEntity.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
|
||||||
|
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<>();
|
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||||
|
@ -636,7 +664,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
||||||
}
|
}
|
||||||
return totalPayAmount;
|
return totalPayAmount;
|
||||||
}else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +677,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
|
||||||
List<BdDefdocEntity> defdocEntityList = queryU8CEntityUtil.queryBdDefDocByListCode("BDDP");
|
List<BdDefdocEntity> defdocEntityList = queryU8CEntityUtil.queryBdDefDocByListCode("BDDP");
|
||||||
|
|
||||||
for (BdDefdocEntity bdDefdocEntity : defdocEntityList) {
|
for (BdDefdocEntity bdDefdocEntity : defdocEntityList) {
|
||||||
if (companyCode.equals(bdDefdocEntity.getDoccode())){
|
if (companyCode.equals(bdDefdocEntity.getDoccode())) {
|
||||||
return bdDefdocEntity.getMemo();
|
return bdDefdocEntity.getMemo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue