Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/equipment/equipCardsArrangement.jsp
2026-01-16 14:13:44 +08:00

228 lines
7.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.sipai.tools.SessionManager"%>
<%
SessionManager sessionManager = new SessionManager();
%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var grid;
function selectEquipment(){
var dialog = parent.ext.modalDialog({
title : '选择设备',
width : 800,
height : 450,
closeOnEscape:true,
url : ext.contextPath + '/equipment/showEquipCardForDistrictWork.do?plandate=${requestScope.plandate}&workorderid=${workorderid}&processid=${processid}&taskid=${taskid}',
buttons : [{
text : '确定',
iconCls:'icon-ok',
handler : function() {
var res=dialog.find('iframe').get(0).contentWindow.selectFun();
if(res!=null){
$.post(ext.contextPath + '/work/workorder/save_task_equ.do', {datas:res,workorderid:'${workorderid}',taskid:'${taskid}',processid:'${processid}',arrangementdate:'${requestScope.plandate}'}, function(data) {
if(data==1){
grid.datagrid('reload');
}else{
top.$.messager.alert('提示','添加失败','info');
}
});
}
dialog.dialog('destroy');
}
}
]
});
}
var equiparrange;
function getEquipArrange() {
return equiparrange;
}
var editFun = function(index) {
var row =grid.datagrid("getRows")[index];
//grid timespiner编辑的时间格式需要格式化为1200
equiparrange=row.equipmentArrangements_;
$.each(equiparrange, function(index, item){
if(item.enddt!=null && item.enddt.length>10){
item.enddt=item.enddt.substring(11,16);
}
});
equiparrange=JSON.stringify(equiparrange);
//alert(equiparrange);
var dialog = ext.modalDialog({
title : '安排时间',
width : 700,
height : 360,
closeOnEscape:true,
url : ext.contextPath + '/equipment/doeditEquipArrange.do?equipmentid=${param.equipmentid}&plandate=${dt}',
buttons : [{
text : '保存',
iconCls:'icon-ok',
handler : function() {
var res=dialog.find('iframe').get(0).contentWindow.dosave();
//alert(res);
var temp=JSON.parse(res);
$.each(temp, function(index, item){
if(item.enddt!=null && item.enddt.length<10){
item.enddt="1900-01-01 "+item.enddt;
//alert(item.enddt)
}
});
temp=JSON.stringify(temp);
// alert(temp);
$.post(ext.contextPath + '/equipment/doupdateEquipArrangement.do', {arrangestr:temp} , function(data) {
if(data>0){
grid.datagrid('reload');
grid.datagrid('clearChecked');
}else{
top.$.messager.alert('提示','修改失败','info');
}
});
dialog.dialog('destroy');
}
}]
});
};
var deletesFun = function() {
var checkedItems = $('#grid').datagrid('getChecked');
var datas="";
$.each(checkedItems, function(index, item){
if(datas!=""){
datas+=',';
}
datas+="'"+item.id+"'";
});
if(datas==""){
top.$.messager.alert('提示', '请先选择要删除的记录','info');
}else{
top.$.messager.confirm('提示', '您确定要删除此记录?', function(r) {
if (r) {
$.post(ext.contextPath + '/work/workorder/deletes_task_equ.do', {ids:datas,workorderid:'${workorderid}',taskid:'${taskid}',arrangementdate:'${requestScope.plandate}'} , function(data) {
if(data>0){
grid.datagrid('reload');
grid.datagrid('clearChecked');
}else{
top.$.messager.alert('提示','删除失败','info');
}
});
}
});
}
};
var dosave = function() {
var checkedItems = $('#grid').datagrid('getChecked');
var datas="";
$.each(checkedItems, function(index, item){
datas+=item.equipmentid+",";
});
//if(datas==""){
//top.$.messager.alert('提示', '请选择设备','info');
//}else{
$.post(ext.contextPath + '/work/workTaskEquipment/save.do', {ids:datas,taskid:'${param.taskid}',processrealdetailid:'${param.processrealdetailid}',workstationid:'${param.workstationid}'} , function(data) {
if(data==1){
top.$.messager.alert('提示','保存成功','info');
}else{
top.$.messager.alert('提示','保存失败','info');
}
});
//}
};
function getInfoFromArrangement(arrangement){
var str ="";
$.each(arrangement, function(index, item){
if(str !=""){
str+="\n";
}
if(item.checkFlag){
str+= item.gt_name+": "+ item.stdt.substring(11,16)+" ~ "+item.enddt.substring(11,16);
}
});
//alert(JSON.stringify(arrangement))
//alert(str)
//console.info(arrangement)
return str;
}
var searchgrid = function() {
grid.datagrid('load',ext.contextPath + '/equipment/getEquipCardsArrangement.do?equipmentid=${param.equipmentid}&'+$('#searchForm').serialize());
};
$(function() {
grid = $('#grid').datagrid({
title : '',
url : ext.contextPath + '/equipment/getEquipCardsArrangement.do?equipmentid=${param.equipmentid}&'+$('#searchForm').serialize(),
striped : true,
rownumbers : true,
pagination : true,
selectOnCheck: true,
checkOnSelect: true,
nowrap:false,
idField : 'taskid',
pageSize : 50,
pageList : [ 20, 50, 100],
columns : [ [
{checkbox:true , field : 'ck'},
{width : '120', title : '工单编号', field : 'workorderno_', sortable : false, halign:'center'},
{width : '120', title : '任务名称', field : 'name', sortable : false, halign:'center'},
{width : '120', title : '任务编码', field : 'id', sortable : false, halign:'center'},
{width : '130', title : '分配时段', field : 'remark', sortable : true, halign:'center',formatter:function(value,row){
return getInfoFromArrangement(row.equipmentArrangements_);
}},
{title : '操作', field : 'action', width : '90', halign:'center', align:'center', formatter : function(value, row,index) {
var str = '';
//var arr=JSON.stringify(row.equipmentArrangements_);
<%if (sessionManager.havePermission(session,"equipment/editEquipmentCard.do")) {%>
str += '<img class="iconImg ext-icon-table_edit" title="编辑" onclick="editFun(\''+index+'\');"/> ';
<%}%>
return str;
}
}
] ],
toolbar : '#toolbar',
onLoadSuccess : function(data) {
$('.iconImg').attr('src', ext.pixel_0);
/* if(data){
$.each(data.rows, function(index, item){
if(item._checked){
$('#grid').datagrid('checkRow', index);
}
});
} */
}
});
});
</script>
</head>
<body>
<table id="toolbar" style="width:100%">
<tr>
<td>
<form id="searchForm">
<table class="tooltable">
<tr>
<td>日期</td>
<td><input id="dt" name="dt" class="Wdate" value="${dt}"
onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
readonly></td>
<td>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true"
onclick="searchgrid();">搜索</a>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table id="grid" data-options="fit:true,border:false"></table>
</body>
</html>