fix(inventory): 调整采购订单逻辑及库存导入功能

- 修改采购订单选择逻辑,简化判断条件
- 优化库存导入时SN表格的选择状态控制
- 更新库存内部服务中对特定厂商的判断逻辑
- 引入配置服务支持订单审批金额控制
- 新增延迟加载注解解决循环依赖问题
- 实现领导审批跳过逻辑并兼容历史数据
- 修复流程变量拷贝时的数据类型转换问题
master
chenhao 2025-12-19 18:39:43 +08:00
parent d3832d0ceb
commit 71095c9f3b
3 changed files with 42 additions and 6 deletions

View File

@ -182,7 +182,7 @@ export default {
});
},
handleSelectPurchaseBeforeImport() {
if (((this.productData.orderType || '1') === '1' ) && !(this.outerData.vendorName.startsWith('新华三') && this.productData.productType==='2')) {
if (((this.productData.orderType || '1') === '1' ) && !this.outerData.vendorName.startsWith('新华三') ) {
this.purchaseOrderSelectVisible = true;
}else{
this.handleImport()
@ -228,6 +228,7 @@ export default {
this.isImported = true;
this.$nextTick(() => {
if (this.$refs.snTable) {
this.$refs.snTable.clearSelection();
this.$refs.snTable.toggleAllSelection();
this.selectedSnList = this.snList;
}

View File

@ -272,7 +272,7 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
throw new ServiceException("产品编码对应产品未找到");
}
Map<String, OmsWarehouseInfo> warehouseInfoMap=Collections.emptyMap();
if ("2".equalsIgnoreCase(orderType) || (("2".equalsIgnoreCase(productInfos.get(0).getType()) && productInfos.get(0).getVendorName().startsWith("新华三"))) ){
if ("2".equalsIgnoreCase(orderType) || (productInfos.get(0).getVendorName().startsWith("新华三")) ){
List<String> warehouseNameList = inventoryInfoExcelDtoList.stream().map(InventoryInfoExcelDto::getWarehouseName).distinct().collect(Collectors.toList());
if (warehouseNameList.size() > 1){
throw new ServiceException("导入清单只能有一个仓库");
@ -293,7 +293,7 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
info.setModel(productInfos.get(0).getModel());
info.setProductDesc(productInfos.get(0).getDescription());
info.setInnerPrice(item.getInnerPrice());
if ("2".equalsIgnoreCase(orderType)|| (("2".equalsIgnoreCase(productInfos.get(0).getType()) && productInfos.get(0).getVendorName().startsWith("新华三"))) ){
if ("2".equalsIgnoreCase(orderType)|| ((productInfos.get(0).getVendorName().startsWith("新华三"))) ){
OmsWarehouseInfo omsWarehouseInfo = finalWarehouseInfoMap.get(item.getWarehouseName());
info.setWarehouseId(omsWarehouseInfo.getId());
info.setWarehouseName(omsWarehouseInfo.getWarehouseName());

View File

@ -42,6 +42,7 @@ import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.OrderExcelNumStaticsDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
import com.ruoyi.sip.flowable.service.IBuApproveConfigService;
import com.ruoyi.sip.mapper.OmsStockInfoMapper;
import com.ruoyi.sip.mapper.ProjectInfoMapper;
import com.ruoyi.sip.service.*;
@ -50,6 +51,7 @@ import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.common.utils.mail.TemplateMailUtil;
import com.ruoyi.sip.vo.OrderInfoVo;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@ -61,6 +63,7 @@ import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.ProjectOrderInfoMapper;
import com.ruoyi.common.core.text.Convert;
@ -131,6 +134,13 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
private Integer endHour;
@Value("${unis.mail.businessRoleId:103}")
private String businessRoleId;
@Autowired
private ISysConfigService configService;
@Autowired
@Lazy
private IBuApproveConfigService approveConfigService;
/**
*
*
@ -430,12 +440,15 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
String orderFlowKey = ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(projectOrderInfo.getProcessType()) ?
orderOnlineFlowKey : orderOfflineFlowKey;
String amountConfig = configService.selectConfigByKey("order.approve.amount.config");
BigDecimal amountConfigNumber = new BigDecimal(amountConfig);
//启动流程
todoService.startProcess(getFlowBusinessKey(existProjectOrderInfo.getOrderCode(), projectOrderInfo.getProcessType()), new HashMap<String, Object>() {{
put("processTemplate", projectOrderInfo.getProcessTemplate());
put("processType", projectOrderInfo.getProcessType());
put("applyUserName", ShiroUtils.getSysUser().getUserName());
put("applyUser", ShiroUtils.getUserId());
put("skipLeader",projectOrderInfo.getShipmentAmount().compareTo(amountConfigNumber)<0);
put("partnerUser",partnerInfos.get(0).getSystemUserId());
put("extendField1", projectOrderInfo.getVersionCode());
}}, orderFlowKey);
@ -1174,7 +1187,26 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
handleBusinessApproval(businessKey);
} else if ("省代".equals(taskName)) {
handlePartnerApproval(businessKey);
} else if ("公司领导".equals(taskName)) {
} else if ("领导1".equals(taskName) && todo.getApplyTime().compareTo(DateUtils.parseDate("2025-12-19"))>0){
ProjectOrderInfo orderInfo = selectProjectOrderInfoByOrderCode(businessKey);
String amountConfig = configService.selectConfigByKey("order.approve.amount.config");
BigDecimal amountConfigNumber = new BigDecimal(amountConfig);
if (orderInfo.getShipmentAmount().compareTo(amountConfigNumber)<0){
handleCompanyLeaderApproval(businessKey);
//查询对应的数据 插入已办数据
List<Long> approveUserList = approveConfigService.listByProcessKeyAndTaskName(todo.getProcessKey(), "公司领导");
for (Long l : approveUserList) {
todoService.completed(new HashMap<>(), todo.getTaskId(), businessKey);
todo.setApproveUser(l.toString());
todo.setTaskName("公司领导");
todo.setApproveUserName(userService.selectUserById(l).getUserName());
todo.setApproveOpinion("默认审批");
todo.setNextAllApproveUserName(null);
todo.setAllApproveUserName(null);
todoService.insertTodoCompleted(Arrays.asList(todo));
}
}
}else if ("公司领导".equals(taskName)) {
//黄雪秋处理 流程状态更改
if (ShiroUtils.getUserId().equals(118L)) {
@ -1559,8 +1591,11 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
query.setProcessKeyList(Arrays.asList(orderOnlineFlowKey,orderOfflineFlowKey));
List<Todo> list = todoService.selectTodoList(query);
for (Todo todo1 : list) {
todo1.setVariables(new HashMap<>(todo.getVariables()));
Map<String, Object> temp = new HashMap<>();
for (Map.Entry<String, Object> entry : todo.getVariables().entrySet()) {
temp.put(entry.getKey(), new String(entry.getValue().toString()));
}
todo1.setVariables(temp);
approveOrder(todo1);
}
}