varlast_task_synchro_log=conn.QuerySingleOrDefault<task_synchro_log>(" select * from task_synchro_log where task_name=@task_name and status=1 order by end_time desc limit 1 ",new{task_name=task_name});
vardatas=_connection.Query<SynchroReportGoodsStockDataDto>($@" select t2.product_code,t1.warehouse_code from dc_mid_transit as t1 left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
where (t1.gmt_purchase_modified>=@start_time and t1.gmt_purchase_modified<=@end_time) or (t1.gmt_transfer_modified>=@start_time and t1.gmt_transfer_modified<=@end_time) limit {(page-1)*rows},{rows} ",new
{
end_time=new_task_synchro_log.end_time,
start_time=new_task_synchro_log.start_time
}).ToList();
if(datas==null||datas.Count<=0)
{
break;
}
page++;
foreach(varitemindatas)
{
vardc_report_goods_data=_connection.QuerySingleOrDefault<dc_report_goods>(" select * from dc_report_goods where product_code=@product_code and warehouse_code=@warehouse_code ",new
{
product_code=item.product_code,
warehouse_code=item.warehouse_code
});
if(dc_report_goods_data!=null)
{
// 查询商品库存
dc_report_goods_data.on_the_way_quantity=_connection.QuerySingleOrDefault<int?>(@" select sum(quantity_purchase+quantity_transfer) from dc_mid_transit as t1 left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku where t2.product_code=@product_code and t1.warehouse_code=@warehouse_code ",new