| | |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | |
| | | @PostMapping("/run/delRgvTask")//Take Put Walk |
| | | @ManagerAuth(memo = "小车取货") |
| | | public R rgvDelRgvTask(@RequestParam(defaultValue = "0") Integer rgvNo |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | | return R.error("请选择小车"); |
| | | } |
| | | |
| | | try { |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | | rgvThread.setDelRgvTask(); |
| | | } catch (Exception e) { |
| | | return R.error("任务生成失败"+e.getMessage()); |
| | | } |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | } |
| | |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.asrs.entity.param.CarryParam; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | |
| | | @Value("${wms.taskStatusFeedbackPath}") |
| | | private String taskStatusFeedbackPath; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/addTask/auth") |
| | | @ManagerAuth |
| | | public R addTaskPoint(CarryParam param){ |
| | | try{ |
| | | param.updateIoTyoe(param.getIoType());//中航下发 1:出库,2:移库 3:入库 ====转换为====> 1:入库,2:出库,3:移库 |
| | | param.updateLocNo(); |
| | | if (Cools.isEmpty(param)){ |
| | | return R.error("参数为空!"); |
| | | } else if (Cools.isEmpty(param.getTaskNo())){ |
| | | return R.error("任务号为空!"); |
| | | } else if (Cools.isEmpty(param.getIoType())){ |
| | | return R.error("任务类型为空!"); |
| | | } |
| | | if (Cools.isEmpty(param.getStartPoint()) || Cools.isEmpty(param.getTargetPoint())){ |
| | | return R.error("初始目标或者目标位为空"); |
| | | } |
| | | |
| | | |
| | | String locNo=null; |
| | | if(param.getIoType()==1){ |
| | | locNo=param.getTargetPoint(); |
| | | }else{ |
| | | locNo=param.getStartPoint(); |
| | | } |
| | | LocMast locMast = locMastService.selectByLocNo(locNo); |
| | | if(Cools.isEmpty(locMast)){ |
| | | return R.error("初始库位无法找到"); |
| | | } |
| | | |
| | | R r = null; |
| | | |
| | | if(param.getIoType() == 1){ |
| | | //入库任务创建 |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("type_no",1) |
| | | .eq("crn_no",locMast.getCrnNo()) |
| | | .eq("stn_no",param.getStartPoint())); |
| | | if(Cools.isEmpty(staDesc)){ |
| | | return R.error("入库路劲不存在"); |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo(),staDesc.getCrnStn())); |
| | | |
| | | }else if(param.getIoType() == 2){ |
| | | //出库任务创建 |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("type_no",2) |
| | | .eq("crn_no",locMast.getCrnNo()) |
| | | .eq("stn_no",param.getTargetPoint())); |
| | | if(Cools.isEmpty(staDesc)){ |
| | | return R.error("出库路劲不存在"); |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo(),staDesc.getStnNo())); |
| | | }else if (param.getIoType() == 3){ |
| | | LocMast locMast2 = locMastService.selectByLocNo(param.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast2)){ |
| | | return R.error("目标库位无法找到"); |
| | | } |
| | | if (!locMast2.getCrnNo().equals(locMast.getCrnNo())){ |
| | | return R.error("起始库位与目标库位不再同一巷道"); |
| | | } |
| | | //移库任务创建 |
| | | r = openService.taskCreate(new TaskCreateParam(param,locMast.getCrnNo())); |
| | | } |
| | | |
| | | apiLogService.save("wcs手动生成Wms任务" |
| | | ,request.getRemoteAddr()+request.getRequestURI() |
| | | ,null |
| | | ,request.getRemoteAddr() |
| | | ,JSON.toJSONString(param) |
| | | ,r.toString() |
| | | ,true |
| | | ); |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam String taskNo){ |
| | |
| | | private boolean resetFlag2 = false; |
| | | |
| | | private boolean connectRgv = false; |
| | | private boolean delRgvTask = false; |
| | | |
| | | public RgvThread(RgvSlave slave) { |
| | | this.slave = slave; |
| | |
| | | private void taskComplete() { |
| | | while (true) { |
| | | try { |
| | | if (delRgvTask){ |
| | | writeDelRgvTask(); |
| | | delRgvTask = false; |
| | | continue; |
| | | } |
| | | Thread.sleep(100); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB100.12", (short) 1); |
| | | boolean[] status = siemensNet.getByteTransform().TransBool(result.Content, 0, 1); |
| | |
| | | taskProtocolCache.removeTaskProtocol(taskProtocol.getTaskNoDirection()); |
| | | break; |
| | | } else { |
| | | Thread.sleep(100); |
| | | TaskProtocol issued = new TaskProtocol(taskProtocol,true); |
| | | write(issued); |
| | | taskProtocolCache.removeTaskProtocol(taskProtocol.getTaskNoDirection()); |
| | |
| | | for (TaskProtocol taskProtocol : allTakeTaskProtocol) { |
| | | if (taskProtocol.getIsRunning() == 1) {//准备下发 |
| | | // RgvProtocol rgvProtocolOther = RgvStatusCache.getRgvStatus(slave.getOtherId()); |
| | | if (taskProtocol.getTaskStatus()==3){ |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, taskProtocol.getTargetPositionStaNoPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(taskProtocol.getTargetPositionStaNo()); |
| | | if (staProtocol == null ) { |
| | | continue; |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (!staProtocol.isAutoing() || staProtocol.isLoading() |
| | | || staProtocol.getWorkNo() != 0 |
| | | ){ |
| | | Thread.sleep(500); |
| | | // System.out.println("<放货目标站>" + taskProtocol.getTargetPositionStaNo() + "<非自动或者有物或者存在工作号!!!>"); |
| | | // continue; |
| | | } |
| | | } |
| | | //双车 |
| | | if (rgvOtherStatusEnable()) { |
| | | //另一台车是否允许此台车执行 |
| | |
| | | } |
| | | if (taskProtocol.getTargetPosition()<=rgvProtocol.getRgvPos()+50 |
| | | && taskProtocol.getTargetPosition()>=rgvProtocol.getRgvPos()-50){ |
| | | Thread.sleep(100); |
| | | if (taskProtocol.getTaskStatus()==3){ |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, taskProtocol.getTargetPositionStaNoPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(taskProtocol.getTargetPositionStaNo()); |
| | |
| | | if (!staProtocol.isAutoing() || staProtocol.isLoading() |
| | | || staProtocol.getWorkNo() != 0 |
| | | ){ |
| | | System.out.println("<放货目标站>" + taskProtocol.getTargetPositionStaNo() + "<非自动或者有物或者存在工作号!!!>"); |
| | | Thread.sleep(500); |
| | | // System.out.println("<放货目标站>" + taskProtocol.getTargetPositionStaNo() + "<非自动或者有物或者存在工作号!!!>"); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | taskProtocolCache.removeTaskProtocol(taskProtocol.getTaskNoDirection()); |
| | | break; |
| | | } else { |
| | | Thread.sleep(100); |
| | | TaskProtocol issued = new TaskProtocol(taskProtocol,true); |
| | | write(issued); |
| | | break; |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean writeDelRgvTask() throws InterruptedException { |
| | | // |
| | | OperateResult result = siemensNet.Write("DB100.12.0", false); |
| | | OperateResult result0 = siemensNet.Write("DB100.0", (int) 0); |
| | | OperateResult result1 = siemensNet.Write("DB100.4", (short) 0); |
| | | OperateResult result2 = siemensNet.Write("DB100.6", (int) 0); |
| | | OperateResult result3 = siemensNet.Write("DB100.10", (short) 0); // 执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | |
| | | try { |
| | | // 日志记录 |
| | | BasRgvOptService bean = SpringUtils.getBean(BasRgvOptService.class); |
| | | BasRgvOpt basRgvOpt = new BasRgvOpt( |
| | | 0, |
| | | 0, |
| | | slave.getId(), |
| | | new Date(), |
| | | String.valueOf(0), |
| | | null, |
| | | null, |
| | | null, |
| | | result.IsSuccess ? 1 : 0, |
| | | null, |
| | | new Date(), |
| | | null |
| | | ); |
| | | bean.insert(basRgvOpt); |
| | | } catch (Exception ignore) { |
| | | } |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | | Thread.sleep(200); |
| | | this.readStatus(); |
| | | log.info("RGV 命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON("null")); |
| | | OutputQueue.RGV.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON("null"))); |
| | | return true; |
| | | } else { |
| | | OutputQueue.RGV.offer(MessageFormat.format("【{0}】写入RGV plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | log.error("写入RGV plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void setDelRgvTask() { |
| | | delRgvTask = true; |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | siemensNet.ConnectClose(); |
| | |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | addTask() { |
| | | this.addTaskFormVisible = true |
| | | }, |
| | | exportTable() { |
| | | this.tableSearchParam = { |
| | | task_no: null, |
| | |
| | | <el-button @click="requestOperate('TakeAndPut')" type="primary">取放货</el-button> |
| | | <el-button @click="requestOperate('walk')" type="warning">行走</el-button> |
| | | <el-button @click="requestOperate('del')" type="warning">任务清空</el-button> |
| | | <el-button @click="requestOperate('delRgvTask')" type="warning">小车强制复位(有任务或者运行时不要操作)</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData">查询</el-button> |
| | | <el-button type="primary" @click="resetParam">重置</el-button> |
| | | <el-button type="primary" @click="addTask">手动添加任务</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;"> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog :title="addTaskFormTitle" :visible.sync="addTaskFormVisible"> |
| | | <el-form :model="addTaskForm"> |
| | | <el-form-item label="任务号" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.taskNo" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务类型=》1:出库、2:移库、3:入库" :label-width="200"> |
| | | <el-input v-model="addTaskForm.ioType" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="优先级" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.taskPriority" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="容器编码" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.barcode" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="起点位置" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.startPoint" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="终点位置" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.targetPoint" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="备注" :label-width="addTaskFormLabelWidth"> |
| | | <el-input v-model="addTaskForm.memo" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="addTaskFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="addTaskFormConfirm">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | <script> |
| | | var $layui = layui.config({ |
| | |
| | | datetime: null, |
| | | }, |
| | | taskWrkFormVisible: false, |
| | | addTaskFormVisible: false, |
| | | taskWrkForm: {}, |
| | | addTaskForm: { |
| | | taskNo:"9001", |
| | | ioType:"0", |
| | | taskPriority:1, |
| | | barcode:"10000001", |
| | | startPoint:"1000", |
| | | targetPoint:"F-F01-01-01-01", |
| | | memo:"cs" |
| | | }, |
| | | taskWrkFormLabelWidth: '80px', |
| | | taskWrkFormTitle: '' |
| | | addTaskFormLabelWidth: '80px', |
| | | taskWrkFormTitle: '', |
| | | addTaskFormTitle: '手动添加任务' |
| | | }, |
| | | created() { |
| | | this.init() |
| | |
| | | wrk_no: null |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | addTask() { |
| | | this.addTaskFormVisible = true |
| | | }, |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | addTaskFormConfirm() { |
| | | //修改指定任务数据 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/addTask/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: this.addTaskForm, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code == 200) { |
| | | that.addTaskFormVisible = false |
| | | that.$message({ |
| | | message: "更新成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |