Commit fed8fdef by yinyong

数据中心--资产负债表在库、在库金额计算修改

parent 6825454c
...@@ -39,12 +39,13 @@ public class OrderSyncJob extends PointJob { ...@@ -39,12 +39,13 @@ public class OrderSyncJob extends PointJob {
@Override @Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) { public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
LinkedHashMap<String, String> map = new LinkedHashMap<>(4); LinkedHashMap<String, String> map = new LinkedHashMap<>(5);
//临时处理速卖通数据 //临时处理速卖通数据
map.put("pageCount", jobPointLog.getPageSize().toString()); map.put("pageCount", jobPointLog.getPageSize().toString());
//时间回退一点, 避免服务器时间不一致而漏单 //时间回退一点, 避免服务器时间不一致而漏单
map.put("TimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3))); map.put("TimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3)));
map.put("TimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime())); map.put("TimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime()));
map.put("DateType", "purchaseTime");
do { do {
map.put("pageIndex", jobPointLog.getPageIndex().equals(0) ? "1" : jobPointLog.getPageIndex().toString()); map.put("pageIndex", jobPointLog.getPageIndex().equals(0) ? "1" : jobPointLog.getPageIndex().toString());
Response response = null; Response response = null;
......
...@@ -38,6 +38,8 @@ public class DcBalanceSheet { ...@@ -38,6 +38,8 @@ public class DcBalanceSheet {
private BigDecimal notFbaInventoryAmount; private BigDecimal notFbaInventoryAmount;
private BigDecimal notFbaHcInventoryAmount;
private BigDecimal fbaTransferAmount; private BigDecimal fbaTransferAmount;
private BigDecimal notFbaTransferAmount; private BigDecimal notFbaTransferAmount;
......
...@@ -15,11 +15,10 @@ public interface DcInventoryBalanceMapper { ...@@ -15,11 +15,10 @@ public interface DcInventoryBalanceMapper {
* @param lastDay * @param lastDay
*/ */
@Insert("insert into dc_inventory_balance(warehouse_code,warehouse_name,hq_type,balance_rmb,statistical_time,is_transfer)" + @Insert("insert into dc_inventory_balance(warehouse_code,warehouse_name,hq_type,balance_rmb,statistical_time,is_transfer)" +
" select ds.warehouse_code,w.warehouse_name,w.hq_type,sum(ds.unit_price * (ds.usable_stock + ds.occupy_stock) * r.exchange_rate),#{lastDay},0" + " select ds.warehouse_code,w.warehouse_name,w.hq_type,sum(ds.unit_price * (ds.usable_stock + ds.occupy_stock)),#{lastDay},0" +
" from dc_daily_stock ds left join dc_base_sku s on ds.bailun_sku = s.bailun_sku" + " from dc_daily_stock ds left join dc_base_sku s on ds.bailun_sku = s.bailun_sku" +
" left join dc_base_warehouse w on ds.warehouse_code = w.warehouse_code" + " left join dc_base_warehouse w on ds.warehouse_code = w.warehouse_code" +
" left join dc_exchange_rate r on s.currency = r.init_curreny" + " where ds.record_time = #{lastDay}" +
" where ds.record_time = #{lastDay} and r.final_curreny = 'CNY' and r.record_time = #{lastDay}" +
" group by ds.warehouse_code,w.warehouse_name,w.hq_type") " group by ds.warehouse_code,w.warehouse_name,w.hq_type")
void insertInventoryBalance(@Param("lastDay")Date lastDay); void insertInventoryBalance(@Param("lastDay")Date lastDay);
...@@ -28,13 +27,12 @@ public interface DcInventoryBalanceMapper { ...@@ -28,13 +27,12 @@ public interface DcInventoryBalanceMapper {
* @param lastDay * @param lastDay
*/ */
@Insert("insert into dc_inventory_balance(warehouse_code,warehouse_name,hq_type,balance_rmb,statistical_time,is_transfer,transfer_rmb,transfer_plan_rmb,purchase_rmb)" + @Insert("insert into dc_inventory_balance(warehouse_code,warehouse_name,hq_type,balance_rmb,statistical_time,is_transfer,transfer_rmb,transfer_plan_rmb,purchase_rmb)" +
" select t.warehouse_code,w.warehouse_name,w.hq_type,sum((s.unit_price * t.quantity_transfer * r.exchange_rate) + (s.unit_price * t.quantity_purchase * r.exchange_rate))," + " select t.warehouse_code,w.warehouse_name,w.hq_type,sum((s.unit_price * t.quantity_transfer) + (s.unit_price * t.quantity_purchase))," +
"#{lastDay},1,sum(s.unit_price * (t.quantity_transfer - t.quantity_transfer_plan) * r.exchange_rate),sum(s.unit_price * t.quantity_transfer_plan * r.exchange_rate)," + "#{lastDay},1,sum(s.unit_price * (t.quantity_transfer - t.quantity_transfer_plan)),sum(s.unit_price * t.quantity_transfer_plan)," +
"sum(s.unit_price * t.quantity_purchase * r.exchange_rate)" + "sum(s.unit_price * t.quantity_purchase)" +
" from dc_daily_transit t left join dc_base_sku s on t.bailun_sku = s.bailun_sku" + " from dc_daily_transit t left join dc_base_sku s on t.bailun_sku = s.bailun_sku" +
" left join dc_base_warehouse w on t.warehouse_code = w.warehouse_code" + " left join dc_base_warehouse w on t.warehouse_code = w.warehouse_code" +
" left join dc_exchange_rate r on s.currency = r.init_curreny" + " where t.record_time = #{lastDay}" +
" where t.record_time = #{lastDay} and r.final_curreny = 'CNY' and r.record_time = #{lastDay}" +
" group by t.warehouse_code,w.warehouse_name,w.hq_type") " group by t.warehouse_code,w.warehouse_name,w.hq_type")
void insertTransferInventoryBalance(@Param("lastDay")Date lastDay); void insertTransferInventoryBalance(@Param("lastDay")Date lastDay);
...@@ -59,9 +57,12 @@ public interface DcInventoryBalanceMapper { ...@@ -59,9 +57,12 @@ public interface DcInventoryBalanceMapper {
* @param lastDay * @param lastDay
* @return * @return
*/ */
@Select("select sum(balance_rmb) from dc_inventory_balance where statistical_time = #{lastDay} and hq_type<>'FBA仓' and is_transfer=0") @Select("select sum(balance_rmb) from dc_inventory_balance where statistical_time = #{lastDay} and hq_type<>'FBA仓' and hq_type<>'耗材仓' and is_transfer=0")
BigDecimal getNotFbaInventoryAmountSum(@Param("lastDay")Date lastDay); BigDecimal getNotFbaInventoryAmountSum(@Param("lastDay")Date lastDay);
@Select("select sum(balance_rmb) from dc_inventory_balance where statistical_time = #{lastDay} and hq_type<>'FBA仓' and hq_type = '耗材仓' and is_transfer=0")
BigDecimal getNotFbaHcInventoryAmountSum(@Param("lastDay")Date lastDay);
/** /**
* 获取FBA在途金额(调拨+采购) * 获取FBA在途金额(调拨+采购)
* @param lastDay * @param lastDay
......
...@@ -423,11 +423,15 @@ public class BalanceSheetService { ...@@ -423,11 +423,15 @@ public class BalanceSheetService {
BigDecimal fbaInventoryAmountSum = dcInventoryBalanceMapper.getFbaInventoryAmountSum(date); BigDecimal fbaInventoryAmountSum = dcInventoryBalanceMapper.getFbaInventoryAmountSum(date);
if(fbaInventoryAmountSum == null) fbaInventoryAmountSum = BigDecimal.ZERO; if(fbaInventoryAmountSum == null) fbaInventoryAmountSum = BigDecimal.ZERO;
dcBalanceSheet.setFbaInventoryAmount(fbaInventoryAmountSum); dcBalanceSheet.setFbaInventoryAmount(fbaInventoryAmountSum);
// 非FBA在库金额 // 非FBA在库金额(不包含耗材仓)
BigDecimal notFbaInventoryAmountSum = dcInventoryBalanceMapper.getNotFbaInventoryAmountSum(date); BigDecimal notFbaInventoryAmountSum = dcInventoryBalanceMapper.getNotFbaInventoryAmountSum(date);
if(notFbaInventoryAmountSum == null) notFbaInventoryAmountSum = BigDecimal.ZERO; if(notFbaInventoryAmountSum == null) notFbaInventoryAmountSum = BigDecimal.ZERO;
dcBalanceSheet.setNotFbaInventoryAmount(notFbaInventoryAmountSum); dcBalanceSheet.setNotFbaInventoryAmount(notFbaInventoryAmountSum);
// FBA在途金额(调拨+采购) // 非FBA在库金额(耗材仓)
BigDecimal notFbaHcInventoryAmountSum = dcInventoryBalanceMapper.getNotFbaHcInventoryAmountSum(date);
if(notFbaHcInventoryAmountSum == null) notFbaHcInventoryAmountSum = BigDecimal.ZERO;
dcBalanceSheet.setNotFbaHcInventoryAmount(notFbaHcInventoryAmountSum);
// FBA在途
BigDecimal fbaTransferAmountSum = dcInventoryBalanceMapper.getFbaTransferAmountSum(date); BigDecimal fbaTransferAmountSum = dcInventoryBalanceMapper.getFbaTransferAmountSum(date);
if(fbaTransferAmountSum == null) fbaTransferAmountSum = BigDecimal.ZERO; if(fbaTransferAmountSum == null) fbaTransferAmountSum = BigDecimal.ZERO;
dcBalanceSheet.setFbaTransferAmount(fbaTransferAmountSum); dcBalanceSheet.setFbaTransferAmount(fbaTransferAmountSum);
......
...@@ -302,6 +302,9 @@ ...@@ -302,6 +302,9 @@
<if test="notFbaInventoryAmount != null"> <if test="notFbaInventoryAmount != null">
not_fba_inventory_amount = #{notFbaInventoryAmount,jdbcType=DECIMAL}, not_fba_inventory_amount = #{notFbaInventoryAmount,jdbcType=DECIMAL},
</if> </if>
<if test="notFbaHcInventoryAmount != null">
not_fba_hc_inventory_amount = #{notFbaHcInventoryAmount,jdbcType=DECIMAL},
</if>
<if test="fbaTransferAmount != null"> <if test="fbaTransferAmount != null">
fba_transfer_amount = #{fbaTransferAmount,jdbcType=DECIMAL}, fba_transfer_amount = #{fbaTransferAmount,jdbcType=DECIMAL},
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment