|
@@ -4667,6 +4667,141 @@ public class MesProductRecordController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ // PDA查询所有lineSn
|
|
|
|
|
+ @PostMapping(value = "pdaQueryLineSn")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public CommonResp pdaQueryLineSn(HttpServletRequest request) {
|
|
|
|
|
+ CommonResp resp = new CommonResp<>();
|
|
|
|
|
+ try {
|
|
|
|
|
+ MesLine mesLine = new MesLine();
|
|
|
|
|
+ mesLine.setStatus("0");
|
|
|
|
|
+ List<MesLine> lineList = mesLineService.findList(mesLine);
|
|
|
|
|
+ List<Map<String, Object>> dataList = ListUtils.newArrayList();
|
|
|
|
|
+ Set<String> lineSnSet = new LinkedHashSet<>();
|
|
|
|
|
+ for (MesLine line : lineList) {
|
|
|
|
|
+ if (line != null && StringUtils.isNotBlank(line.getSn())) {
|
|
|
|
|
+ lineSnSet.add(line.getSn());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for (String lineSn : lineSnSet) {
|
|
|
|
|
+ Map<String, Object> map = MapUtils.newHashMap();
|
|
|
|
|
+ map.put("lineSn", lineSn);
|
|
|
|
|
+ dataList.add(map);
|
|
|
|
|
+ }
|
|
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
|
|
+ resp.setMessage("成功");
|
|
|
|
|
+ resp.setData(dataList);
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage(e.getMessage());
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // PDA通过lineSn查询所有oprno
|
|
|
|
|
+ @PostMapping(value = "pdaQueryOprno")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public CommonResp pdaQueryOprno(HttpServletRequest request) {
|
|
|
|
|
+ CommonResp resp = new CommonResp<>();
|
|
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
|
|
+ if (StringUtils.isEmpty(lineSn)) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("参数错误");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<MesLineProcess> processList = mesLineProcessService.findOprnoListByLineSn(lineSn);
|
|
|
|
|
+ List<Map<String, Object>> dataList = ListUtils.newArrayList();
|
|
|
|
|
+ for (MesLineProcess process : processList) {
|
|
|
|
|
+ if (process.getOprno().length()!=5||("OP050".equals(process.getOprno())&&"HEVXT".equals(lineSn))){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, Object> map = MapUtils.newHashMap();
|
|
|
|
|
+ map.put("lineSn", lineSn);
|
|
|
|
|
+ map.put("title", process.getTitle());
|
|
|
|
|
+ map.put("oprno", process.getOprno());
|
|
|
|
|
+ dataList.add(map);
|
|
|
|
|
+ }
|
|
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
|
|
+ resp.setMessage("成功");
|
|
|
|
|
+ resp.setData(dataList);
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage(e.getMessage());
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // PDA查询所有扫码记录
|
|
|
|
|
+ @PostMapping(value = "pdaQueryScanRecord")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public CommonResp pdaQueryScanRecord(HttpServletRequest request) {
|
|
|
|
|
+ CommonResp resp = new CommonResp<>();
|
|
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
|
|
+ String ucode = request.getParameter("ucode");
|
|
|
|
|
+ String startTimeStr = request.getParameter("startTime");
|
|
|
|
|
+ String endTimeStr = request.getParameter("endTime");
|
|
|
|
|
+ if (StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(ucode)
|
|
|
|
|
+ || StringUtils.isEmpty(startTimeStr) || StringUtils.isEmpty(endTimeStr)) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("参数错误");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ Date startTime = parsePdaScanTime(startTimeStr);
|
|
|
|
|
+ Date endTime = parsePdaScanTime(endTimeStr);
|
|
|
|
|
+ if (startTime == null || endTime == null) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("时间格式错误,应为 yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (endTime.before(startTime)) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("结束时间不能小于开始时间");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int total = mesPdaScanRecordService.countNormalByQuery(lineSn, oprno, ucode, startTime, endTime);
|
|
|
|
|
+ List<MesPdaScanRecord> recordList = mesPdaScanRecordService.findNormalListByQuery(lineSn, oprno, ucode,
|
|
|
|
|
+ startTime, endTime);
|
|
|
|
|
+ List<Map<String, Object>> dataList = ListUtils.newArrayList();
|
|
|
|
|
+ for (MesPdaScanRecord record : recordList) {
|
|
|
|
|
+ Map<String, Object> map = MapUtils.newHashMap();
|
|
|
|
|
+ map.put("sn", record.getSn());
|
|
|
|
|
+ map.put("createDate", DateUtils.formatDate(record.getCreateDate(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ dataList.add(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> data = MapUtils.newHashMap();
|
|
|
|
|
+ data.put("total", total);
|
|
|
|
|
+ data.put("lineSn", lineSn);
|
|
|
|
|
+ data.put("oprno", oprno);
|
|
|
|
|
+ data.put("ucode", ucode);
|
|
|
|
|
+ data.put("list", dataList);
|
|
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
|
|
+ resp.setMessage("成功");
|
|
|
|
|
+ resp.setData(data);
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage(e.getMessage());
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Date parsePdaScanTime(String time) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ sdf.setLenient(false);
|
|
|
|
|
+ return sdf.parse(time);
|
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//pda查询工位是否有工件
|
|
//pda查询工位是否有工件
|
|
|
@PostMapping(value = "pdaQueryIsSn")
|
|
@PostMapping(value = "pdaQueryIsSn")
|
|
|
@ResponseBody
|
|
@ResponseBody
|