|
|
@@ -19,6 +19,7 @@ import com.th.demo.service.ware.OutService;
|
|
19
|
19
|
import com.th.demo.tools.JSONTools;
|
|
20
|
20
|
import com.th.demo.tools.Tools;
|
|
21
|
21
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
22
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
22
|
23
|
import org.springframework.stereotype.Service;
|
|
23
|
24
|
import org.springframework.transaction.annotation.Transactional;
|
|
24
|
25
|
|
|
|
@@ -55,6 +56,8 @@ public class OutServiceImpl implements OutService {
|
|
55
|
56
|
|
|
56
|
57
|
String result = Type.FAIL;
|
|
57
|
58
|
int num = 0;
|
|
|
59
|
+// 定时任务执行统计
|
|
|
60
|
+ int count = 0;
|
|
58
|
61
|
|
|
59
|
62
|
@Override
|
|
60
|
63
|
public String out(String json, String userId, String belongId) {
|
|
|
@@ -171,6 +174,7 @@ public class OutServiceImpl implements OutService {
|
|
171
|
174
|
distribution.setOutFlag("1");
|
|
172
|
175
|
if(distribution.getTransportName().equals("")||distribution.getTransportName() == null){
|
|
173
|
176
|
result = JSONTools.toString(ResponseCodeMsg.CODE_EX, "承运单位不可为空!");
|
|
|
177
|
+ return result;
|
|
174
|
178
|
}
|
|
175
|
179
|
num += distributionMapper.updateByPrimaryKey(distribution);
|
|
176
|
180
|
List<String> listStoreId = new ArrayList<String>();
|
|
|
@@ -344,4 +348,22 @@ public class OutServiceImpl implements OutService {
|
|
344
|
348
|
}
|
|
345
|
349
|
|
|
346
|
350
|
|
|
|
351
|
+ /**
|
|
|
352
|
+ * 库存状态检测方法(定时)
|
|
|
353
|
+ */
|
|
|
354
|
+ @Scheduled(cron = "0 * * * * *")
|
|
|
355
|
+ public void checkStock() {
|
|
|
356
|
+ count += 1;
|
|
|
357
|
+// 查询未出库状态,出库单存在的数据
|
|
|
358
|
+ List<String> list = distributionMapper.selectWaitOutIds();
|
|
|
359
|
+ if(!list.isEmpty()){
|
|
|
360
|
+ for (String storeId : list) {
|
|
|
361
|
+// 根据id修改主表出库状态
|
|
|
362
|
+ distributionMapper.updateOutStatus(storeId);
|
|
|
363
|
+ }
|
|
|
364
|
+ }
|
|
|
365
|
+ System.out.println("执行定时任务_______"+count);
|
|
|
366
|
+
|
|
|
367
|
+ }
|
|
|
368
|
+
|
|
347
|
369
|
}
|