fix:修复自动完成tagStatus为1的单据

dev_unify
chenhc 7 months ago
parent b07cf1a073
commit 647d2c553a

@ -55,6 +55,7 @@ import com.glxp.api.res.inout.IoOrderResponse;
import com.glxp.api.res.inout.IoStatOrderResponse;
import com.glxp.api.res.sync.SpsSyncOrderResponse;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.auth.DeptService;
import com.glxp.api.service.auth.SysWorkplaceService;
import com.glxp.api.service.basic.*;
@ -599,6 +600,10 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
}
@Resource
CustomerService customerService;
/**
*
*
@ -700,7 +705,14 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
for (IoCollectOrder collectOrder : allotCollects) {
SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(addr);
if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) {
splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1);
boolean b = splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1);
if (b && sysWorkplaceDocumentEntity.getAutoHandle()){
//单据是否自动完成 是 调用 完成
CollectOrderRequest collectOrderRequest = new CollectOrderRequest();
AuthAdmin user = customerService.getUserBean();
collectOrderRequest.setUpdateUser(user.getId());
finishOrder(collectOrderRequest, user);
}
}
}
}

@ -0,0 +1,84 @@
package com.glxp.api.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.api.dao.basic.SysWorkplaceDocumentDao;
import com.glxp.api.dao.schedule.ScheduledDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity;
import com.glxp.api.entity.collect.IoCollectOrder;
import com.glxp.api.entity.collect.IoCollectSet;
import com.glxp.api.entity.system.ScheduledEntity;
import com.glxp.api.req.basic.WorkBindBusTypeRequest;
import com.glxp.api.req.collect.CollectOrderRequest;
import com.glxp.api.req.system.ScheduledRequest;
import com.glxp.api.res.basic.SysWorkplaceDocumentResponse;
import com.glxp.api.service.basic.SysWorkplaceDocumentService;
import com.glxp.api.service.collect.IoCollectOrderService;
import com.glxp.api.service.collect.IoCollectOriginService;
import com.glxp.api.service.collect.IoCollectSetService;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.MsDateUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@Component
@EnableScheduling
public class AsyncIoCollectOrderFinishTask implements SchedulingConfigurer {
final Logger logger = LoggerFactory.getLogger(AsyncIoCollectOrderFinishTask.class);
@Resource
private ScheduledDao scheduledDao;
@Resource
SysWorkplaceDocumentService sysWorkplaceDocumentService;
@Resource
IoCollectOrderService collectOrderService;
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(() -> process(),
triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("ioCollectOrderFinishTask");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity != null ? scheduledEntity.getCron() : "0 */30 * * * ?";
if (cron.isEmpty()) {
logger.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
});
}
private void process() {
List<IoCollectOrder> list = collectOrderService.list(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getTagStatus, 1));
if (CollUtil.isNotEmpty(list)) {
for (IoCollectOrder collectOrder : list) {
SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(collectOrder.getBusType());
if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) {
if ( sysWorkplaceDocumentEntity.getAutoHandle()){
//单据是否自动完成 是 调用 完成
AuthAdmin authAdmin = new AuthAdmin();
authAdmin.setId(1l);
CollectOrderRequest collectOrderRequest = new CollectOrderRequest();
collectOrderRequest.setUpdateUser(1l);
collectOrderService.finishOrder(collectOrderRequest, authAdmin);
}
}
}
}
}
}

@ -4850,3 +4850,5 @@ ALTER TABLE io_collect_order_backup MODIFY errorMsg text;
CALL Pro_Temp_ColumnWork('sys_workplace_document', 'autoHandle',
' tinyint NULL DEFAULT NULL COMMENT ''是否自动处理''',
1);
INSERT INTO `sys_scheduled` (`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (158, 'ioCollectOrderFinishTask', '0 */30 * * * ?', NULL, '自动完成第三方处方单');

Loading…
Cancel
Save