Commit 64f21390 by 泽锋 李

fix

parent 6e8b9dba
......@@ -58,9 +58,10 @@ namespace AutoTurnOver.DB
var page = 1;
var data_skus = new List<dc_base_trans_temp_schedule>();
while (true)
{
var data_skus = new List<dc_base_trans_temp_schedule>();
var datas = ApiUtility.GetTransOrderTempSchedule(new_task_synchro_log.start_time, new_task_synchro_log.end_time, page);
if (datas == null || datas.Count <= 0)
{
......@@ -123,83 +124,85 @@ namespace AutoTurnOver.DB
}
}
if (data_skus != null && data_skus.Count >= 1)
{
// 计算相关sku的总在途
var temp_datas = _connection.Query<temp_sum_dto>(@"select sku_ware_no,sku as 'bailun_sku',target_ware_no as 'warehouse_code',sum(product_num) as 'count' from dc_base_trans_temp_schedule
if (data_skus != null && data_skus.Count >= 1)
{
// 计算相关sku的总在途
var temp_datas = _connection.Query<temp_sum_dto>(@"select sku_ware_no,sku as 'bailun_sku',target_ware_no as 'warehouse_code',sum(product_num) as 'count' from dc_base_trans_temp_schedule
where is_delete=0 and is_temp_data=1 and is_exception=0 and create_state=@create_state
and sku_ware_no in @sku_ware_nos
GROUP BY sku_ware_no", new { sku_ware_nos = data_skus.Select(s => s.sku_ware_no).Distinct().ToList(), create_state = (int)dc_base_trans_temp_schedule_create_state_enum.未创建 });
foreach (var item in temp_datas)
{
if (item.bailun_sku == "945333402" && item.warehouse_code == "GBFBABLA")
foreach (var item in temp_datas)
{
if (item.bailun_sku == "945333402" && item.warehouse_code == "GBFBABLA")
{
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temp_schedule=@quantity_transfer_temp_schedule where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.bailun_sku,
warehouse_code = item.warehouse_code,
quantity_transfer_temp_schedule = item.count
});
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temp_schedule=@quantity_transfer_temp_schedule where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.bailun_sku,
warehouse_code = item.warehouse_code,
quantity_transfer_temp_schedule = item.count
});
}
var data_0 = data_skus.Where(s => !temp_datas.Any(v => v.sku_ware_no == s.sku_ware_no)).ToList();
if (data_0 != null && data_0.Count >= 1)
{
foreach (var item in data_0.Select(s => new { s.sku, s.target_ware_no }).Distinct())
var data_0 = data_skus.Where(s => !temp_datas.Any(v => v.sku_ware_no == s.sku_ware_no)).ToList();
if (data_0 != null && data_0.Count >= 1)
{
if (item.sku == "945333402" && item.target_ware_no == "GBFBABLA")
foreach (var item in data_0.Select(s => new { s.sku, s.target_ware_no }).Distinct())
{
if (item.sku == "945333402" && item.target_ware_no == "GBFBABLA")
{
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temp_schedule=0 where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.sku,
warehouse_code = item.target_ware_no
});
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temp_schedule=0 where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.sku,
warehouse_code = item.target_ware_no
});
}
}
// 计算相关sku的总暂存
var temp_datas2 = _connection.Query<temp_sum_dto>(@"select sku_ware_no,sku as 'bailun_sku',target_ware_no as 'warehouse_code',sum(temp_delivery_count) as 'count' from dc_base_trans_temp_schedule
// 计算相关sku的总暂存
var temp_datas2 = _connection.Query<temp_sum_dto>(@"select sku_ware_no,sku as 'bailun_sku',target_ware_no as 'warehouse_code',sum(temp_delivery_count) as 'count' from dc_base_trans_temp_schedule
where is_delete=0 and is_temp_data=1 and is_exception=0 and create_state=@create_state
and sku_ware_no in @sku_ware_nos
GROUP BY sku_ware_no", new { sku_ware_nos = data_skus.Select(s => s.sku_ware_no).Distinct().ToList(), create_state = (int)dc_base_trans_temp_schedule_create_state_enum.已暂存 });
foreach (var item in temp_datas2)
{
if (item.bailun_sku == "945333402" && item.warehouse_code == "GBFBABLA")
foreach (var item in temp_datas2)
{
if (item.bailun_sku == "945333402" && item.warehouse_code == "GBFBABLA")
{
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temporary_storage=@quantity_transfer_temporary_storage where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.bailun_sku,
warehouse_code = item.warehouse_code,
quantity_transfer_temporary_storage = item.count
});
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temporary_storage=@quantity_transfer_temporary_storage where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.bailun_sku,
warehouse_code = item.warehouse_code,
quantity_transfer_temporary_storage = item.count
});
}
var data_1 = data_skus.Where(s => !temp_datas2.Any(v => v.sku_ware_no == s.sku_ware_no)).ToList();
if (data_1 != null && data_1.Count >= 1)
{
foreach (var item in data_1.Select(s => new { s.sku, s.target_ware_no }).Distinct())
var data_1 = data_skus.Where(s => !temp_datas2.Any(v => v.sku_ware_no == s.sku_ware_no)).ToList();
if (data_1 != null && data_1.Count >= 1)
{
if (item.sku == "945333402" && item.target_ware_no == "GBFBABLA")
foreach (var item in data_1.Select(s => new { s.sku, s.target_ware_no }).Distinct())
{
if (item.sku == "945333402" && item.target_ware_no == "GBFBABLA")
{
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temporary_storage=0 where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.sku,
warehouse_code = item.target_ware_no
});
}
_connection.Execute("update dc_mid_transit set quantity_transfer_temporary_storage=0 where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ", new
{
bailun_sku = item.sku,
warehouse_code = item.target_ware_no
});
}
}
}
if (!is_all)
{
......
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