|
|
|
@ -26,6 +26,8 @@ import com.glxp.api.res.system.SyncDataSetResponse;
|
|
|
|
|
import com.glxp.api.service.inout.IoAddInoutService;
|
|
|
|
|
import com.glxp.api.service.inout.IoCheckInoutService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.service.purchase.PurOrderDetailService;
|
|
|
|
|
import com.glxp.api.service.purchase.PurOrderService;
|
|
|
|
|
import com.glxp.api.service.sync.BasicDownloadService;
|
|
|
|
|
import com.glxp.api.service.sync.BasicExportService;
|
|
|
|
|
import com.glxp.api.service.sync.SpsSyncDownloadService;
|
|
|
|
@ -59,9 +61,13 @@ public class SpsSyncDownloadController {
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderService orderService;
|
|
|
|
|
@Resource
|
|
|
|
|
PurOrderService purOrderService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoAddInoutService addInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCheckInoutService ioCheckInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
PurOrderDetailService purOrderDetailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 下发单据,生成单据任务由中继服务,UDI管理系统下载
|
|
|
|
@ -215,7 +221,7 @@ public class SpsSyncDownloadController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 接收中级服务,UDI管理系统上传业务单据
|
|
|
|
|
@AuthRuleAnnotation("/sps/sync/busOrder/upload")
|
|
|
|
|
// @AuthRuleAnnotation("/sps/sync/busOrder/upload")
|
|
|
|
|
@PostMapping("/sps/sync/busOrder/upload")
|
|
|
|
|
public BaseResponse busOrderSava(@RequestBody @Valid SpsSyncBusOrderResponse spsSyncBusOrderResponse) {
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
@ -228,32 +234,29 @@ public class SpsSyncDownloadController {
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderEntities())) {
|
|
|
|
|
try {
|
|
|
|
|
List<PurOrderEntity> orderEntities = spsSyncBusOrderResponse.getPurOrderEntities();
|
|
|
|
|
PurOrderDao mapper = batchSession.getMapper(PurOrderDao.class);
|
|
|
|
|
for (PurOrderEntity orderEntity : orderEntities) {
|
|
|
|
|
orderEntity.setUpdateTime(null);
|
|
|
|
|
IoOrderEntity temp = orderService.findById(orderEntity.getBillNo());
|
|
|
|
|
PurOrderEntity temp = purOrderService.selectByBillNo(orderEntity.getBillNo());
|
|
|
|
|
if (temp == null) {
|
|
|
|
|
orderEntity.setId(null);
|
|
|
|
|
mapper.insert(orderEntity);
|
|
|
|
|
purOrderService.insert(orderEntity);
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderDetailEntities())) {
|
|
|
|
|
PurOrderDetailDao codeMappert = batchSession.getMapper(PurOrderDetailDao.class);
|
|
|
|
|
List<PurOrderDetailEntity> warehouseEntityList = spsSyncBusOrderResponse.getPurOrderDetailEntities();
|
|
|
|
|
for (PurOrderDetailEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
|
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntities = spsSyncBusOrderResponse.getPurOrderDetailEntities();
|
|
|
|
|
for (PurOrderDetailEntity purOrderDetailEntity : purOrderDetailEntities) {
|
|
|
|
|
PurOrderDetailEntity codeTempEntity = new PurOrderDetailEntity();
|
|
|
|
|
BeanUtils.copyProperties(warehouseEntity, codeTempEntity);
|
|
|
|
|
BeanUtils.copyProperties(purOrderDetailEntity, codeTempEntity);
|
|
|
|
|
codeTempEntity.setId(null);
|
|
|
|
|
codeMappert.insert(codeTempEntity);
|
|
|
|
|
codeTempEntity.setOrderIdFk(orderEntity.getId() + "");
|
|
|
|
|
purOrderDetailService.insert(codeTempEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
|
|
|
|
|
String logs = "";
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderEntities()))
|
|
|
|
@ -265,7 +268,6 @@ public class SpsSyncDownloadController {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.close();
|
|
|
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setRemark(remark.toString());
|
|
|
|
|