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
d23b71dc
Commit
d23b71dc
authored
Jan 12, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 周转父pom
parent
e89f77e7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
61 deletions
+16
-61
AutoTurnoverJob.java
...over/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
+9
-59
AutoTurnoverTest.java
...ow/show-auto-turnover/src/test/java/AutoTurnoverTest.java
+2
-2
pom.xml
pom.xml
+5
-0
No files found.
data-show/show-auto-turnover/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
View file @
d23b71dc
...
@@ -37,7 +37,6 @@ import java.time.LocalTime;
...
@@ -37,7 +37,6 @@ import java.time.LocalTime;
import
java.time.Period
;
import
java.time.Period
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -63,15 +62,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -63,15 +62,6 @@ public class AutoTurnoverJob extends PointJob {
AtomicInteger
countItem
=
new
AtomicInteger
(
0
);
AtomicInteger
countItem
=
new
AtomicInteger
(
0
);
ExecutorService
executorService
=
new
ThreadPoolExecutor
(
1000
,
1000
,
2
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingQueue
<>(),
Executors
.
defaultThreadFactory
(),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
for
(
int
page
=
jobPointLog
.
getPageIndex
();
page
<=
totalPage
;
page
++)
{
for
(
int
page
=
jobPointLog
.
getPageIndex
();
page
<=
totalPage
;
page
++)
{
//分页查SKU_仓库
//分页查SKU_仓库
...
@@ -393,6 +383,7 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -393,6 +383,7 @@ public class AutoTurnoverJob extends PointJob {
List
<
String
>
forecastInboundRelationList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
String
>
forecastInboundRelationList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
forecastSalesList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
forecastSalesList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
String
>
forecastSalesExplainList
=
new
ArrayList
<>(
forecastSalesList
.
size
());
List
<
String
>
forecastSalesExplainList
=
new
ArrayList
<>(
forecastSalesList
.
size
());
//七天实际断货+预测断货
List
<
BigDecimal
>
forecastShortSupplyList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
forecastShortSupplyList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
forecastPurchaseAdvisedList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
forecastPurchaseAdvisedList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
moqPurchaseAdvisedList
=
new
ArrayList
<>(
autoForecastDay
);
List
<
BigDecimal
>
moqPurchaseAdvisedList
=
new
ArrayList
<>(
autoForecastDay
);
...
@@ -417,22 +408,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -417,22 +408,6 @@ public class AutoTurnoverJob extends PointJob {
forecastSalesList
=
autoTurnoverService
.
getAutoTurnoverSaleDetails
(
dcAutoTurnover
,
turnoverDays
,
autoForecastDay
);
forecastSalesList
=
autoTurnoverService
.
getAutoTurnoverSaleDetails
(
dcAutoTurnover
,
turnoverDays
,
autoForecastDay
);
// calculateForecastSales(salesUpperLimit, autoForecastDay, dcAutoSales, forecastSalesList, turnoverSku, recordTime, bailunSku, warehouseCode, dcAutoWarehouseweekSales);
// calculateForecastSales(salesUpperLimit, autoForecastDay, dcAutoSales, forecastSalesList, turnoverSku, recordTime, bailunSku, warehouseCode, dcAutoWarehouseweekSales);
// /*周系数*/
// List<String> param = new ArrayList<>(Lists.newArrayList(dcAutoTurnover.getSalesDetails()
// .trim()
// .substring(1)
// .substring(0, dcAutoTurnover.getSalesDetails().length() - 2)
// .split(",")));
//
// List<BigDecimal> salesDetails = param.stream().map(var -> {
// try {
// String ss = var.trim();
// return new BigDecimal(ss);
// } catch (Exception ex) {
// throw ex;
// }
// }).collect(Collectors.toList());
// AtomicReference<LocalDate> localDate = new AtomicReference<>(LocalDate.now().minusDays(7));
AtomicReference
<
LocalDate
>
localDate
=
new
AtomicReference
<>(
LocalDate
.
now
());
AtomicReference
<
LocalDate
>
localDate
=
new
AtomicReference
<>(
LocalDate
.
now
());
List
<
SalesDetailItem
>
salesDetailItemList
=
forecastSalesList
.
stream
().
map
(
salesDetail
->
{
List
<
SalesDetailItem
>
salesDetailItemList
=
forecastSalesList
.
stream
().
map
(
salesDetail
->
{
...
@@ -706,6 +681,7 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -706,6 +681,7 @@ public class AutoTurnoverJob extends PointJob {
dcAutoForecastFluctuationActual
.
setType
(
1
);
dcAutoForecastFluctuationActual
.
setType
(
1
);
dcAutoForecastFluctuationActual
.
setQuantity
(
outStock
);
dcAutoForecastFluctuationActual
.
setQuantity
(
outStock
);
}
}
if
(
dcAutoForecastFluctuationActual
!=
null
)
{
if
(
dcAutoForecastFluctuationActual
!=
null
)
{
dcAutoForecastFluctuationActual
.
setAvgSalesThree
(
avgHistoryThreedaySales
);
dcAutoForecastFluctuationActual
.
setAvgSalesThree
(
avgHistoryThreedaySales
);
dcAutoForecastFluctuationActual
.
setStartTime
(
recordTime
);
dcAutoForecastFluctuationActual
.
setStartTime
(
recordTime
);
...
@@ -718,7 +694,7 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -718,7 +694,7 @@ public class AutoTurnoverJob extends PointJob {
* 自动下单管理的冗余-缺货等异常提醒
* 自动下单管理的冗余-缺货等异常提醒
*/
*/
if
(
hasMonitorFluctuation
)
{
if
(
hasMonitorFluctuation
)
{
unusualFluctuation
(
totalSafeInventory
,
unusualFluctuation
(
turnoverDays
,
turnoverDays
,
recordTime
,
recordTime
,
dcAutoConfigSkuWarehouse
,
dcAutoConfigSkuWarehouse
,
...
@@ -728,7 +704,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -728,7 +704,6 @@ public class AutoTurnoverJob extends PointJob {
avgHistoryThreedaySales
,
avgHistoryThreedaySales
,
forecastFluctuationList
,
forecastFluctuationList
,
forecastShortSupplyList
,
forecastShortSupplyList
,
forecastInventoryList
,
dcBaseStock
);
dcBaseStock
);
}
}
...
@@ -832,7 +807,7 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -832,7 +807,7 @@ public class AutoTurnoverJob extends PointJob {
//如果初始建议数 + 备货数 > moq建议数, 那么moq建议数 + 备货数, 否则, 还是取moq建议数
//如果初始建议数 + 备货数 > moq建议数, 那么moq建议数 + 备货数, 否则, 还是取moq建议数
BigDecimal
subtract
=
dcAutoTurnover
.
getQuantityInitAdvise
().
subtract
(
moqPurchaseAdvisedList
.
get
(
0
));
BigDecimal
subtract
=
dcAutoTurnover
.
getQuantityInitAdvise
().
subtract
(
moqPurchaseAdvisedList
.
get
(
0
));
dcAutoTurnover
.
setQuantityFinalAdvise
(
moqPurchaseAdvisedList
.
get
(
0
));
dcAutoTurnover
.
setQuantityFinalAdvise
(
moqPurchaseAdvisedList
.
get
(
0
));
if
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)
{
if
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
dcAutoTurnover
.
setQuantityFinalAdvise
(
moqPurchaseAdvisedList
.
get
(
0
).
add
(
subtract
));
dcAutoTurnover
.
setQuantityFinalAdvise
(
moqPurchaseAdvisedList
.
get
(
0
).
add
(
subtract
));
}
}
dcAutoTurnover
.
setQuantityMinimumOrder
(
turnoverSku
.
getMoq
());
dcAutoTurnover
.
setQuantityMinimumOrder
(
turnoverSku
.
getMoq
());
...
@@ -982,8 +957,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -982,8 +957,6 @@ public class AutoTurnoverJob extends PointJob {
*/
*/
if
((
dcAutoConfigSkuWarehouse
==
null
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
))
||
(
dcAutoConfigSkuWarehouse
!=
null
&&
dcAutoConfigSkuWarehouse
.
getStatus
()
==
0
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)))
{
if
((
dcAutoConfigSkuWarehouse
==
null
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
))
||
(
dcAutoConfigSkuWarehouse
!=
null
&&
dcAutoConfigSkuWarehouse
.
getStatus
()
==
0
&&
(
realInventory
>
0
||
avgHistoryFourteendaySales
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)))
{
hasMonitorFluctuation
=
true
;
hasMonitorFluctuation
=
true
;
}
}
return
hasMonitorFluctuation
;
return
hasMonitorFluctuation
;
}
}
...
@@ -996,7 +969,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -996,7 +969,6 @@ public class AutoTurnoverJob extends PointJob {
* 波动提醒优先级 --> 实际缺货-实际断货-实际冗余-预计缺货-预计冗余
* 波动提醒优先级 --> 实际缺货-实际断货-实际冗余-预计缺货-预计冗余
* </p>
* </p>
*
*
* @param totalSafeInventory
* @param turnoverDays
* @param turnoverDays
* @param recordTime
* @param recordTime
* @param dcAutoConfigSkuWarehouse
* @param dcAutoConfigSkuWarehouse
...
@@ -1006,11 +978,9 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -1006,11 +978,9 @@ public class AutoTurnoverJob extends PointJob {
* @param avgHistoryThreedaySales
* @param avgHistoryThreedaySales
* @param forecastFluctuationList
* @param forecastFluctuationList
* @param forecastShortSupplyList
* @param forecastShortSupplyList
* @param forecastInventoryList
* @param dcBaseStock
* @param dcBaseStock
*/
*/
private
void
unusualFluctuation
(
BigDecimal
totalSafeInventory
,
private
void
unusualFluctuation
(
Integer
turnoverDays
,
Integer
turnoverDays
,
LocalDate
recordTime
,
LocalDate
recordTime
,
DcAutoConfigSkuWarehouse
dcAutoConfigSkuWarehouse
,
DcAutoConfigSkuWarehouse
dcAutoConfigSkuWarehouse
,
DcBaseSku
turnoverSku
,
DcBaseSku
turnoverSku
,
...
@@ -1019,7 +989,6 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -1019,7 +989,6 @@ public class AutoTurnoverJob extends PointJob {
BigDecimal
avgHistoryThreedaySales
,
BigDecimal
avgHistoryThreedaySales
,
List
<
DcAutoForecastFluctuation
>
forecastFluctuationList
,
List
<
DcAutoForecastFluctuation
>
forecastFluctuationList
,
List
<
BigDecimal
>
forecastShortSupplyList
,
List
<
BigDecimal
>
forecastShortSupplyList
,
List
<
BigDecimal
>
forecastInventoryList
,
DcBaseStock
dcBaseStock
)
{
DcBaseStock
dcBaseStock
)
{
//连续冗余或缺货天数
//连续冗余或缺货天数
...
@@ -1027,44 +996,25 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -1027,44 +996,25 @@ public class AutoTurnoverJob extends PointJob {
//冗余或缺货天数索引
//冗余或缺货天数索引
int
index
=
-
1
;
int
index
=
-
1
;
if
(
forecastShortSupplyList
.
get
(
turnoverDays
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//
if (forecastShortSupplyList.get(turnoverDays).compareTo(BigDecimal.ZERO) > 0) {
for
(
int
i
=
0
;
i
<=
turnoverDays
;
i
++)
{
for
(
int
i
=
0
;
i
<=
turnoverDays
;
i
++)
{
if
(
forecastShortSupplyList
.
get
(
i
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
forecastShortSupplyList
.
get
(
i
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
days
++;
days
++;
if
(
index
<
0
)
{
if
(
index
<
0
)
{
index
=
i
;
index
=
i
;
}
}
if
(
i
==
turnoverDays
&&
index
>=
0
)
{
//如果是最后一天
if
(
i
==
turnoverDays
)
{
//如果是最后一天
handleForecastFluctuation
(
2
,
forecastFluctuationList
,
recordTime
,
days
,
index
);
handleForecastFluctuation
(
2
,
forecastFluctuationList
,
recordTime
,
days
,
index
);
days
=
0
;
days
=
0
;
index
=
-
1
;
index
=
-
1
;
}
}
}
else
if
(
index
>=
0
)
{
}
else
if
(
index
>=
0
)
{
handleForecastFluctuation
(
2
,
forecastFluctuationList
,
recordTime
,
days
,
index
);
handleForecastFluctuation
(
2
,
forecastFluctuationList
,
recordTime
,
days
,
index
);
days
=
0
;
index
=
-
1
;
break
;
break
;
}
}
}
}
}
// if (forecastInventoryList.get(turnoverDays).compareTo(totalSafeInventory) > 0) {
// for (int i = 0; i <= turnoverDays; i++) {
// if (i < turnoverDays && forecastInventoryList.get(i).compareTo(totalSafeInventory) == 1) {
// days++;
// if (index < 0) {
// index = i;
// }
// //如果是最后一天
// if (i == turnoverDays && index >= 0) {
// handleForecastFluctuation(4, forecastFluctuationList, recordTime, days, index);
// }
// } else if (index >= 0) {
// handleForecastFluctuation(4, forecastFluctuationList, recordTime, days, index);
// break;
// }
// }
// }
// }
//status` '监控状态, 默认0监控, 停止监控1',
//status` '监控状态, 默认0监控, 停止监控1',
try
{
try
{
DcAutoForecastFluctuationMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoForecastFluctuationMapper
.
class
);
DcAutoForecastFluctuationMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoForecastFluctuationMapper
.
class
);
...
@@ -1112,7 +1062,7 @@ public class AutoTurnoverJob extends PointJob {
...
@@ -1112,7 +1062,7 @@ public class AutoTurnoverJob extends PointJob {
.
andBailunSkuEqualTo
(
turnoverSku
.
getBailunSku
())
.
andBailunSkuEqualTo
(
turnoverSku
.
getBailunSku
())
.
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
.
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
}
}
}
else
if
(
dcAutoConfigSkuWarehouse
!=
null
&&
dcAutoConfigSkuWarehouse
.
getStatus
().
equals
(
1
))
{
}
else
if
(
dcAutoConfigSkuWarehouse
.
getStatus
().
equals
(
1
))
{
mapper
.
deleteByExample
(
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
()
mapper
.
deleteByExample
(
DcAutoForecastFluctuationExample
.
newAndCreateCriteria
()
.
andBailunSkuEqualTo
(
turnoverSku
.
getBailunSku
())
.
andBailunSkuEqualTo
(
turnoverSku
.
getBailunSku
())
.
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
.
andWarehouseCodeEqualTo
(
warehouseCode
).
example
());
...
...
data-show/show-auto-turnover/src/test/java/AutoTurnoverTest.java
View file @
d23b71dc
...
@@ -268,8 +268,8 @@ public class AutoTurnoverTest {
...
@@ -268,8 +268,8 @@ public class AutoTurnoverTest {
public
void
testXX2
()
{
public
void
testXX2
()
{
DcBaseStock
dcBaseStock
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseStockMapper
.
class
)
DcBaseStock
dcBaseStock
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseStockMapper
.
class
)
.
selectOneByExample
(
DcBaseStockExample
.
newAndCreateCriteria
()
.
selectOneByExample
(
DcBaseStockExample
.
newAndCreateCriteria
()
.
andBailunSkuEqualTo
(
"
946861
301"
)
.
andBailunSkuEqualTo
(
"
223723
301"
)
.
andWarehouseCodeEqualTo
(
"
GZBLWH
"
)
.
andWarehouseCodeEqualTo
(
"
ESFBABLEM
"
)
.
example
());
.
example
());
try
{
try
{
...
...
pom.xml
View file @
d23b71dc
...
@@ -5,7 +5,12 @@
...
@@ -5,7 +5,12 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.bailuntec
</groupId>
<groupId>
com.bailuntec
</groupId>
<artifactId>
bailuntec-parent
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
dc-java
</artifactId>
<artifactId>
dc-java
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
...
...
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