Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
data-center-auto
Commits
e18e5b68
Commit
e18e5b68
authored
Mar 22, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
库容默认开启监控
parent
ea68ecf9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
15 deletions
+55
-15
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+18
-0
dc_base_storage_capacity_dao.cs
AutoTurnOver.DB/dc_base_storage_capacity_dao.cs
+22
-13
dc_auto_turnover.cs
AutoTurnOver.Models/dc_auto_turnover.cs
+13
-1
SkuAutoTurnServices.cs
AutoTurnOver.Services/SkuAutoTurnServices.cs
+2
-1
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
e18e5b68
...
...
@@ -77,6 +77,7 @@ t13.quantity_transfer_temp_schedule as 'quantity_transfer_temp_schedule',
t13.quantity_transfer_temporary_storage as 'quantity_transfer_temporary_storage',
(case when t3.hq_type='国内仓' then t4.supplier_delivery else t4.transfer_delivery end ) as 'supplier_delivery_config',
dat.quantity_final_advise - t17.stock as 'storage_capacity_lack_quantity',
t13.quantity_land_purchase as 'quantity_land_purchase',
t13.quantity_ocean_purchase as 'quantity_ocean_purchase',
...
...
@@ -109,6 +110,7 @@ left join dc_return_goods_not_push as t12 on dat.bailun_sku = t12.bailun_sku and
left join dc_mid_transit as t13 on dat.bailun_sku = t13.bailun_sku and dat.warehouse_code = t13.warehouse_code
-- left join dc_auto_sales_forecast_config as t14 on dat.dc_auto_sales_forecast_config_id = t14.id
-- left join not_trans_view as t15 on dat.bailun_sku = t15.bailun_sku and dat.warehouse_code = t15.warehouse_code
left join dc_base_storage_capacity as t17 on dat.bailun_sku_warehouse_code = t17.bailun_sku_warehouse_code
"
;
}
...
...
@@ -155,6 +157,10 @@ from dc_auto_turnover as dat
{
sqlCount
+=
" left join not_trans_view as t15 on dat.bailun_sku = t15.bailun_sku and dat.warehouse_code = t15.warehouse_code "
;
}
if
(
m
.
storage_capacity_lack_quantity_max
>
0
||
m
.
storage_capacity_lack_quantity_min
>
0
)
{
sqlCount
+=
" inner join dc_base_storage_capacity as t17 on dat.bailun_sku_warehouse_code = t17.bailun_sku_warehouse_code "
;
}
sqlCount
+=
" where 1=1 "
;
sql
+=
" where 1=1 "
;
var
whereSql
=
""
;
...
...
@@ -376,6 +382,18 @@ from dc_auto_turnover as dat
sqlCount
+=
" and t2.oneday_sales<=@oneday_sales_max "
;
parameters
.
Add
(
"oneday_sales_max"
,
m
.
oneday_sales_max
);
}
if
(
m
.
storage_capacity_lack_quantity_min
!=
null
)
{
whereSql
+=
" and (dat.quantity_final_advise - t17.stock )>=@storage_capacity_lack_quantity_min "
;
sqlCount
+=
" and (dat.quantity_final_advise - t17.stock )>=@storage_capacity_lack_quantity_min "
;
parameters
.
Add
(
"storage_capacity_lack_quantity_min"
,
m
.
storage_capacity_lack_quantity_min
);
}
if
(
m
.
storage_capacity_lack_quantity_max
!=
null
)
{
whereSql
+=
" and (dat.quantity_final_advise - t17.stock )<=@storage_capacity_lack_quantity_max "
;
sqlCount
+=
" and (dat.quantity_final_advise - t17.stock )<=@storage_capacity_lack_quantity_max "
;
parameters
.
Add
(
"storage_capacity_lack_quantity_max"
,
m
.
storage_capacity_lack_quantity_max
);
}
if
(
m
.
avg_type
>
0
)
{
var
field_str
=
""
;
...
...
AutoTurnOver.DB/dc_base_storage_capacity_dao.cs
View file @
e18e5b68
...
...
@@ -57,7 +57,7 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
total
=
_connection
.
QuerySingleOrDefault
<
int
>(
"select count(0) from ("
+
sql
+
") tb1"
,
parameters
);
var
obj
=
_connection
.
Query
<
dc_base_storage_capacity_dto
>(
sql
+
" limit "
+
offset
+
","
+
limit
,
parameters
);
var
obj
=
_connection
.
Query
<
dc_base_storage_capacity_dto
>(
sql
+
" limit "
+
offset
+
","
+
limit
,
parameters
);
return
obj
.
AsList
();
...
...
@@ -135,7 +135,7 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where 1 = 1 "
;
DynamicParameters
parameters
=
new
DynamicParameters
();
sql
+=
" and bailun_sku_warehouse_code in @bailun_sku_warehouse_codes"
;
parameters
.
Add
(
"bailun_sku_warehouse_codes"
,
query
.
datas
.
Select
(
s
=>
$"
{
s
.
bailun_sku
}{
s
.
warehouse_code
}
"
).
ToList
());
parameters
.
Add
(
"bailun_sku_warehouse_codes"
,
query
.
datas
.
Select
(
s
=>
$"
{
s
.
bailun_sku
}{
s
.
warehouse_code
}
"
).
ToList
());
return
_connection
.
Query
<
dc_base_storage_capacity_dto
>(
sql
,
parameters
).
ToList
();
}
...
...
@@ -148,7 +148,7 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
{
throw
new
Exception
(
"创建人必填"
);
}
var
type_enum
=
(
dc_base_storage_capacity_log_enum
)
data
.
type
;
var
type_enum
=
(
dc_base_storage_capacity_log_enum
)
data
.
type
;
data
.
bailun_sku_warehouse_code
=
$"
{
data
.
bailun_sku
}{
data
.
warehouse_code
}
"
;
var
conn
=
MyMySqlConnection
.
_connection
;
conn
.
Open
();
...
...
@@ -174,10 +174,19 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
update_date
=
DateTime
.
Now
,
version
=
0
};
mainData
.
id
=
conn
.
Insert
(
mainData
)??
0
;
mainData
.
id
=
conn
.
Insert
(
mainData
)
??
0
;
// 添加库容监控
conn
.
Insert
<
dc_base_storage_capacity_config
>(
new
dc_base_storage_capacity_config
{
bailun_sku
=
mainData
.
bailun_sku
,
bailun_sku_warehouse_code
=
mainData
.
bailun_sku_warehouse_code
,
status
=
1
,
warehouse_code
=
mainData
.
warehouse_code
});
}
if
(
type_enum
==
dc_base_storage_capacity_log_enum
.
导入
)
if
(
type_enum
==
dc_base_storage_capacity_log_enum
.
导入
)
{
mainData
.
stock
=
0
;
}
...
...
@@ -198,7 +207,7 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
version
=
mainData
.
version
,
bailun_sku_warehouse_code
=
mainData
.
bailun_sku_warehouse_code
,
old_version
=
old_version
});
});
if
(
line_count
<=
0
)
{
...
...
@@ -217,9 +226,9 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
}
//更新母sku库容
dc_base_mother_sku_dao
.
ResetStorageCapacityByMapSku
(
data
.
bailun_sku
,
data
.
warehouse_code
,
new
UserData
{
UserName
=
data
.
create_user
});
dc_base_mother_sku_dao
.
ResetStorageCapacityByMapSku
(
data
.
bailun_sku
,
data
.
warehouse_code
,
new
UserData
{
UserName
=
data
.
create_user
});
if
(
type_enum
==
dc_base_storage_capacity_log_enum
.
导入
)
if
(
type_enum
==
dc_base_storage_capacity_log_enum
.
导入
)
{
// 如果是导入库容,则需要扣采购在途、采购临时
}
...
...
@@ -255,15 +264,15 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where
/// <summary>
/// 计算增量值
/// </summary>
public
static
decimal
CalculationVal
(
dc_base_storage_capacity_log_enum
type
,
decimal
val
)
public
static
decimal
CalculationVal
(
dc_base_storage_capacity_log_enum
type
,
decimal
val
)
{
if
(((
int
)
type
)
%
2
==
0
)
if
(((
int
)
type
)
%
2
==
0
)
{
return
(
0
-
val
);
return
(
0
-
val
);
}
else
{
return
(
val
);
return
(
val
);
}
}
...
...
AutoTurnOver.Models/dc_auto_turnover.cs
View file @
e18e5b68
...
...
@@ -711,6 +711,12 @@ namespace AutoTurnOver.Models
[
Description
(
"日均(最大)"
)]
public
int
?
avg_sales_max
{
get
;
set
;
}
[
Description
(
"库容缺少值(最小)"
)]
public
int
?
storage_capacity_lack_quantity_min
{
get
;
set
;
}
[
Description
(
"库容缺少值(最大)"
)]
public
int
?
storage_capacity_lack_quantity_max
{
get
;
set
;
}
[
Description
(
"产品类型"
)]
public
string
product_type
{
get
;
set
;
}
}
...
...
@@ -791,7 +797,13 @@ namespace AutoTurnOver.Models
public
class
dc_auto_turnover_list_dto
{
private
decimal
_storage_capacity_lack_quantity
;
/// <summary>
/// 库容缺少值
/// </summary>
public
decimal
storage_capacity_lack_quantity
{
get
{
return
Math
.
Max
(
0
,
_storage_capacity_lack_quantity
);
}
set
{
_storage_capacity_lack_quantity
=
value
;
}
}
/// <summary>
/// Walmart 过去7日销量(日均)
/// </summary>
...
...
AutoTurnOver.Services/SkuAutoTurnServices.cs
View file @
e18e5b68
...
...
@@ -320,7 +320,7 @@ namespace AutoTurnOver.Services
,
"调拨陆运在途数量"
,
"调拨海运在途数量"
,
"调拨空运在途数量"
,
"调拨铁路在途数量"
,
"首次入库时间"
,
"供应链累计销量"
,
"销量预测规则"
,
"默认头程运输方式"
,
"默认头程渠道"
,
"计算时间"
,
"日均出单次数"
,
"首次出单日期"
,
"首次出单订单号"
,
"备货数量"
,
"产品类型"
,
"头程平均值取值来源"
,
"Walmart最近7天日均销量"
,
"Walmart最近14天日均销量"
,
"Walmart最近30天日均销量"
,
"平均交期"
,
"配置交期"
"平均交期"
,
"配置交期"
,
"库容缺少值"
};
foreach
(
var
item
in
cols
)
{
...
...
@@ -330,6 +330,7 @@ namespace AutoTurnOver.Services
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"库容缺少值"
]
=
itemData
.
storage_capacity_lack_quantity
;
row
[
"平均交期"
]
=
itemData
.
supplier_delivery
;
row
[
"配置交期"
]
=
itemData
.
supplier_delivery_config
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment