|
|
@ -31,7 +31,9 @@ import com.glxp.api.entity.thrsys.*;
|
|
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
|
|
import com.glxp.api.req.sync.SyncUpLoadRequest;
|
|
|
|
import com.glxp.api.req.sync.SyncUpLoadRequest;
|
|
|
|
import com.glxp.api.res.sync.*;
|
|
|
|
import com.glxp.api.res.sync.*;
|
|
|
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
import com.glxp.api.service.basic.IBasicBusTypeChangeService;
|
|
|
|
import com.glxp.api.service.basic.IBasicBusTypeChangeService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
import com.glxp.api.service.inout.IoAddInoutService;
|
|
|
|
import com.glxp.api.service.inout.IoAddInoutService;
|
|
|
|
import com.glxp.api.service.inout.IoCheckInoutService;
|
|
|
|
import com.glxp.api.service.inout.IoCheckInoutService;
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
@ -603,6 +605,10 @@ public class SpsSyncDownloadController {
|
|
|
|
IoOrderDetailResultDao orderDetailResultDao;
|
|
|
|
IoOrderDetailResultDao orderDetailResultDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
IoOrderInvoiceMapper orderInvoiceMapper;
|
|
|
|
IoOrderInvoiceMapper orderInvoiceMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
|
|
|
|
|
|
|
//接收中继服务、UDI管理系统上传单据
|
|
|
|
//接收中继服务、UDI管理系统上传单据
|
|
|
|
@AuthRuleAnnotation("sps/sync/order/upload")
|
|
|
|
@AuthRuleAnnotation("sps/sync/order/upload")
|
|
|
@ -619,101 +625,116 @@ public class SpsSyncDownloadController {
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) {
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) {
|
|
|
|
try {
|
|
|
|
List<IoOrderEntity> orderEntities = syncDataResponse.getOrderEntities();
|
|
|
|
List<IoOrderEntity> orderEntities = syncDataResponse.getOrderEntities();
|
|
|
|
for (IoOrderEntity orderEntity : orderEntities) {
|
|
|
|
for (IoOrderEntity orderEntity : orderEntities) {
|
|
|
|
orderEntity.setUpdateTime(null);
|
|
|
|
orderEntity.setUpdateTime(null);
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_UDISP);
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_UDISP);
|
|
|
|
orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_POST);
|
|
|
|
orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_POST);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
IoOrderEntity temp = orderService.findById(orderEntity.getBillNo());
|
|
|
|
IoOrderEntity temp = orderService.findById(orderEntity.getBillNo());
|
|
|
|
|
|
|
|
if (temp == null) {
|
|
|
|
|
|
|
|
orderEntity.setId(null);
|
|
|
|
if (temp == null) {
|
|
|
|
orderDao.insert(orderEntity);
|
|
|
|
|
|
|
|
|
|
|
|
// 过滤使用出库单,转换成一级库出库单(条件:往来类型为客户信息,出入库类型为出库,仓库类型为入账库,是否更改库存为是
|
|
|
|
//更新码详情
|
|
|
|
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
|
|
|
|
if (basicBussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT
|
|
|
|
List<IoCodeEntity> warehouseEntityList = syncDataResponse.getCodeEntities();
|
|
|
|
&& basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)
|
|
|
|
for (IoCodeEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
&& basicBussinessTypeEntity.isInStock() && basicBussinessTypeEntity.getActionType() == 1) {
|
|
|
|
if (warehouseEntity.getOrderId().equals(orderEntity.getBillNo())) {
|
|
|
|
// orderEntity.getInvCode()
|
|
|
|
IoCodeTempEntity codeTempEntity = new IoCodeTempEntity();
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(orderEntity.getInvCode());
|
|
|
|
BeanUtils.copyProperties(warehouseEntity, codeTempEntity);
|
|
|
|
InvWarehouseEntity parentInv = invWarehouseService.findOneLevel(invWarehouseEntity.getParentCode());
|
|
|
|
codeTempEntity.setId(null);
|
|
|
|
if (parentInv == null)
|
|
|
|
codeMappert.insert(codeTempEntity);
|
|
|
|
parentInv = invWarehouseEntity;
|
|
|
|
}
|
|
|
|
orderEntity.setInvCode(parentInv.getCode());
|
|
|
|
|
|
|
|
orderEntity.setDeptCode(parentInv.getParentId());
|
|
|
|
|
|
|
|
orderEntity.setFromCorp("科室使用出库");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderEntity.setId(null);
|
|
|
|
|
|
|
|
orderDao.insert(orderEntity);
|
|
|
|
|
|
|
|
//更新码详情
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
|
|
|
|
|
|
|
|
List<IoCodeEntity> warehouseEntityList = syncDataResponse.getCodeEntities();
|
|
|
|
|
|
|
|
for (IoCodeEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
|
|
|
if (warehouseEntity.getOrderId().equals(orderEntity.getBillNo())) {
|
|
|
|
|
|
|
|
IoCodeTempEntity codeTempEntity = new IoCodeTempEntity();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(warehouseEntity, codeTempEntity);
|
|
|
|
|
|
|
|
codeTempEntity.setId(null);
|
|
|
|
|
|
|
|
codeMappert.insert(codeTempEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//更新业务详情
|
|
|
|
//更新业务详情
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailBizEntities())) {
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailBizEntities())) {
|
|
|
|
List<IoOrderDetailBizEntity> orderDetailBizEntities = syncDataResponse.getOrderDetailBizEntities();
|
|
|
|
List<IoOrderDetailBizEntity> orderDetailBizEntities = syncDataResponse.getOrderDetailBizEntities();
|
|
|
|
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
|
|
|
|
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
|
|
|
|
if (bizEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
if (bizEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
bizEntity.setId(null);
|
|
|
|
bizEntity.setId(null);
|
|
|
|
orderDetailBizDao.insert(bizEntity);
|
|
|
|
orderDetailBizDao.insert(bizEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//更新码详情
|
|
|
|
//更新码详情
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
|
|
|
|
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = syncDataResponse.getOrderDetailCodeEntities();
|
|
|
|
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = syncDataResponse.getOrderDetailCodeEntities();
|
|
|
|
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
|
|
|
|
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
|
|
|
|
if (codeEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
if (codeEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
codeEntity.setId(null);
|
|
|
|
codeEntity.setId(null);
|
|
|
|
orderDetailCodeDao.insert(codeEntity);
|
|
|
|
orderDetailCodeDao.insert(codeEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新结果详情
|
|
|
|
//更新结果详情
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailResultEntities())) {
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailResultEntities())) {
|
|
|
|
List<IoOrderDetailResultEntity> orderDetailResultEntities = syncDataResponse.getOrderDetailResultEntities();
|
|
|
|
List<IoOrderDetailResultEntity> orderDetailResultEntities = syncDataResponse.getOrderDetailResultEntities();
|
|
|
|
for (IoOrderDetailResultEntity detailResultEntity : orderDetailResultEntities) {
|
|
|
|
for (IoOrderDetailResultEntity detailResultEntity : orderDetailResultEntities) {
|
|
|
|
if (detailResultEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
if (detailResultEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
detailResultEntity.setId(null);
|
|
|
|
detailResultEntity.setId(null);
|
|
|
|
orderDetailResultDao.insert(detailResultEntity);
|
|
|
|
orderDetailResultDao.insert(detailResultEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新发票信息
|
|
|
|
//更新发票信息
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderInvoiceEntities())) {
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderInvoiceEntities())) {
|
|
|
|
List<IoOrderInvoiceEntity> orderInvoiceEntities = syncDataResponse.getOrderInvoiceEntities();
|
|
|
|
List<IoOrderInvoiceEntity> orderInvoiceEntities = syncDataResponse.getOrderInvoiceEntities();
|
|
|
|
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
|
|
|
|
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
|
|
|
|
if (orderInvoiceEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
if (orderInvoiceEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
|
|
|
|
orderInvoiceEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
orderInvoiceEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
orderInvoiceMapper.insert(orderInvoiceEntity);
|
|
|
|
orderInvoiceMapper.insert(orderInvoiceEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
orderEntity = orderService.findByBillNo(orderEntity.getBillNo());
|
|
|
|
orderEntity = orderService.findByBillNo(orderEntity.getBillNo());
|
|
|
|
addInoutService.dealProcess(orderEntity);
|
|
|
|
addInoutService.dealProcess(orderEntity);
|
|
|
|
orderEntity = orderService.findByBillNo(orderEntity.getBillNo());
|
|
|
|
orderEntity = orderService.findByBillNo(orderEntity.getBillNo());
|
|
|
|
if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) {
|
|
|
|
if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) {
|
|
|
|
ioCheckInoutService.check(orderEntity.getBillNo());
|
|
|
|
ioCheckInoutService.check(orderEntity.getBillNo());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String logs = "";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据:" + syncDataResponse.getOrderEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailBizEntities()))
|
|
|
|
|
|
|
|
logs = logs + "业务详情:" + syncDataResponse.getOrderDetailBizEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据扫码详情:" + syncDataResponse.getOrderDetailCodeEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailResultEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据结果详情:" + syncDataResponse.getOrderDetailResultEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getCodeEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据条码信息:" + syncDataResponse.getCodeEntities().size() + "条\n";
|
|
|
|
|
|
|
|
remark.append(logs);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String logs = "";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据:" + syncDataResponse.getOrderEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailBizEntities()))
|
|
|
|
|
|
|
|
logs = logs + "业务详情:" + syncDataResponse.getOrderDetailBizEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据扫码详情:" + syncDataResponse.getOrderDetailCodeEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailResultEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据结果详情:" + syncDataResponse.getOrderDetailResultEntities().size() + "条\n";
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getCodeEntities()))
|
|
|
|
|
|
|
|
logs = logs + "单据条码信息:" + syncDataResponse.getCodeEntities().size() + "条\n";
|
|
|
|
|
|
|
|
remark.append(logs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String fileFullPath = null;
|
|
|
|
String fileFullPath = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|