Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
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
huluobin
dc-java
Commits
09f94416
Commit
09f94416
authored
Apr 03, 2019
by
wutong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动周转修改异常提醒只存一条, 并清理停止监控的SKU-仓库.
parent
4fe27d36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
38 deletions
+29
-38
AutoTurnoverJob.java
...over/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
+29
-38
No files found.
data-show/show-auto-turnover/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
View file @
09f94416
...
...
@@ -373,7 +373,7 @@ public class AutoTurnoverJob extends PointJob {
}
//自动下单管理的冗余-缺货等异常提醒
unusualFluctuation
(
bailunSku
,
warehouseCode
,
dcAutoTurnover
,
avgHistoryThreedaySales
,
forecastFluctuationList
);
unusualFluctuation
(
dcAutoConfigSkuWarehouse
,
bailunSku
,
warehouseCode
,
dcAutoTurnover
,
avgHistoryThreedaySales
,
forecastFluctuationList
);
//拿一下2倍周转期内的入库总数
Integer
quantityInbound
=
0
;
...
...
@@ -504,6 +504,11 @@ public class AutoTurnoverJob extends PointJob {
private
boolean
actualForecastFluctuations
(
LocalDate
recordTime
,
List
<
BigDecimal
>
forecastSalesList
,
Integer
realInventory
,
BigDecimal
totalSafeInventory
,
Integer
outStock
,
DcAutoConfigSkuWarehouse
dcAutoConfigSkuWarehouse
,
BigDecimal
avgHistoryFourteendaySales
,
BigDecimal
avgHistoryThreedaySales
,
List
<
DcAutoForecastFluctuation
>
forecastFluctuationList
)
{
boolean
hasMonitorFluctuation
=
false
;
//默认是停止了监控波动功能的
/*
* 如果没有配置停止监控
* 库存大于0或者平均销量大于0
* 那就要监控波动
*/
if
((
dcAutoConfigSkuWarehouse
==
null
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
))
||
(
dcAutoConfigSkuWarehouse
!=
null
&&
dcAutoConfigSkuWarehouse
.
getStatus
()
==
0
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)))
{
hasMonitorFluctuation
=
true
;
DcAutoForecastFluctuation
dcAutoForecastFluctuationActual
=
null
;
...
...
@@ -536,47 +541,34 @@ public class AutoTurnoverJob extends PointJob {
* @param dcAutoTurnover
* @param forecastFluctuationList
*/
private
void
unusualFluctuation
(
String
bailunSku
,
String
warehouseCode
,
DcAutoTurnover
dcAutoTurnover
,
BigDecimal
avgHistoryThreedaySales
,
List
<
DcAutoForecastFluctuation
>
forecastFluctuationList
)
{
if
(
forecastFluctuationList
!=
null
&&
forecastFluctuationList
.
size
()
>
0
)
{
try
{
DcAutoForecastFluctuationMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoForecastFluctuationMapper
.
class
);
for
(
DcAutoForecastFluctuation
autoForecastFluctuation
:
forecastFluctuationList
)
{
autoForecastFluctuation
.
setBailunSku
(
bailunSku
);
autoForecastFluctuation
.
setWarehouseCode
(
warehouseCode
);
autoForecastFluctuation
.
setWarehouseName
(
dcAutoTurnover
.
getWarehouseName
());
autoForecastFluctuation
.
setAvgSalesThree
(
avgHistoryThreedaySales
);
//如果开始时间和结束时间 在表有, 就不修改
//如果开始时间和结束时间 不在表内已有的部分, 新增
DcAutoForecastFluctuation
dcAutoForecastFluctuationSelected
=
mapper
.
selectOneByExample
(
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
().
andBailunSkuEqualTo
(
bailunSku
).
andWarehouseCodeEqualTo
(
warehouseCode
).
andTypeEqualTo
(
autoForecastFluctuation
.
getType
()).
andStartTimeGreaterThanOrEqualTo
(
autoForecastFluctuation
.
getStartTime
()).
andEndTimeLessThanOrEqualTo
(
autoForecastFluctuation
.
getEndTime
()).
example
());
//如果autoForecastFluctuation开始时间 小于 表里记录的开始时间, 小于等于 表里记录的结束时间
private
void
unusualFluctuation
(
DcAutoConfigSkuWarehouse
dcAutoConfigSkuWarehouse
,
String
bailunSku
,
String
warehouseCode
,
DcAutoTurnover
dcAutoTurnover
,
BigDecimal
avgHistoryThreedaySales
,
List
<
DcAutoForecastFluctuation
>
forecastFluctuationList
)
{
//status` '监控状态, 默认0监控, 停止监控1',
try
{
DcAutoForecastFluctuationMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoForecastFluctuationMapper
.
class
);
if
(
dcAutoConfigSkuWarehouse
==
null
||
dcAutoConfigSkuWarehouse
.
getStatus
().
equals
(
0
))
{
if
(
forecastFluctuationList
!=
null
&&
forecastFluctuationList
.
size
()
>
0
)
{
//拿最早的时间 + 最晚的时间, SKU-仓库维度只放一条
DcAutoForecastFluctuation
dcAutoForecastFluctuation
=
forecastFluctuationList
.
get
(
0
);
dcAutoForecastFluctuation
.
setEndTime
(
forecastFluctuationList
.
get
(
forecastFluctuationList
.
size
()
-
1
).
getEndTime
());
dcAutoForecastFluctuation
.
setBailunSku
(
bailunSku
);
dcAutoForecastFluctuation
.
setWarehouseCode
(
warehouseCode
);
dcAutoForecastFluctuation
.
setWarehouseName
(
dcAutoTurnover
.
getWarehouseName
());
dcAutoForecastFluctuation
.
setAvgSalesThree
(
avgHistoryThreedaySales
);
DcAutoForecastFluctuation
dcAutoForecastFluctuationSelected
=
mapper
.
selectOneByExample
(
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
().
andBailunSkuEqualTo
(
bailunSku
).
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
if
(
dcAutoForecastFluctuationSelected
!=
null
)
{
if
(
autoForecastFluctuation
.
getStartTime
().
compareTo
(
dcAutoForecastFluctuationSelected
.
getStartTime
())
==
-
1
&&
autoForecastFluctuation
.
getEndTime
().
compareTo
(
dcAutoForecastFluctuationSelected
.
getEndTime
())
<=
0
)
{
autoForecastFluctuation
.
setEndTime
(
dcAutoForecastFluctuationSelected
.
getStartTime
().
isAfter
(
autoForecastFluctuation
.
getEndTime
())
?
autoForecastFluctuation
.
getEndTime
()
:
dcAutoForecastFluctuationSelected
.
getStartTime
());
mapper
.
insertSelective
(
autoForecastFluctuation
);
//如果autoForecastFluctuation开始时间 小于 表里记录的开始时间, 大于 表里记录的结束时间
}
else
if
(
autoForecastFluctuation
.
getStartTime
().
isBefore
(
dcAutoForecastFluctuationSelected
.
getStartTime
())
&&
autoForecastFluctuation
.
getEndTime
().
isAfter
(
dcAutoForecastFluctuationSelected
.
getEndTime
()))
{
LocalDate
tempEndTime
=
autoForecastFluctuation
.
getEndTime
();
autoForecastFluctuation
.
setEndTime
(
dcAutoForecastFluctuationSelected
.
getStartTime
().
minusDays
(
1
));
mapper
.
insertSelective
(
autoForecastFluctuation
);
autoForecastFluctuation
.
setStartTime
(
dcAutoForecastFluctuationSelected
.
getEndTime
().
minusDays
(
1
));
autoForecastFluctuation
.
setEndTime
(
tempEndTime
);
mapper
.
insertSelective
(
autoForecastFluctuation
);
//如果autoForecastFluctuation开始时间 大于等于 表里记录的开始时间, 大于 表里记录的结束时间
}
else
if
(
autoForecastFluctuation
.
getStartTime
().
compareTo
(
dcAutoForecastFluctuationSelected
.
getStartTime
())
>=
0
&&
autoForecastFluctuation
.
getEndTime
().
isAfter
(
dcAutoForecastFluctuationSelected
.
getEndTime
()))
{
autoForecastFluctuation
.
setStartTime
(
dcAutoForecastFluctuationSelected
.
getEndTime
());
autoForecastFluctuation
.
setEndTime
(
autoForecastFluctuation
.
getEndTime
());
mapper
.
insertSelective
(
autoForecastFluctuation
);
}
dcAutoForecastFluctuation
.
setStartTime
(
dcAutoForecastFluctuationSelected
.
getStartTime
());
mapper
.
updateByExampleSelective
(
dcAutoForecastFluctuation
,
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
().
andBailunSkuEqualTo
(
dcAutoForecastFluctuation
.
getBailunSku
()).
andWarehouseCodeEqualTo
(
dcAutoForecastFluctuation
.
getWarehouseCode
()).
example
());
}
else
{
mapper
.
insertSelective
(
a
utoForecastFluctuation
);
mapper
.
insertSelective
(
dcA
utoForecastFluctuation
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"MYBATIS操作DB失败"
,
e
);
}
finally
{
SessionUtil
.
closeSession
();
}
else
if
(
dcAutoConfigSkuWarehouse
!=
null
&&
dcAutoConfigSkuWarehouse
.
getStatus
().
equals
(
1
))
{
mapper
.
deleteByExample
(
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
().
andBailunSkuEqualTo
(
bailunSku
).
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"MYBATIS操作DB存DcAutoForecastFluctuation失败"
,
e
);
}
finally
{
SessionUtil
.
closeSession
();
}
}
...
...
@@ -1164,7 +1156,6 @@ public class AutoTurnoverJob extends PointJob {
*/
if
(
j
<=
turnoverDays
&&
hasMonitorFluctuation
)
{
BigDecimal
forecastShortSupplyDayJ
=
j
==
0
?
forecastShortSupplyList
.
get
(
j
)
:
forecastShortSupplyList
.
get
(
j
).
subtract
(
forecastShortSupplyList
.
get
(
j
-
1
));
// if (forecastShortSupplyDayJ.doubleValue() > 0) {
if
(
forecastInventory
.
compareTo
(
totalSafeInventory
.
add
(
forecastSalesList
.
get
(
j
)))
==
-
1
)
{
//预测断货, 需要检查前一天有没有预测冗余
if
(
forecastFluctuationDays
>
0
)
{
...
...
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