Browse Source

包装入库

wangxichen 3 days ago
parent
commit
0b73c7452d

+ 114 - 0
src/main/java/com/jeesite/modules/mes/web/MesProductStorageRecordController.java

@@ -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";
+	}
+
 	
 }

+ 117 - 0
src/main/resources/views/modules/mes/mesProductStorageRecordTrayDetail.html

@@ -0,0 +1,117 @@
+<% layout('/layouts/default.html', {title: '打包入库详情', libs: ['dataGrid']}){ %>
+<div class="main-content">
+	<div class="box box-main">
+		<div class="box-header with-border">
+			<div class="box-title">
+				<i class="fa icon-note"></i> ${text('打包入库详情')}
+			</div>
+			<div class="box-tools pull-right">
+				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+			</div>
+		</div>
+		<div class="box-body">
+			<div class="form-horizontal">
+				<div class="form-unit">${text('托盘信息')}</div>
+				<div class="row">
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('托盘码')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.batchSn}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('产品型号')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.productModel}</p>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div class="row">
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('工件数量')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.count}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('入库人')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.createBy}</p>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div class="row">
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('入库时间')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.createDate}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-3">${text('备注')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${trayInfo.remark}</p>
+							</div>
+						</div>
+					</div>
+				</div>
+
+				<div class="form-unit">${text('工件列表')}</div>
+				<div class="row">
+					<div class="col-xs-12">
+						<table class="table table-bordered table-hover">
+							<thead>
+								<tr>
+									<th style="text-align:center; width:60px;">${text('序号')}</th>
+									<th style="text-align:center;">${text('工件码')}</th>
+									<th style="text-align:center;">${text('入库时间')}</th>
+								</tr>
+							</thead>
+							<tbody>
+								<% for(var i = 0; i < products.~size; i++) { %>
+								<tr>
+									<td style="text-align:center;">${i + 1}</td>
+									<td style="text-align:center;">${products[i].sn}</td>
+									<td style="text-align:center;">${products[i].createDate}</td>
+								</tr>
+								<% } %>
+							</tbody>
+						</table>
+					</div>
+				</div>
+
+				<% if(imgList != null && imgList.~size > 0) { %>
+				<div class="form-unit">${text('图片')}</div>
+				<div class="row">
+					<div class="col-xs-12" style="padding-left:30px;">
+						<% for(var i = 0; i < imgList.~size; i++) { %>
+						<a href="${imgList[i].url}" target="_blank">
+							<img src="${imgList[i].url}" style="max-width:200px; max-height:200px; margin:5px;"/>
+						</a>
+						<% } %>
+					</div>
+				</div>
+				<% } %>
+			</div>
+		</div>
+		<div class="box-footer">
+			<div class="row">
+				<div class="col-sm-offset-2 col-sm-10">
+					<button type="button" class="btn btn-sm btn-default" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+<% } %>

+ 85 - 0
src/main/resources/views/modules/mes/mesProductStorageRecordTrayList.html

@@ -0,0 +1,85 @@
+<% layout('/layouts/default.html', {title: '打包入库记录管理', libs: ['dataGrid']}){ %>
+<div class="main-content">
+	<div class="box box-main">
+		<div class="box-header">
+			<div class="box-title">
+				<i class="fa icon-notebook"></i> ${text('打包入库记录管理')}
+			</div>
+			<div class="box-tools pull-right">
+				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
+				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
+			</div>
+		</div>
+		<div class="box-body">
+			<form id="searchForm" action="${ctx}/mes/mesProductStorageRecord/trayListData" method="post" class="form-inline hide"
+					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="">
+				<div class="form-group">
+					<label class="control-label">${text('托盘码')}:</label>
+					<div class="control-inline">
+						<input type="text" name="batchSn" maxlength="255" class="form-control width-160"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('产品型号')}:</label>
+					<div class="control-inline width-120">
+						<select name="productModel" class="form-control" id="productModelSelect">
+							<option value="">${text('请选择')}</option>
+						</select>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('入库时间')}:</label>
+					<div class="control-inline">
+						<input type="text" name="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
+							data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
+						&nbsp;-&nbsp;
+						<input type="text" name="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
+							data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
+					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
+				</div>
+			</form>
+			<table id="dataGrid"></table>
+			<div id="dataGridPage"></div>
+		</div>
+	</div>
+</div>
+<% } %>
+<script>
+$('#dataGrid').dataGrid({
+	searchForm: $("#searchForm"),
+	columnModel: [
+		{header:'${text("托盘码")}', name:'batchSn', width:280, align:"center", frozen:true},
+		{header:'${text("产品型号")}', name:'productModel', width:150, align:"center"},
+		{header:'${text("工件数量")}', name:'count', width:100, align:"center"},
+		{header:'${text("入库人")}', name:'createBy', width:150, align:"center"},
+		{header:'${text("入库时间")}', name:'createDate', width:180, align:"center"},
+		{header:'${text("操作")}', name:'actions', width:100, formatter: function(val, obj, row, act){
+			var actions = [];
+			actions.push('<a href="${ctx}/mes/mesProductStorageRecord/trayDetail?batchSn='+encodeURIComponent(row.batchSn)+'" class="btnList" title="${text("详情")}"><i class="fa fa-eye"></i></a>&nbsp;');
+			return actions.join('');
+		}}
+	],
+	ajaxSuccess: function(data){}
+});
+
+// 加载产品型号下拉
+$.ajax({
+	url: '${ctx}/mes/mesProductStorageRecord/getProductModelList',
+	type: 'POST',
+	dataType: 'json',
+	success: function(result) {
+		if (result.result == 'true' || result.result == true) {
+			var data = result.data;
+			var html = '<option value="">${text("")}</option>';
+			for (var i = 0; i < data.length; i++) {
+				html += '<option value="' + data[i].model + '">' + data[i].model + (data[i].title ? ' - ' + data[i].title : '') + '</option>';
+			}
+			$('#productModelSelect').html(html);
+		}
+	}
+});
+</script>