|
@@ -1,14 +1,12 @@
|
|
|
package com.github.zuihou.business.controller.productionResourceCenter;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.github.zuihou.authority.dao.auth.StationUserLoginInfoMapper;
|
|
|
-import com.github.zuihou.authority.entity.auth.StationUserLoginInfo;
|
|
|
-import com.github.zuihou.authority.entity.common.DictionaryItem;
|
|
|
import com.github.zuihou.base.R;
|
|
|
import com.github.zuihou.base.controller.SuperController;
|
|
|
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
|
|
|
+import com.github.zuihou.business.cutterdata.service.CutterTestDataService;
|
|
|
import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
|
|
|
import com.github.zuihou.business.edgeLibrary.entity.Storge;
|
|
|
import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
|
|
@@ -17,7 +15,6 @@ import com.github.zuihou.business.operationManagementCenter.dto.OrderUpdateDTO;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.*;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.*;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureMeterial;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.CuttingTool;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.MMeterialReceiveLog;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.BBomService;
|
|
@@ -38,7 +35,6 @@ import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
-import com.github.zuihou.database.mybatis.conditions.update.LbuWrapper;
|
|
|
import com.github.zuihou.log.annotation.SysLog;
|
|
|
import com.github.zuihou.tenant.service.CodeRuleService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -126,35 +122,35 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
@ApiOperation(value = "新增上下料用户", notes = "新增上下料用户")
|
|
|
@PostMapping("/saveAll")
|
|
|
public R<Boolean> saveAll(@RequestParam(value = "stationIds[]") List<String> stationIds, @RequestParam(value = "userIds[]") List<String> userIds) {
|
|
|
- List<StationUser> stationUserList = Lists.newArrayList();
|
|
|
- for(int i=0; i<stationIds.size(); i++){
|
|
|
- if(StringUtil.isEmpty(userIds.get(i))) continue;
|
|
|
- String[] idArr = userIds.get(i).split(",");
|
|
|
- for(int j=0;j<idArr.length; j++){
|
|
|
+ List<StationUser> stationUserList = Lists.newArrayList();
|
|
|
+ for (int i = 0; i < stationIds.size(); i++) {
|
|
|
+ if (StringUtil.isEmpty(userIds.get(i))) continue;
|
|
|
+ String[] idArr = userIds.get(i).split(",");
|
|
|
+ for (int j = 0; j < idArr.length; j++) {
|
|
|
StationUser stationUser = new StationUser();
|
|
|
stationUser.setStationId(Long.parseLong(stationIds.get(i)));
|
|
|
stationUser.setUserId(Long.parseLong(idArr[j]));
|
|
|
stationUserList.add(stationUser);
|
|
|
}
|
|
|
}
|
|
|
- Boolean bool = baseService.saveOrUpdateBatch(stationUserList) ;
|
|
|
+ Boolean bool = baseService.saveOrUpdateBatch(stationUserList);
|
|
|
return success(bool);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新上下料用户", notes = "更新上下料用户")
|
|
|
@PostMapping("/updateAll")
|
|
|
- public R<Boolean> updateAll(@RequestParam(value = "ids[]") List<String> ids,@RequestParam(value = "stationIds[]") List<String> stationIds, @RequestParam(value = "userIds[]") List<String> userIds) {
|
|
|
+ public R<Boolean> updateAll(@RequestParam(value = "ids[]") List<String> ids, @RequestParam(value = "stationIds[]") List<String> stationIds, @RequestParam(value = "userIds[]") List<String> userIds) {
|
|
|
//baseService.removeByIds(ids.stream().filter(id->!id.equals("0")).collect(Collectors.toList()));
|
|
|
//清空数据表
|
|
|
baseService.truncate();
|
|
|
List<StationUser> stationUserList = Lists.newArrayList();
|
|
|
- for(int i=0; i<ids.size(); i++){
|
|
|
+ for (int i = 0; i < ids.size(); i++) {
|
|
|
StationUser stationUser = new StationUser();
|
|
|
stationUser.setUserId(Long.parseLong(userIds.get(i)));
|
|
|
stationUser.setStationId(Long.parseLong(stationIds.get(i)));
|
|
|
stationUserList.add(stationUser);
|
|
|
}
|
|
|
- Boolean bool = baseService.saveOrUpdateBatch(stationUserList) ;
|
|
|
+ Boolean bool = baseService.saveOrUpdateBatch(stationUserList);
|
|
|
return success(bool);
|
|
|
}
|
|
|
|
|
@@ -172,9 +168,9 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
@ApiOperation(value = "查询上下料用户", notes = "查询上下料用户")
|
|
|
@GetMapping("/stationUser")
|
|
|
- public R getStationUser(@RequestParam(value="userId",required = false) Long userId) {
|
|
|
+ public R getStationUser(@RequestParam(value = "userId", required = false) Long userId) {
|
|
|
LbqWrapper<StationUser> wrapper = Wraps.<StationUser>lbQ();
|
|
|
- if(userId!= null){
|
|
|
+ if (userId != null) {
|
|
|
wrapper.eq(StationUser::getUserId, userId);
|
|
|
}
|
|
|
|
|
@@ -183,7 +179,7 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
@ApiOperation(value = "查询上下料用户", notes = "查询上下料用户")
|
|
|
@GetMapping("/getStation")
|
|
|
- public R getStationByUser(@RequestParam(value="userId",required = false) String userId) {
|
|
|
+ public R getStationByUser(@RequestParam(value = "userId", required = false) String userId) {
|
|
|
/*LbqWrapper<StationUserLoginInfo> wrapper = Wraps.<StationUserLoginInfo>lbQ();
|
|
|
if(userId!= null){
|
|
|
wrapper.eq(StationUserLoginInfo::getUserId, userId);
|
|
@@ -193,23 +189,47 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
return fail("当前登录用户非上下料用户");
|
|
|
}*/
|
|
|
LbqWrapper<StationUser> wrapper = Wraps.<StationUser>lbQ();
|
|
|
- if(userId!= null){
|
|
|
+ if (userId != null) {
|
|
|
wrapper.eq(StationUser::getUserId, userId);
|
|
|
}
|
|
|
StationUser stationUser = stationUserMapper.selectOne(wrapper);
|
|
|
- if(BeanUtil.isEmpty(stationUser)){
|
|
|
+ if (BeanUtil.isEmpty(stationUser)) {
|
|
|
return fail("当前登录用户非上下料用户");
|
|
|
}
|
|
|
- com.github.zuihou.business.productionResourceCenter.entity.Productionresource productionresource = productionresourceBizMapper.selectById(stationUser.getStationId());
|
|
|
+ com.github.zuihou.business.productionResourceCenter.entity.Productionresource productionresource = productionresourceBizMapper.selectById(stationUser.getStationId());
|
|
|
List<Productionresource> productionresources = new ArrayList<>();
|
|
|
productionresources.add(productionresource);
|
|
|
return success(productionresources);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CutterTestDataService cutterTestDataService;
|
|
|
+
|
|
|
@ApiOperation(value = "查询刀具上下料站库位", notes = "查询刀具上下料站库位")
|
|
|
@GetMapping("/getCutToolStation")
|
|
|
public R getCutToolStation(@RequestParam(value = "zoneCode", required = true) String zoneCode) {
|
|
|
List<Productionresource> cutToolList = productionresourceBizMapper.selectList(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").eq(Productionresource::getOnlineStatus, "1").like(Productionresource::getCode, zoneCode).like(Productionresource::getName, "刀具上下料"));
|
|
|
+
|
|
|
+ List<Long> collect = cutToolList.stream().map(Productionresource::getId).collect(Collectors.toList());
|
|
|
+ List<CutterTestDataEntity> infos = cutterTestDataService.getStockInfosByResourceId(collect);
|
|
|
+ Map<Object, List<CutterTestDataEntity>> listMap = infos.stream().collect(Collectors.groupingBy(CutterTestDataEntity::getResourceId));
|
|
|
+
|
|
|
+ cutToolList.forEach(item -> {
|
|
|
+ item.setSiteStatus("1");
|
|
|
+ if (listMap.isEmpty() || listMap.get(item.getId()) == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<CutterTestDataEntity> cutterTestDataEntities = listMap.get(item.getId());
|
|
|
+
|
|
|
+ if (cutterTestDataEntities.get(0).getStatus() == 2) {
|
|
|
+ item.setSiteStatus("2");
|
|
|
+ } else {
|
|
|
+ item.setSiteStatus("3");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
return success(cutToolList);
|
|
|
}
|
|
|
|
|
@@ -225,8 +245,8 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
@ApiOperation(value = "新增刀具上料库位信息", notes = "新增刀具上料库位信息")
|
|
|
@PostMapping("/addCutToolStockInfo")
|
|
|
- public R addCutToolStockInfo(@RequestBody Map<String,Object> model) {
|
|
|
- if(!model.containsKey("rfid") || !model.containsKey("deviceId")) return R.fail("数据参数不全");
|
|
|
+ public R addCutToolStockInfo(@RequestBody Map<String, Object> model) {
|
|
|
+ if (!model.containsKey("rfid") || !model.containsKey("deviceId")) return R.fail("数据参数不全");
|
|
|
Long deviceId = Long.parseLong(model.get("deviceId").toString());
|
|
|
CuttingTool cuttingTool = cuttingToolService.getOne(new LbqWrapper<CuttingTool>().eq(CuttingTool::getCuttingToolNo, model.get("rfid").toString()).last("LIMIT 1"));
|
|
|
ProductionresourcePosition productionresourcePosition = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, deviceId).eq(ProductionresourcePosition::getStatus, "0").last("LIMIT 1"));
|
|
@@ -241,9 +261,9 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
@ApiOperation(value = "新增刀具取放任务", notes = "新增刀具取放任务")
|
|
|
@PostMapping("/addCutToolTask")
|
|
|
- public R addCutToolTask(@RequestBody Map<String,Object> model) {
|
|
|
+ public R addCutToolTask(@RequestBody Map<String, Object> model) {
|
|
|
BBom bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getStatus, "1").orderByDesc(BBom::getCreateTime).last("limit 1"));
|
|
|
- Map<String, Object> params = new HashMap<String, Object>(){
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>() {
|
|
|
{
|
|
|
put("deliveryTime", DateUtil.dateToString(new Date()));
|
|
|
put("hasMaterial", "0");
|
|
@@ -251,10 +271,10 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
put("singleTaskFlag", "1");
|
|
|
put("status", "1");
|
|
|
put("zoneId", bom.getZoneId());
|
|
|
- put("orderName", "cutToolOrder"+new Date().getTime());
|
|
|
+ put("orderName", "cutToolOrder" + new Date().getTime());
|
|
|
}
|
|
|
};
|
|
|
- Map<String, Object> orderProduct = new HashMap<String, Object>(){
|
|
|
+ Map<String, Object> orderProduct = new HashMap<String, Object>() {
|
|
|
{
|
|
|
put("id", bom.getMeterialId());
|
|
|
put("bomId", bom.getId());
|
|
@@ -271,14 +291,14 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
params.put("orderProductList", orderProductList);
|
|
|
|
|
|
Order order = orderService.save(params);
|
|
|
- String goalType = model.containsKey("goalType")? model.get("goalType").toString() : null;
|
|
|
- String start = model.containsKey("start")? model.get("start").toString() : null;
|
|
|
- if(StringUtil.isEmpty(goalType) || StringUtil.isEmpty(start)) return R.fail("传参有误");
|
|
|
+ String goalType = model.containsKey("goalType") ? model.get("goalType").toString() : null;
|
|
|
+ String start = model.containsKey("start") ? model.get("start").toString() : null;
|
|
|
+ if (StringUtil.isEmpty(goalType) || StringUtil.isEmpty(start)) return R.fail("传参有误");
|
|
|
//目标位是刀具上下料站 则启用天轨线边库刀架支持
|
|
|
//isMachine=0 判断天轨功能事件
|
|
|
- String isXbk = (goalType.contains("365") || goalType.contains("366")) && start.contains("CNC0") ? "1": "0";
|
|
|
+ String isXbk = (goalType.contains("365") || goalType.contains("366")) && start.contains("CNC0") ? "1" : "0";
|
|
|
//刀具待取刀具号或刀具规格处理 (空则无后续取 反之则取指定刀具)
|
|
|
- String confBatchNo = !model.containsKey("rd") && !model.containsKey("specification") ? "" : (model.containsKey("rd")? model.get("rd").toString() : model.get("specification").toString());
|
|
|
+ String confBatchNo = !model.containsKey("rd") && !model.containsKey("specification") ? "" : (model.containsKey("rd") ? model.get("rd").toString() : model.get("specification").toString());
|
|
|
|
|
|
OrderTask orderTask = OrderTask.builder().orderId(order.getId())
|
|
|
.hasMaterial("0").isMachine("0").isXbk(isXbk).start(model.get("start").toString()).goal(model.get("goal").toString())
|
|
@@ -298,9 +318,9 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
@ApiOperation(value = "新增自定义订单任务", notes = "新增自定义订单任务")
|
|
|
@PostMapping("/addOrderTask")
|
|
|
- public R addOrderTask(@RequestBody Map<String,Object> model) {
|
|
|
+ public R addOrderTask(@RequestBody Map<String, Object> model) {
|
|
|
BBom bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getStatus, "1").orderByDesc(BBom::getCreateTime).last("limit 1"));
|
|
|
- Map<String, Object> params = new HashMap<String, Object>(){
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>() {
|
|
|
{
|
|
|
put("deliveryTime", DateUtil.dateToString(new Date()));
|
|
|
put("hasMaterial", "0");
|
|
@@ -308,10 +328,10 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
put("singleTaskFlag", "1");
|
|
|
put("status", "1");
|
|
|
put("zoneId", bom.getZoneId());
|
|
|
- put("orderName", "orderTask"+new Date().getTime());
|
|
|
+ put("orderName", "orderTask" + new Date().getTime());
|
|
|
}
|
|
|
};
|
|
|
- Map<String, Object> orderProduct = new HashMap<String, Object>(){
|
|
|
+ Map<String, Object> orderProduct = new HashMap<String, Object>() {
|
|
|
{
|
|
|
put("id", bom.getMeterialId());
|
|
|
put("bomId", bom.getId());
|
|
@@ -328,20 +348,20 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
params.put("orderProductList", orderProductList);
|
|
|
|
|
|
Order order = orderService.save(params);
|
|
|
- String start = model.containsKey("start")? model.get("start").toString() : null;
|
|
|
- String goal = model.containsKey("goal")? model.get("goal").toString() : null;
|
|
|
- if(StringUtil.isEmpty(start) || StringUtil.isEmpty(goal)) return R.fail("传参有误");
|
|
|
+ String start = model.containsKey("start") ? model.get("start").toString() : null;
|
|
|
+ String goal = model.containsKey("goal") ? model.get("goal").toString() : null;
|
|
|
+ if (StringUtil.isEmpty(start) || StringUtil.isEmpty(goal)) return R.fail("传参有误");
|
|
|
|
|
|
//原加工订单预处理(MQ消息和节点状态改完成)
|
|
|
String[] startNameCondition = start.split("_");
|
|
|
- if(startNameCondition.length != 2 || StringUtils.isEmpty(startNameCondition[1])) return R.fail("传参有误");
|
|
|
+ if (startNameCondition.length != 2 || StringUtils.isEmpty(startNameCondition[1])) return R.fail("传参有误");
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, startNameCondition[1]));
|
|
|
- if(null == startStorge) return R.fail("起始库位不存在");
|
|
|
+ if (null == startStorge) return R.fail("起始库位不存在");
|
|
|
List<TWorkpiece> tWorkpieceList = workpieceService.list(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getIsEnd, "0").eq(TWorkpiece::getPointId, startNameCondition[1]));
|
|
|
- if(tWorkpieceList.size()>1) return R.fail("自定义任务已在执行中");
|
|
|
+ if (tWorkpieceList.size() > 1) return R.fail("自定义任务已在执行中");
|
|
|
TWorkpiece tWorkpiece = tWorkpieceList.get(0);
|
|
|
UpdateWrapper<TaskNode> updateWrapper = new UpdateWrapper();
|
|
|
- updateWrapper.lambda().set(TaskNode::getExeStatus, "3").eq(TaskNode::getExeStatus,"2").eq(TaskNode::getCompleteBatchNo, tWorkpiece.getCompleteBatchNo());
|
|
|
+ updateWrapper.lambda().set(TaskNode::getExeStatus, "3").eq(TaskNode::getExeStatus, "2").eq(TaskNode::getCompleteBatchNo, tWorkpiece.getCompleteBatchNo());
|
|
|
taskNodeService.update(null, updateWrapper);
|
|
|
|
|
|
//isMachine=1 判断地轨功能事件
|