|
@@ -13,23 +13,13 @@ import com.fjhx.mes.entity.work.dto.WorkOrderDto;
|
|
|
import com.fjhx.mes.service.work.WorkOrderService;
|
|
|
import com.fjhx.socket.core.PushTypeEnum;
|
|
|
import com.fjhx.socket.core.WebSocketPush;
|
|
|
-import com.fjhx.wms.entity.stock.po.Stock;
|
|
|
-import com.fjhx.wms.entity.stock.po.StockWaitDetails;
|
|
|
-import com.fjhx.wms.entity.stock.vo.StockWaitDetailsVo;
|
|
|
import com.fjhx.wms.service.stock.StockService;
|
|
|
-import com.fjhx.wms.service.stock.StockWaitDetailsService;
|
|
|
-import com.fjhx.wms.service.stock.StockWaitService;
|
|
|
-import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
-import com.ruoyi.common.exception.ServiceException;
|
|
|
-import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Component
|
|
|
public class SalesContractFlow extends FlowDelegate {
|
|
@@ -44,6 +34,7 @@ public class SalesContractFlow extends FlowDelegate {
|
|
|
private ISysUserService userService;
|
|
|
@Autowired
|
|
|
private StockService stockService;
|
|
|
+
|
|
|
@Override
|
|
|
public String getFlowKey() {
|
|
|
return "jxst_sales_contract_flow";
|
|
@@ -74,7 +65,7 @@ public class SalesContractFlow extends FlowDelegate {
|
|
|
|
|
|
//非定制工单查询库存如果存在库存需要人工干预是否需要生产
|
|
|
BigDecimal availableStockQuantity = stockService.getAvailableStockQuantity(salesContractDetails.getProductId());
|
|
|
- if("0".equals(salesContractDetails.getIsCustomized()) && availableStockQuantity.compareTo(BigDecimal.ZERO)>0){
|
|
|
+ if ("0".equals(salesContractDetails.getIsCustomized()) && availableStockQuantity.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
workOrder.setProductionQuantity(null);
|
|
|
}
|
|
|
|
|
@@ -82,23 +73,12 @@ public class SalesContractFlow extends FlowDelegate {
|
|
|
workOrderService.add(workOrder);
|
|
|
}
|
|
|
|
|
|
- long customizedCount = salesContractDetailsList.stream().filter(item -> Objects.equals(item.getIsCustomized(), 0)).count();
|
|
|
- long noCustomizedCount = salesContractDetailsList.stream().filter(item -> Objects.equals(item.getIsCustomized(), 1)).count();
|
|
|
-
|
|
|
- //定制工单给配置工单BOM工艺的人发消息
|
|
|
- if(customizedCount>0){
|
|
|
- //推送消息给工单配置的负责人
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
- List<Long> userIds = userService.getUserIdsByRoleKey("admin");
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
- WebSocketPush.byUsers(PushTypeEnum.MESSAGE, userIds, "您有新的定制工单待配置!", PushBusinessTypeEnum.NEW_WORK_ORDER.getType());
|
|
|
- }
|
|
|
|
|
|
- //未定制工单直接发消息
|
|
|
- if(noCustomizedCount>0) {
|
|
|
- //推送消息给生产计划下发的负责人
|
|
|
- workOrderService.sendPlanInfo();
|
|
|
- }
|
|
|
+ //给角色为研发的人发消息
|
|
|
+ DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
+ List<Long> userIds = userService.getUserIdsByRoleKey("dev");
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+ WebSocketPush.byUsers(PushTypeEnum.MESSAGE, userIds, "您有新的合同待处理", PushBusinessTypeEnum.NEW_CONTRACT.getType());
|
|
|
}
|
|
|
|
|
|
}
|