diff --git a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java index e13194c3..7b04b999 100644 --- a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java +++ b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java @@ -13,6 +13,7 @@ import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.*; +import com.glxp.api.constant.Constant; import com.glxp.api.dao.auth.*; import com.glxp.api.dao.basic.*; import com.glxp.api.dao.inout.*; @@ -26,6 +27,7 @@ import com.glxp.api.entity.inout.*; import com.glxp.api.entity.purchase.*; import com.glxp.api.entity.sync.BasicDownloadStatusEntity; import com.glxp.api.entity.sync.BasicExportStatusEntity; +import com.glxp.api.entity.sync.SyncDataBustypeEntity; import com.glxp.api.entity.system.*; import com.glxp.api.entity.thrsys.*; import com.glxp.api.req.sync.SpsSyncDataRequest; @@ -42,10 +44,8 @@ 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; -import com.glxp.api.util.CustomUtil; -import com.glxp.api.util.DateUtil; -import com.glxp.api.util.FileUtils; -import com.glxp.api.util.JsonUtils; +import com.glxp.api.service.sync.SyncDataBustypeService; +import com.glxp.api.util.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -606,6 +606,8 @@ public class SpsSyncDownloadController { IBasicBussinessTypeService basicBussinessTypeService; @Resource InvWarehouseService invWarehouseService; + @Resource + SyncDataBustypeService syncDataBustypeService; //接收中继服务、UDI管理系统上传单据 @AuthRuleAnnotation("sps/sync/order/upload") @@ -624,10 +626,21 @@ public class SpsSyncDownloadController { if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) { List orderEntities = syncDataResponse.getOrderEntities(); for (IoOrderEntity orderEntity : orderEntities) { + + SyncDataBustypeEntity syncDataBustypeEntity = syncDataBustypeService.findByAction(orderEntity.getAction(), 2); orderEntity.setUpdateTime(null); orderEntity.setFromType(ConstantStatus.FROM_UDISP); orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_POST); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); + if (syncDataBustypeEntity != null) { + if (IntUtil.value(syncDataBustypeEntity.getSyncStatus()) == 1) { + orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_DRAFT); + orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); + } + if (syncDataBustypeEntity.isSyncChange()) { + orderEntity.setOutChangeEnable(syncDataBustypeEntity.isSyncChange()); + } + } IoOrderEntity temp = orderService.findById(orderEntity.getBillNo()); @@ -712,10 +725,12 @@ public class SpsSyncDownloadController { } orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); - addInoutService.dealProcess(orderEntity); - orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); - if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) { - ioCheckInoutService.check(orderEntity.getBillNo()); + if (orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_TEMP_SAVE) { + addInoutService.dealProcess(orderEntity); + orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); + if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) { + ioCheckInoutService.check(orderEntity.getBillNo()); + } } } } diff --git a/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java b/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java index e9aaeff2..bc2b9c7b 100644 --- a/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java +++ b/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java @@ -28,5 +28,5 @@ public class SyncDataBustypeEntity { @TableField(value = "`syncStatus`") private Integer syncStatus; //同步后单据状态 @TableField(value = "`syncChange`") - private Integer syncChange; //同步后是否自动补单 + private boolean syncChange; //同步后是否自动补单 } diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index a9b7ffb9..ffff4c70 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -85,7 +85,9 @@ public class IoChangeInoutService { //普通出入库单据流转 public void genNewOrder(IoOrderEntity orderEntity, List invProductDetailEntities) { - + if (orderEntity.getFromType() == ConstantStatus.FROM_UDISP && (orderEntity.getOutChangeEnable() != null && !orderEntity.getOutChangeEnable())) { + return; + } BasicBusTypePreEntity basicBusTypePreEntity = basicBusTypePreService.findByOriginAction(orderEntity.getAction()); List codeEnttities = codeService.findByOrderId(orderEntity.getBillNo()); if (basicBusTypePreEntity.getSupplementAll()) {//全量补单 diff --git a/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java b/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java index 9fdcc0b5..97ba06a4 100644 --- a/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java +++ b/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java @@ -9,6 +9,9 @@ public interface SyncDataBustypeService { List findAll(Integer direct); + SyncDataBustypeEntity findByAction(String action, Integer direct); + + boolean deleteAll(Integer direct); void inserts(List syncDataBustypeEntities); diff --git a/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java b/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java index 629ca552..e57aac3c 100644 --- a/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java @@ -1,5 +1,6 @@ package com.glxp.api.service.sync.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.dao.system.SyncDataBustypeDao; import com.glxp.api.entity.sync.SyncDataBustypeEntity; @@ -23,6 +24,17 @@ public class SyncDataBustypeServiceImpl implements SyncDataBustypeService { return syncDataBustypeDao.selectList(new QueryWrapper().eq("direct", direct)); } + @Override + public SyncDataBustypeEntity findByAction(String action, Integer direct) { + + + List syncDataBustypeEntities = syncDataBustypeDao.selectList(new QueryWrapper().eq(direct != null, "direct", direct).eq("action", action)); + if (CollUtil.isNotEmpty(syncDataBustypeEntities)) { + return syncDataBustypeEntities.get(0); + } + return null; + } + @Override public boolean deleteAll(Integer direct) { return syncDataBustypeDao.delete(new QueryWrapper().eq("direct", direct)) > 0 ? true : false; diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java new file mode 100644 index 00000000..3971e233 --- /dev/null +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -0,0 +1,18 @@ +package com.glxp.api.util; + +public class IntUtil { + + public static int value(Integer value) { + if (value == null) + return 0; + else return value.intValue(); + + } + + public static long value(Long value) { + if (value == null) + return 0l; + else return value.longValue(); + + } +} diff --git a/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml b/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml index 6b1bf84b..3d2086b9 100644 --- a/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml +++ b/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml @@ -1,8 +1,8 @@ - - + + @@ -35,9 +35,9 @@ insert into auth_space (code, `name`, type, invStorageCode, - invWarehouseCode, `status`, createTime, - updateTime, `createUser`, updateUser, - remark) + invWarehouseCode, `status`, createTime, + updateTime, `createUser`, updateUser, + remark) values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{invStorageCode,jdbcType=VARCHAR}, #{invWarehouseCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, @@ -243,9 +243,9 @@ insert into auth_space - (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, - `createUser`, updateUser, remark) - values + (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, + `createUser`, updateUser, remark) + values (#{item.code,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.invStorageCode,jdbcType=VARCHAR}, @@ -257,13 +257,14 @@ - select s.*, w.name invStorageName, iws.name invSubStorageName from auth_space s - left join auth_dept w on s.invStorageCode = w.code - left join auth_warehouse iws on s.invWarehouseCode = iws.code + left join auth_dept w on s.invStorageCode = w.code + left join auth_warehouse iws on s.invWarehouseCode = iws.code AND s.invStorageCode = #{invStorageCode} @@ -306,8 +307,8 @@ select - + from auth_space @@ -389,7 +390,7 @@