|
|
@@ -1342,5 +1342,119 @@ public class MesProductStorageRecordController extends BaseController {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 打包入库记录 - 按托盘码分组列表页面
|
|
|
+ */
|
|
|
+ @RequiresPermissions("mes:mesProductPackage:view")
|
|
|
+ @RequestMapping(value = "trayList")
|
|
|
+ public String trayList(Model model) {
|
|
|
+ return "modules/mes/mesProductStorageRecordTrayList";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打包入库记录 - 按托盘码分组列表数据
|
|
|
+ */
|
|
|
+ @RequiresPermissions("mes:mesProductPackage:view")
|
|
|
+ @RequestMapping(value = "trayListData")
|
|
|
+ @ResponseBody
|
|
|
+ public Page<Map<String, Object>> trayListData(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ String batchSn = request.getParameter("batchSn");
|
|
|
+ String productModel = request.getParameter("productModel");
|
|
|
+ String createDateGte = request.getParameter("createDate_gte");
|
|
|
+ String createDateLte = request.getParameter("createDate_lte");
|
|
|
+
|
|
|
+ // 构建WHERE条件
|
|
|
+ StringBuilder where = new StringBuilder("WHERE bind = '1' AND batch_sn IS NOT NULL AND batch_sn != ''");
|
|
|
+ List<Object> params = ListUtils.newArrayList();
|
|
|
+ if (StringUtils.hasText(batchSn)) {
|
|
|
+ where.append(" AND batch_sn LIKE ?");
|
|
|
+ params.add("%" + batchSn + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.hasText(productModel)) {
|
|
|
+ where.append(" AND product_model = ?");
|
|
|
+ params.add(productModel);
|
|
|
+ }
|
|
|
+ if (StringUtils.hasText(createDateGte)) {
|
|
|
+ where.append(" AND create_date >= ?");
|
|
|
+ params.add(createDateGte);
|
|
|
+ }
|
|
|
+ if (StringUtils.hasText(createDateLte)) {
|
|
|
+ where.append(" AND create_date <= ?");
|
|
|
+ params.add(createDateLte);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页
|
|
|
+ Page<Map<String, Object>> page = new Page<>(request, response);
|
|
|
+ int pageNo = page.getPageNo();
|
|
|
+ int pageSize = page.getPageSize();
|
|
|
+ int offset = (pageNo - 1) * pageSize;
|
|
|
+
|
|
|
+ // 查询总数
|
|
|
+ String countSql = "SELECT COUNT(DISTINCT batch_sn) FROM mes_product_storage_record " + where.toString();
|
|
|
+ Integer total = jdbcTemplate.queryForObject(countSql, params.toArray(), Integer.class);
|
|
|
+ page.setCount(total != null ? total : 0);
|
|
|
+
|
|
|
+ // 查询分组数据
|
|
|
+ String sql = "SELECT batch_sn AS batchSn, product_model AS productModel, COUNT(*) AS count, " +
|
|
|
+ "MAX(create_by) AS createBy, MAX(create_date) AS createDate " +
|
|
|
+ "FROM mes_product_storage_record " + where.toString() +
|
|
|
+ " GROUP BY batch_sn, product_model ORDER BY MAX(create_date) DESC LIMIT ? OFFSET ?";
|
|
|
+ params.add(pageSize);
|
|
|
+ params.add(offset);
|
|
|
+ List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, params.toArray());
|
|
|
+ page.setList(list);
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打包入库记录 - 托盘详情页面
|
|
|
+ */
|
|
|
+ @RequiresPermissions("mes:mesProductPackage:view")
|
|
|
+ @RequestMapping(value = "trayDetail")
|
|
|
+ public String trayDetail(HttpServletRequest request, Model model) {
|
|
|
+ String batchSn = request.getParameter("batchSn");
|
|
|
+
|
|
|
+ MesProductStorageRecord query = new MesProductStorageRecord();
|
|
|
+ query.setBatchSn(batchSn);
|
|
|
+ query.setBind("1");
|
|
|
+ query.getSqlMap().getOrder().setOrderBy("a.create_date ASC");
|
|
|
+ List<MesProductStorageRecord> list = mesProductStorageRecordService.findList(query);
|
|
|
+
|
|
|
+ // 托盘信息
|
|
|
+ Map<String, Object> trayInfo = MapUtils.newHashMap();
|
|
|
+ trayInfo.put("batchSn", batchSn);
|
|
|
+ trayInfo.put("productModel", ListUtils.isEmpty(list) ? "" : list.get(0).getProductModel());
|
|
|
+ trayInfo.put("count", list.size());
|
|
|
+ trayInfo.put("createBy", ListUtils.isEmpty(list) ? "" : list.get(0).getCreateBy());
|
|
|
+ trayInfo.put("createDate", ListUtils.isEmpty(list) ? "" : list.get(0).getCreateDate());
|
|
|
+ trayInfo.put("remark", ListUtils.isEmpty(list) ? "" : (list.get(0).getRemark() != null ? list.get(0).getRemark() : ""));
|
|
|
+ model.addAttribute("trayInfo", trayInfo);
|
|
|
+
|
|
|
+ // 工件列表
|
|
|
+ model.addAttribute("products", list);
|
|
|
+
|
|
|
+ // 图片
|
|
|
+ List imgList = ListUtils.newArrayList();
|
|
|
+ if (!ListUtils.isEmpty(list)) {
|
|
|
+ String host = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/js";
|
|
|
+ FileUpload fu = new FileUpload();
|
|
|
+ fu.setBizKey(list.get(0).getId());
|
|
|
+ fu.setBizType("mesProductPackage_image");
|
|
|
+ List<FileUpload> finfo = fileUploadService.findList(fu);
|
|
|
+ for (FileUpload fi : finfo) {
|
|
|
+ Map<String, Object> map1 = MapUtils.newHashMap();
|
|
|
+ map1.put("id", fi.getFileEntity().getFileId());
|
|
|
+ map1.put("url", host + fi.getFileUrl());
|
|
|
+ map1.put("name", fi.getFileName());
|
|
|
+ map1.put("size", fi.getFileEntity().getFileSize());
|
|
|
+ imgList.add(map1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ model.addAttribute("imgList", imgList);
|
|
|
+
|
|
|
+ return "modules/mes/mesProductStorageRecordTrayDetail";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|