|
@@ -6,6 +6,7 @@ import com.github.zuihou.authority.dao.auth.StationUserLoginInfoMapper;
|
|
|
import com.github.zuihou.authority.dao.auth.UserMapper;
|
|
|
import com.github.zuihou.authority.entity.auth.StationUserLoginInfo;
|
|
|
import com.github.zuihou.authority.entity.auth.User;
|
|
|
+import com.github.zuihou.authority.service.common.ParameterService;
|
|
|
import com.github.zuihou.base.R;
|
|
|
import com.github.zuihou.base.service.SuperServiceImpl;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
@@ -39,6 +40,7 @@ import com.github.zuihou.business.productionResourceCenter.service.RepairService
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
import com.github.zuihou.common.constant.CodeRuleModule;
|
|
|
+import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
@@ -106,6 +108,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
@Autowired
|
|
|
private StockLogService stockLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ParameterService parameterService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<TTask> createTaskByPlan(List<PlanProduct> planProductList, Map<Long,List<BomProcedure>> bomProcedureMap,String taskBatchNo) {
|
|
|
|
|
@@ -227,24 +232,29 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
List<BomProcedure> bomProcedureList = bomProcedureMap.get(bomId);
|
|
|
Map<Long,BomProcedure> bpMap = bomProcedureList.stream().collect(Collectors.toMap(BomProcedure::getId, t->t));
|
|
|
|
|
|
- // 将人工上下料放在排产中计算,上下料工艺配置中可配置所有上下料,实际排产中根据上下料站人员登录的实际情况和订单产品进行绑定,将不是该订单产线登录的人员上下料站剔除
|
|
|
- // 取得当前上下料站人员登录情况
|
|
|
- Order order = orderMapper.selectById(orderProduct.getOrderId());
|
|
|
- Long zoneId = order.getZoneId();
|
|
|
- ZZone zZone = zZoneMapper.selectById(zoneId);
|
|
|
- Long orgId = zZone.getOrgId();
|
|
|
-
|
|
|
- // 查询该机构下的所有用户对应的上下料站
|
|
|
- LbqWrapper<User> userWrapper = new LbqWrapper<User>().eq(User::getOrg, orgId);
|
|
|
- List<User> orgUsers = userMapper.selectList(userWrapper);
|
|
|
- List<Long> userIds = orgUsers.stream().map(p -> p.getId()).collect(Collectors.toList());
|
|
|
- LbqWrapper<StationUserLoginInfo> stationUserLoginInfoWrapper = new LbqWrapper<StationUserLoginInfo>().in(StationUserLoginInfo::getUserId, userIds);
|
|
|
- List<StationUserLoginInfo> stationUserLoginInfos = stationUserLoginInfoMapper.selectList(stationUserLoginInfoWrapper);
|
|
|
- // 工人上下料站人员信息
|
|
|
- List<Long> stationResourcesIds = stationUserLoginInfos.stream().map(p -> p.getStationId()).collect(Collectors.toList());
|
|
|
-
|
|
|
- if(stationResourcesIds.size() == 0){
|
|
|
- return null;
|
|
|
+ String stationGaSwitchFlag = parameterService.getValue(ParameterKey.STATION_GA_SWITCH_FLAG, null);
|
|
|
+
|
|
|
+ List<Long> stationResourcesIds = new ArrayList<>();
|
|
|
+ if("1".equals(stationGaSwitchFlag)){
|
|
|
+// 将人工上下料放在排产中计算,上下料工艺配置中可配置所有上下料,实际排产中根据上下料站人员登录的实际情况和订单产品进行绑定,将不是该订单产线登录的人员上下料站剔除
|
|
|
+ // 取得当前上下料站人员登录情况
|
|
|
+ Order order = orderMapper.selectById(orderProduct.getOrderId());
|
|
|
+ Long zoneId = order.getZoneId();
|
|
|
+ ZZone zZone = zZoneMapper.selectById(zoneId);
|
|
|
+ Long orgId = zZone.getOrgId();
|
|
|
+
|
|
|
+ // 查询该机构下的所有用户对应的上下料站
|
|
|
+ LbqWrapper<User> userWrapper = new LbqWrapper<User>().eq(User::getOrg, orgId);
|
|
|
+ List<User> orgUsers = userMapper.selectList(userWrapper);
|
|
|
+ List<Long> userIds = orgUsers.stream().map(p -> p.getId()).collect(Collectors.toList());
|
|
|
+ LbqWrapper<StationUserLoginInfo> stationUserLoginInfoWrapper = new LbqWrapper<StationUserLoginInfo>().in(StationUserLoginInfo::getUserId, userIds);
|
|
|
+ List<StationUserLoginInfo> stationUserLoginInfos = stationUserLoginInfoMapper.selectList(stationUserLoginInfoWrapper);
|
|
|
+ // 工人上下料站人员信息
|
|
|
+ stationResourcesIds = stationUserLoginInfos.stream().map(p -> p.getStationId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(stationResourcesIds.size() == 0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//产品批次号,用于产品分解任务关联
|
|
@@ -314,10 +324,13 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
|
|
|
// TODO 工艺模板还是需要工序类型,先用名称判断
|
|
|
if(bomProcedure.getName().contains("上料") || bomProcedure.getName().contains("下料")){
|
|
|
- if(stationResourcesIds.contains(bomProcedureProductionresource.getResourceId())){
|
|
|
+ if("0".equals(stationGaSwitchFlag)){
|
|
|
assemblingCandidate(candidateProMap, machineMap, workpiece, candidateProcesses, bomProcedure, machine, candidateProcess, bomProcedureProductionresource);
|
|
|
+ }else if("1".equals(stationGaSwitchFlag)){
|
|
|
+ if(stationResourcesIds.contains(bomProcedureProductionresource.getResourceId())){
|
|
|
+ assemblingCandidate(candidateProMap, machineMap, workpiece, candidateProcesses, bomProcedure, machine, candidateProcess, bomProcedureProductionresource);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}else{
|
|
|
// 查询设备状态
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId, bomProcedureProductionresource.getResourceId()));
|