|
@@ -39,6 +39,7 @@ import com.github.zuihou.business.productionResourceCenter.service.StationUserSe
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.CodeRuleModule;
|
|
|
+import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
@@ -306,7 +307,8 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
public R addCutToolTaskMore(@RequestBody List<Map<String, Object>> models) {
|
|
|
log.info("=============批量新增刀具取放任务============={}", models);
|
|
|
|
|
|
- StringBuffer buffer = new StringBuffer();
|
|
|
+ StringBuffer bufferSuccess = new StringBuffer();
|
|
|
+ StringBuffer bufferError = new StringBuffer();
|
|
|
/**
|
|
|
* 查询目标点,分配位置
|
|
|
* 1获取目标设备,2查询目标点位,3查询是否需要刀架位
|
|
@@ -376,14 +378,14 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
hashMap.put("goal", "CT_"+availableList.get(0).getPointId());
|
|
|
|
|
|
|
|
|
- if(isJc){
|
|
|
+ if(isJc){//目的为是机床
|
|
|
if(jcDatas.size()<=0){
|
|
|
throw new BizException("无可用刀架号,设备:"+ targetPostion);
|
|
|
}
|
|
|
String s = jcDatas.get(0);
|
|
|
jcDatas.remove(s);
|
|
|
hashMap.put("cutGoalNo", s);
|
|
|
- }else {
|
|
|
+ }else {//目的位置不是机床
|
|
|
if(availableList.size()<=0){
|
|
|
log.error("===批量新增刀具出错==={}", "刀具库无空位置可用");
|
|
|
throw new BizException("刀具库无空位置可用,设备:"+ targetPostion);
|
|
@@ -393,23 +395,30 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
}
|
|
|
|
|
|
R r = this.addCutToolTask(hashMap);
|
|
|
- if (!r.getIsSuccess()) {
|
|
|
- buffer.append(cutterT+ ";原因:" + r.getMsg());
|
|
|
+ if (r.getIsSuccess()) {
|
|
|
+ bufferSuccess.append("<br>刀号成功:"+ cutterT);
|
|
|
+ }else {
|
|
|
+ bufferError.append("<br>刀号失败:"+cutterT+ ";原因:" + r.getMsg());
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
log.error("===批量新增刀具出错==={}", e);
|
|
|
e.printStackTrace();
|
|
|
- buffer.append(model.get("cutterT") + ";原因:" + (e.getMessage()==null?e:e.getMessage()));
|
|
|
+ bufferError.append("<br>刀号失败:"+model.get("cutterT")+ ";原因:" + (e.getMessage()==null?e:e.getMessage()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (buffer.toString().isEmpty()) {
|
|
|
- return R.success();
|
|
|
+ if (bufferError.toString().isEmpty()) {
|
|
|
+ return R.success(null, bufferSuccess.toString());
|
|
|
} else {
|
|
|
- return R.fail(-1, "失败的刀具号:" + buffer.toString());
|
|
|
+ if(!bufferSuccess.toString().isEmpty()){
|
|
|
+ return R.success(-1, "部分成功:" + bufferSuccess.toString()+ bufferError.toString());
|
|
|
+ }else {
|
|
|
+ return R.success(-2, "失败:" + bufferError.toString());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增刀具取放任务", notes = "新增刀具取放任务")
|
|
@@ -453,6 +462,15 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
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("传参有误");
|
|
|
+
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("startCode", DictionaryKey.YJ_ZONE_XBK.get("涡轴柔性加工单元-tool"));
|
|
|
+ map.put("startPointId", start);
|
|
|
+ boolean checkStartBool = productionresourcePositionService.checkXbkTaskStartPointId(map);
|
|
|
+ if(checkStartBool){
|
|
|
+ return R.fail("起点已被任务占用,不可创建任务");
|
|
|
+ }
|
|
|
+
|
|
|
//目标位是刀具上下料站 则启用天轨线边库刀架支持
|
|
|
//isMachine=0 判断天轨功能事件
|
|
|
String isXbk = (goalType.contains("365") || goalType.contains("366")) && start.contains("CNC0") ? "1" : "0";
|
|
@@ -463,7 +481,7 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
|
|
|
OrderTask orderTask = OrderTask.builder().orderId(order.getId())
|
|
|
.hasMaterial("0").isMachine("0").isXbk(isXbk).start(model.get("start").toString()).goal(model.get("goal").toString())
|
|
|
- .cutStartNo(model.get("cutStartNo").toString()).cutGoalNo(model.get("cutGoalNo").toString()).confBatchNo(confBatchNo).isApply(isApply)
|
|
|
+ .cutStartNo(model.get("cutStartNo").toString()).cutGoalNo(model.get("cutGoalNo").toString()).confBatchNo(confBatchNo).isApply(isApply).isDelete(1)
|
|
|
.build();
|
|
|
orderTaskService.save(orderTask);
|
|
|
OrderUpdateDTO orderUpdateDTO = OrderUpdateDTO.builder().ids(Arrays.asList(order.getId())).auditStatus("1").build();
|
|
@@ -527,7 +545,7 @@ public class StationUserController extends SuperController<StationUserService, L
|
|
|
taskNodeService.update(null, updateWrapper);
|
|
|
|
|
|
//isMachine=1 判断地轨功能事件
|
|
|
- OrderTask orderTask = OrderTask.builder().orderId(order.getId())
|
|
|
+ OrderTask orderTask = OrderTask.builder().orderId(order.getId()).isDelete(1)
|
|
|
.hasMaterial("0").isMachine("1").isXbk("1").start(model.get("start").toString()).goal(model.get("goal").toString()).confBatchNo(tWorkpiece.getCompleteBatchNo())
|
|
|
.build();
|
|
|
orderTaskService.save(orderTask);
|