丽知:调出调入加锁

This commit is contained in:
zhengyf 2025-02-14 16:16:44 +08:00
parent 0c6174b7f4
commit 218863d9cb
2 changed files with 119 additions and 106 deletions

View File

@ -52,7 +52,7 @@ import java.util.concurrent.locks.ReentrantLock;
public class TransferInPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(TransferInPluginInitializer.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
private static final Object OBJECT_LOCK = new Object();
@Override
public void initialize() {
@ -152,6 +152,8 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
*/
public void start() {
try {
synchronized (OBJECT_LOCK) {
//获取当前时间
Date currentDate = new Date();
Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10);
@ -175,6 +177,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
return;
}
implement(filterTransferInOrders);
}
} catch (Exception e) {
@ -187,6 +190,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
*/
public void start(String stockinNo) {
try {
synchronized (OBJECT_LOCK) {
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
queryOfsStockinOrderRequestVO.setCode(stockinNo);
@ -203,7 +207,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
Assert.state(false, "丽知OFS调拨入库--->U8C调拨入库根据单据号[入库完成]{},该调拨入库单已被推送成功,请勿重新推送", stockinNo);
}
implement(filterTransferInOrders);
}
} catch (Exception e) {
logger.error("丽知OFS调拨入库订单--->U8C调拨入库订单保存签字关联U8C调拨出库单,start(String goodsName)方法报错:", e);
@ -216,6 +220,8 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
*/
public void start(String startTime, String endTime) {
try {
synchronized (OBJECT_LOCK) {
Date business_start = DateUtil.parse(startTime);
Date business_end = DateUtil.parse(endTime);
String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00";
@ -237,6 +243,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
Assert.state(false, "丽知OFS调拨入库订单--->U8C调拨入库订单根据日期期间[开始时间]-[结束时间]{}-{},该调期调拨入库单[入库完成]已被推送成功,请勿重新推送", startTime, endTime);
}
implement(filterTransferInOrders);
}
} catch (Exception e) {

View File

@ -58,7 +58,7 @@ import java.util.concurrent.locks.ReentrantLock;
public class TransferOutPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(TransferOutPluginInitializer.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
private static final Object OBJECT_LOCK = new Object();
@Override
public void initialize() {
@ -153,6 +153,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
*/
public void start() {
try {
synchronized (OBJECT_LOCK) {
//获取当前时间
Date currentDate = new Date();
Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10);
@ -175,6 +176,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
}
//推送U8C
implement(filterTransferOutOrders);
}
} catch (Exception e) {
logger.error("丽知OFS调拨出库订单--->U8C调拨订单自动生成调拨出库单保存签字,start()方法报错:", e);
}
@ -185,6 +187,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
*/
public void start(String stockoutNo) {
try {
synchronized (OBJECT_LOCK) {
QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO();
queryOfsStockoutOrderRequestVO.setCode(stockoutNo);
queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
@ -199,6 +202,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
}
//推送U8C
implement(filterTransferOutOrders);
}
} catch (Exception e) {
logger.error("丽知OFS调拨出库订单--->U8C调拨订单自动生成调拨出库单保存签字,start(String goodsName)方法报错:", e);
@ -210,6 +214,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
*/
public void start(String startTime, String endTime) {
try {
synchronized (OBJECT_LOCK) {
Date business_start = DateUtil.parse(startTime);
Date business_end = DateUtil.parse(endTime);
String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00";
@ -232,6 +237,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
//推送U8C
// implement(transferOutOrder);
implement(filterTransferOutOrders);
}
} catch (Exception e) {
logger.error("丽知OFS调拨出库订单--->U8C调拨订单自动生成调拨出库单保存签字,start(String startTime, String endTime)方法报错:", e);
}