| | |
| | | if (testMast.getStatus() == 3) { |
| | | return R.ok(); |
| | | } else if (testMast.getStatus() == 2) { |
| | | return R.error("等待员工操作"); |
| | | return R.error("等待员工操作..."); |
| | | } |
| | | return R.error(); |
| | | } |
| | |
| | | .eq("loc_no", testMast.getLocNo()) |
| | | .eq("barcode", testMast.getBarcode()) |
| | | .eq("user_id",testMast.getUserId()) |
| | | .eq("channel",locMast.getChannel().toString()) |
| | | .lt("status",4))){ |
| | | .eq("channel",locMast.getChannel().toString()))){ |
| | | throw new CoolException("更新testMast失败"); |
| | | } |
| | | } |
| | |
| | | |
| | | ReturnT<String> result = moveLocHandler.start(); |
| | | if (!result.isSuccess()) { |
| | | // log.error("测试完成移库失败"); |
| | | log.error("测试完成移库失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @Value("${channel.equipmentRow}") |
| | | private Integer equipmentRow; //测试库位所在排号 |
| | | @Value("${channel.quietRow}") |
| | | private Integer quietRow; //静置库位所在排号 |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start() { |
| | | try { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "F") |
| | | .eq("pack_status", 3) |
| | | .eq("row1", 2) |
| | | .eq("row1", equipmentRow) |
| | | .eq("loc_type1", (short) 1) |
| | | .eq("fire_status",0) |
| | | ); |
| | |
| | | if (!Cools.isEmpty(testMast)){ |
| | | if (testMast.getStatus()==4){ |
| | | //移库开始,查询目标库位 |
| | | LocMast targetLocNo = locMastService.queryFreeLocMast(1,(short)2); |
| | | LocMast targetLocNo = locMastService.queryFreeLocMast(quietRow,(short)2); |
| | | if (Cools.isEmpty(targetLocNo)){ |
| | | targetLocNo=locMastService.queryFreeLocMast(2,(short)2); |
| | | targetLocNo=locMastService.queryFreeLocMast(equipmentRow,(short)2); |
| | | } |
| | | if (targetLocNo != null){ |
| | | workService.locMove(locMast.getLocNo(),targetLocNo.getLocNo(),(long)Integer.parseInt(testMast.getUserId())); |
| | | }else { |
| | | log.error("没有空库位"); |
| | | log.error("测试完成自动移库--->没有空库位!"); |
| | | } |
| | | }else if (testMast.getStatus()!=4) { |
| | | log.error("测试状态异常,库位号为:" + testMast.getLocNo()); |
| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | combParam.setLocNo(locMast.getLocNo()); |
| | | combParam.setPackSts(6); |
| | | combParam.setRequestTime(DateUtils.convert(new Date())); |
| | | postMesData(inpath,combParam); |
| | | new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam); |
| | | |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:"+locMast.getLocNo()); |
| | |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | private ReturnT<String> postMesData(String mesPath,Object combParam){ |
| | | if(combParam != null){ |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(mesUrl) |
| | | .setPath(mesPath) |
| | | .setJson(JSON.toJSONString(combParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", mesUrl+mesPath, JSON.toJSONString(combParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | // MesConstant.URL + MesConstant.PAKIN_URL, |
| | | apiLogService.save( |
| | | "上报mes系统", |
| | | mesUrl + mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | combParam.setLocNo(locMast.getLocNo()); |
| | | combParam.setPackSts(5); |
| | | combParam.setRequestTime(DateUtils.convert(new Date())); |
| | | postMesData(inpath,combParam); |
| | | new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam); |
| | | } |
| | | if (!locMastService.updateById(locMast)) { |
| | | // exceptionHandle("库位移转 ===>> 修改目标库位状态失败;[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | private ReturnT<String> postMesData(String mesPath,Object combParam){ |
| | | if(combParam != null){ |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(mesUrl) |
| | | .setPath(mesPath) |
| | | .setJson(JSON.toJSONString(combParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", mesUrl+mesPath, JSON.toJSONString(combParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "上报mes系统", |
| | | mesUrl + mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |