1144 lines
43 KiB
Plaintext
1144 lines
43 KiB
Plaintext
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
|
<%@page import="java.util.Date" %>
|
|
<%@page import="java.text.SimpleDateFormat" %>
|
|
<%@ page import="com.sipai.tools.SessionManager"%>
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
|
<%
|
|
SessionManager sessionManager = new SessionManager();
|
|
%>
|
|
<%String contextPath = request.getContextPath();%>
|
|
<%request.setAttribute("Flag_Edit",com.sipai.entity.plan.DailyPlan.Flag_Edit);%>
|
|
<%request.setAttribute("Flag_Check",com.sipai.entity.plan.DailyPlan.Flag_Check);%>
|
|
<%request.setAttribute("Flag_Finish",com.sipai.entity.plan.DailyPlan.Flag_Finish);%>
|
|
<%request.setAttribute("Flag_Issue",com.sipai.entity.plan.DailyPlan.Flag_Issue);%>
|
|
<%request.setAttribute("Flag_ReEdit",com.sipai.entity.plan.DailyPlan.Flag_ReEdit);%>
|
|
<%request.setAttribute("Flag_Submit",com.sipai.entity.plan.DailyPlan.Flag_Submit);%>
|
|
<%request.setAttribute("Flag_Delete",com.sipai.entity.plan.DailyPlan.Flag_Delete);%>
|
|
|
|
<%request.setAttribute("Flag_Suspend",com.sipai.entity.plan.DailyPlan.Flag_Suspend);%>
|
|
<%request.setAttribute("Flag_Active",com.sipai.entity.plan.DailyPlan.Flag_Active);%>
|
|
|
|
<%request.setAttribute("TO_Flag_ERPConfirm",com.sipai.entity.plan.Taskorder.TO_Flag_ERPConfirm);%>
|
|
<%request.setAttribute("TO_Flag_Issued",com.sipai.entity.plan.Taskorder.TO_Flag_Issued);%>
|
|
<%request.setAttribute("TO_Flag_Working",com.sipai.entity.plan.Taskorder.TO_Flag_Working);%>
|
|
<%request.setAttribute("TO_Flag_Closed",com.sipai.entity.plan.Taskorder.TO_Flag_Closed);%>
|
|
<%request.setAttribute("TO_Flag_Cancel",com.sipai.entity.plan.Taskorder.TO_Flag_Cancel);%>
|
|
<%request.setAttribute("TO_Flag_NoPlan",com.sipai.entity.plan.Taskorder.TO_Flag_NoPlan);%>
|
|
<%request.setAttribute("TO_Flag_ERPIssued",com.sipai.entity.plan.Taskorder.TO_Flag_ERPIssued);%>
|
|
|
|
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
|
<style type="text/css">
|
|
.subtotal { font-weight: bold; }/*合计单元格样式*/
|
|
</style>
|
|
<script type="text/javascript">
|
|
var grid;
|
|
var gridAll;
|
|
var invalidategrid;
|
|
var ddv;
|
|
var ddvall;
|
|
var ddvpid='${dailyplansummary.id }';
|
|
var order_n0;
|
|
var order_n;
|
|
var index_n0;
|
|
var index_n;
|
|
var allowDndflag=0;
|
|
var addFun = function(taskorderid) {
|
|
var dialog = parent.ext.modalDialog({
|
|
iframeId:'add',
|
|
title : '新增日计划',
|
|
url : ext.contextPath + '/plan/dailyplan/add.do?iframeId=add&date=${param.sdt}&plandate=${dailyplansummary.plandt}&pid=${dailyplansummary.id }&taskorderid='+taskorderid,
|
|
buttons : [
|
|
{
|
|
text : '保存',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
|
}
|
|
}
|
|
]
|
|
});
|
|
};
|
|
var addOldFun = function() {
|
|
var dialog = parent.ext.modalDialog({
|
|
iframeId:'addold',
|
|
title : '新增旧单日计划',
|
|
url : ext.contextPath + '/plan/dailyplan/addoldorderplan.do?iframeId=addold&date=${param.sdt}&plandate=${dailyplansummary.plandt}&pid=${dailyplansummary.id }&insertpid=${dailyplansummary.insertpid }',
|
|
buttons : [
|
|
{
|
|
text : '保存',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
|
}
|
|
}
|
|
|
|
]
|
|
});
|
|
};
|
|
var viewFun = function(id) {
|
|
//grid.datagrid('clearChecked');
|
|
var dialog = parent.ext.modalDialog({
|
|
width: 800,
|
|
height:600,
|
|
title : '查看日计划',
|
|
url : ext.contextPath + '/plan/dailyplan/view.do?id='+id,
|
|
buttons : [ {
|
|
text : '关闭',
|
|
handler : function() {
|
|
dialog.dialog('destroy');
|
|
}
|
|
}]
|
|
});
|
|
};
|
|
//分配工作量-wxp
|
|
var distFun = function(planid,prid) {
|
|
var dialog = parent.ext.modalDialog({
|
|
width: 1200,
|
|
height:550,
|
|
title : '分配任务量',
|
|
url : ext.contextPath + '/plan/dailyplansummary/showDistricWork.do?processrealid='+prid+'&planid='+planid,
|
|
buttons : [ {
|
|
text : '关闭',
|
|
handler : function() {
|
|
|
|
dialog.dialog('destroy');
|
|
}
|
|
}],
|
|
onDestroy:function(){
|
|
grid.datagrid('reload');
|
|
|
|
}
|
|
|
|
});
|
|
};
|
|
|
|
/* 提交日计划 至审核*/
|
|
function dosubmit(id){
|
|
parent.$.messager.confirm('提示', '您确定要提交计划?提交计划等待审核,将无法修改。', function(r) {
|
|
if(r){
|
|
submitFun(id);
|
|
|
|
}else{
|
|
return ;
|
|
}
|
|
}) ;
|
|
}
|
|
/* 提交多条日计划 至审核*/
|
|
function dosubmits(){
|
|
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{
|
|
parent.$.messager.confirm('提示', '您确定要提交计划?提交计划等待审核,将无法修改。', function(r) {
|
|
if(r){
|
|
submitFun(datas);
|
|
|
|
}else{
|
|
return ;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function submitFun(ids){
|
|
//console.info(dailyPlans)
|
|
var flag=false;
|
|
var idArray=ids.split(",");
|
|
for(var i=0;i<idArray.length;i++){
|
|
for(var j=0;j< dailyPlans.length;j++){
|
|
//console.info(id)
|
|
if(idArray[i]==dailyPlans[j].id){
|
|
//console.info(dailyPlans[j].demands);
|
|
if(dailyPlans[j].demands.length==0){
|
|
flag=true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//alert(flag)
|
|
if(flag){
|
|
top.$.messager.alert('提示', "有计划未配置任务量,无法提交审核!", 'info');
|
|
}else{
|
|
$.post(ext.contextPath + "/plan/dailyplan/updatebyid.do", {id : ids}, function(data) {
|
|
if (data == 1) {
|
|
top.$.messager.alert('提示', "提交成功", 'info', function() {
|
|
grid.datagrid('reload');
|
|
|
|
});
|
|
}else if(data == 0){
|
|
top.$.messager.alert('提示', "提交失败", 'info');
|
|
}else{
|
|
top.$.messager.alert('提示', data, 'info');
|
|
}
|
|
},'json');
|
|
}
|
|
|
|
}
|
|
var doaudit = function() {
|
|
var dialog = parent.ext.modalDialog({
|
|
iframeId:'audit',
|
|
width: 480,
|
|
height:320,
|
|
title : '审核日计划信息',
|
|
url : ext.contextPath + '/plan/dailyplansummary/audit.do?id=${dailyplansummary.id }'+'&iframeId=${param.iframeId}',
|
|
buttons : [ {
|
|
text : '保存',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.dosave(dialog);
|
|
}
|
|
} ]
|
|
});
|
|
};
|
|
var editFun = function(id) {
|
|
var dialog = parent.ext.modalDialog({
|
|
iframeId:'edit',
|
|
width: 800,
|
|
height:590,
|
|
title : '编辑日计划',
|
|
url : ext.contextPath + '/plan/dailyplan/edit.do?id=' + id+'&iframeId=edit',
|
|
buttons : [ {
|
|
text : '保存',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
|
}
|
|
} ]
|
|
});
|
|
};
|
|
var deleteFun = function(id) {
|
|
parent.$.messager.confirm('提示', '您确定要删除此记录?计划删除后工单将自动作废。', function(r) {
|
|
if (r) {
|
|
$.post(ext.contextPath + '/plan/dailyplan/delete.do', {id : id}, function(data) {
|
|
if(data==1){
|
|
top.$.messager.alert('提示','删除成功','info');
|
|
grid.datagrid('reload');
|
|
}else{
|
|
top.$.messager.alert('提示','删除失败','info');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
var deletesFun = function() {
|
|
var checkedItems = $('#grid').datagrid('getChecked');
|
|
var datas="";
|
|
$.each(checkedItems, function(index, item){
|
|
if(item.status=='${Flag_Edit}'){//下发后的计划不能删除
|
|
datas+=item.id+",";
|
|
}else{
|
|
top.$.messager.alert('提示', '下发后的计划('+item.insdt.substring(0,19)+')不能删除','info');
|
|
}
|
|
|
|
});
|
|
if(datas==""){
|
|
top.$.messager.alert('提示', '未查询到需要删除的记录','info');
|
|
}else{
|
|
top.$.messager.confirm('提示', '您确定要删除多条记录?计划删除后工单将自动作废。', function(r) {
|
|
if (r) {
|
|
$.post(ext.contextPath + '/plan/dailyplan/deletes.do', {ids:datas} , function(data) {
|
|
if(data>0){
|
|
top.$.messager.alert('提示','成功删除'+data+'条记录','info');
|
|
grid.datagrid('reload');
|
|
grid.datagrid('clearChecked');
|
|
}else{
|
|
top.$.messager.alert('提示','删除失败','info');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
var suspendFun = function(id,status) {
|
|
var tip="";
|
|
var status_="";
|
|
if(status=="${Flag_Suspend}"){
|
|
tip="激活";
|
|
status_="${Flag_Active}";
|
|
}else {
|
|
tip="挂起";
|
|
status_="${Flag_Suspend}";
|
|
}
|
|
parent.$.messager.confirm('提示', '您确定要'+tip+'此记录?', function(r) {
|
|
if (r) {
|
|
$.post(ext.contextPath + '/plan/dailyplan/suspend.do', {id : id,suspended:status_}, function(data) {
|
|
if(data==1){
|
|
parent.$.messager.alert('提示',tip+'成功','info',function(){
|
|
grid.datagrid('reload');
|
|
});
|
|
}else{
|
|
parent.$.messager.alert('提示',tip+'失败','info');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
var flag=0;
|
|
$(function() {
|
|
//任务单列表
|
|
$('#grid_taskorder').datagrid({
|
|
view: detailview,
|
|
detailFormatter:function(index,row){
|
|
return '<div style="padding:2px"><table class="ddv"></table></div>';
|
|
},
|
|
title : '',
|
|
url : ext.contextPath + '/plan/taskorder/getUnFinishTaskorder.do',
|
|
striped : true,
|
|
rownumbers : true,
|
|
pagination : true,
|
|
singleSelect: true,
|
|
ctrlSelect:true,
|
|
selectOnCheck: false,
|
|
checkOnSelect: false,
|
|
idField : 'id',
|
|
pageSize : 50,
|
|
pageList : [ 20, 50, 100],
|
|
columns : [ [
|
|
{checkbox:true , field : 'ck'},
|
|
{width : '180', title : '任务单编号', field : 'tasklistcode', sortable : true, halign:'center'},
|
|
{width : '150', title : '产品编码', field : 'productno', sortable : true, halign:'center'},
|
|
{width : '60', title : '产品数量', field : 'prodamount', sortable : true, halign:'center'},
|
|
{width : '120', title : '销售单号', field : 'salesno', sortable : true, align:'center', halign:'center'},
|
|
{width : '120', title : '开始日期', field : 'pstdate', sortable : true, align:'center', halign:'center',formatter:function(value,row){
|
|
var str = value.substring(0,10);
|
|
return str;
|
|
}},
|
|
{width : '120', title : '结束日期', field : 'pendate', sortable : true, align:'center', halign:'center',formatter:function(value,row){
|
|
var str = value.substring(0,10);
|
|
return str;
|
|
}},
|
|
{width : '80', title : '任务单状态', field : 'billstatus', sortable : true,align:'center', halign:'center',formatter:function(value,row){
|
|
switch (value) {
|
|
case '${TO_Flag_ERPConfirm}':
|
|
return '确认';
|
|
case '${TO_Flag_Issued}':
|
|
return '下发';
|
|
case '${TO_Flag_Working}':
|
|
return '开工';
|
|
case '${TO_Flag_Closed}':
|
|
return '结案';
|
|
case '${TO_Flag_Cancel}':
|
|
return '作废';
|
|
case '${TO_Flag_NoPlan}':
|
|
return '未排计划';
|
|
case '${TO_Flag_ERPIssued}':
|
|
return 'ERP下达';
|
|
default:
|
|
return '';
|
|
}
|
|
}},
|
|
{width : '120', title : '下达时间', field : 'billruntime', sortable : true, halign:'center',formatter:function(value,row){
|
|
var str = value.substring(0,10);
|
|
return str;
|
|
}},
|
|
{title : '操作', field : 'action', width : '50', halign:'center', align:'center', formatter : function(value, row) {
|
|
var str = '';
|
|
<%if (sessionManager.havePermission(session,"plan/taskorder/editTaskorder.do")) {%>
|
|
str += '<img class="iconImg ext-icon-table_add" title="新增日计划" onclick="addFun(\''+row.id+'\');"/> ';
|
|
<%}%>
|
|
return str;
|
|
}
|
|
}
|
|
|
|
] ],
|
|
onLoadSuccess : function(data) {
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
|
//展开所有的行
|
|
/* for(var i=0;i<data.rows.length;i++){
|
|
$('#grid_taskorder').datagrid('expandRow',i);
|
|
} */
|
|
|
|
},
|
|
onExpandRow: function(index,row){
|
|
ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
|
|
ddv.datagrid({
|
|
url:ext.contextPath + '/plan/taskorder/getTask.do?pid='+row.id,
|
|
fitColumns:true,
|
|
ctrlSelect:true,
|
|
singleSelect: false,
|
|
selectOnCheck: false,
|
|
checkOnSelect: false,
|
|
striped: true,
|
|
idField : 'id',
|
|
rownumbers:true,
|
|
//loadMsg:'',
|
|
height:'auto',
|
|
rowStyler: function(index,row){
|
|
var rowstyler='';
|
|
if (row.taskchangedstatus!=null){
|
|
if(row.taskchangedstatus=='true' ||row.taskchangedstatus=='TRUE'){
|
|
rowstyler+= 'font-weight:bold;';
|
|
}
|
|
}
|
|
if(row.status=='3'){
|
|
rowstyler+= ' background-color:#C0C0C0;color:#fff;';
|
|
}else if(row.status=='6'){
|
|
rowstyler+= ' font-style:ltalic;';
|
|
}
|
|
return rowstyler;
|
|
},
|
|
columns : [ [
|
|
|
|
{width : '170', title : '任务编号', field : 'taskcode', sortable : true, halign:'center'},
|
|
{width : '90', title : '生产车间', field : 'workshop', sortable : true, halign:'center'},
|
|
{width : '140', title : '物料编号', field : 'materialcode', sortable : true, halign:'center'},
|
|
{width : '125', title : '已完成/已安排/计划生产数', field : 'planamount',halign:'center',align:'center',formatter:function(value,row){
|
|
var str = row.alactamount + " / " + row.alpreamount + " / " + value;
|
|
return str;
|
|
}},
|
|
/* {width : '140', title : '销售单号', field : 'salesno', sortable : true, align:'center', halign:'center'}, */
|
|
{width : '120', title : '开始日期', field : 'pstdate', sortable : true, align:'center', halign:'center',formatter:function(value,row){
|
|
var str = value.substring(0,10);
|
|
return str;
|
|
}},
|
|
{width : '120', title : '结束日期', field : 'pendate', sortable : true, align:'center', halign:'center',formatter:function(value,row){
|
|
var str = value.substring(0,10);
|
|
return str;
|
|
}},
|
|
{width : '60', title : '单据状态', field : 'billstatus', sortable : true, halign:'center'},
|
|
{width : '30', title : 'BOM编号', field : 'bomno', sortable : true, halign:'center'},
|
|
|
|
] ],
|
|
onResize:function(){
|
|
$('#grid_taskorder').datagrid('fixDetailRowHeight',index);
|
|
},
|
|
onLoadSuccess:function(){
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
|
setTimeout(function(){
|
|
$('#grid_taskorder').datagrid('fixDetailRowHeight',index);
|
|
},0);
|
|
|
|
}
|
|
});
|
|
}
|
|
});
|
|
grid= $('#grid').datagrid({
|
|
title : '',
|
|
url:ext.contextPath + '/plan/dailyplan/getdailyplans.do',
|
|
queryParams: {
|
|
sdt: $("#sdt").val(),
|
|
edt: $("#edt").val(),
|
|
search_status: $('#search_status').combobox('getValue'),
|
|
pid:ddvpid,
|
|
notdisplayinvalid:$('#notdisplayinvalid').val()
|
|
},
|
|
striped : true,
|
|
rownumbers : true,
|
|
pagination : true,
|
|
selectOnCheck: true,
|
|
checkOnSelect: true,
|
|
idField : 'id',
|
|
pageSize : 50,
|
|
pageList : [ 20, 50, 100],
|
|
height:'auto',
|
|
rowStyler: function(index,row){
|
|
var rowstyler='';
|
|
if (row.taskchangedstatus!=null){
|
|
if(row.taskchangedstatus=='true' ||row.taskchangedstatus=='TRUE'){
|
|
rowstyler+= 'font-weight:bold;';
|
|
}
|
|
}
|
|
if(row.status=='${Flag_Delete}'|| row.status=='${Flag_ReEdit}'){
|
|
rowstyler+= ' background-color:#C0C0C0;color:#fff;';
|
|
}else if(row.status=='${Flag_Finish}'){
|
|
rowstyler+= ' font-style:ltalic;';
|
|
}
|
|
return rowstyler;
|
|
},
|
|
columns : [ [
|
|
{checkbox:true , field : 'ck'},
|
|
{width : '150', title : '任务单号', field : 'taskorderno', sortable : true, halign:'center' ,formatter : function(value, row){
|
|
if(row.taskorder!=null){
|
|
return row.taskorder.tasklistcode;
|
|
}else{
|
|
return "";
|
|
}
|
|
|
|
} },
|
|
{width : '180', title : '物料名称', field : 'bomname', sortable : true, halign:'center' , formatter : function(value, row){
|
|
if(row.materialBOM!=null){
|
|
return row.materialBOM.materialname;
|
|
}else{
|
|
return "";
|
|
}
|
|
}},
|
|
{width : '100', title : '销售订单号', field : 'salseno', halign:'center' ,formatter : function(value, row){
|
|
if(row.taskorder!=null){
|
|
return row.taskorder.salesno;
|
|
}else{
|
|
return "";
|
|
}
|
|
|
|
} },
|
|
|
|
{width : '100', title : '工艺路线', field : 'processrealid', halign:'center' ,sortable:false},
|
|
{width : '140', title : '计划编制时间', field : 'insdt',align:'center', formatter : function(value, row){
|
|
if(value.substring(0,4)=="1900"){
|
|
return "";
|
|
}else{
|
|
return value.substring(0,19);
|
|
}
|
|
},sortable:false },
|
|
{width : '100', title : '计划状态', field : 'status', align:'center', formatter : function(value, row){
|
|
var susp="";
|
|
if(row.suspended=='${Flag_Active}'){
|
|
susp= "";
|
|
}else if(row.suspended=='${Flag_Suspend}'){
|
|
susp= "/<font color='red'>已挂起</font>";
|
|
}
|
|
switch(value){
|
|
case '${Flag_Edit}': return "待提交"+susp;
|
|
case '${Flag_Submit}': return "待审核"+susp;
|
|
case '${Flag_Check}': return "待下发"+susp;
|
|
case '${Flag_Issue}': return "已下发"+susp;
|
|
case '${Flag_Delete}': return "已作废"+susp;
|
|
case '${Flag_ReEdit}': return "已重排"+susp;
|
|
case '${Flag_Finish}': return "<font color='blue'>已完成</font>";
|
|
|
|
}
|
|
} ,sortable:false},
|
|
{width : '45', title : '优先级(数字越小优先级越高)', field : 'porder', sortable : false, halign:'center',formatter:function(value, row){
|
|
return value;
|
|
}},
|
|
{title : '操作', field : 'action', width : '140', halign:'center', align:'center', formatter : function(value, row) {
|
|
var str = '';
|
|
str += '<img class="iconImg ext-icon-table" title="查看" onclick="viewFun(\''+row.id+'\');"/> ';
|
|
if(row.status!="${Flag_Submit}" && row.status!='${Flag_Finish}'&& row.status!='${Flag_Delete}'){
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/edit.do")) {%>
|
|
if(row.status=='${Flag_Edit}'){
|
|
str += '<img class="iconImg ext-icon-table_add" title="配置" onclick="distFun(\''+row.id+'\',\''+row.processrealid+'\');"/> ';
|
|
}
|
|
<%}%>
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/edit.do")) {%>
|
|
if(row.status=='${Flag_Edit}'){
|
|
str += '<img class="iconImg ext-icon-table_go" title="提交" onclick="dosubmit(\''+row.id+'\');"/> ';
|
|
}
|
|
<%}%>
|
|
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/edit.do")) {%>
|
|
if(row.status=='${Flag_Edit}'){
|
|
str += '<img class="iconImg ext-icon-table_edit" title="编辑" onclick="editFun(\''+row.id+'\');"/> ';
|
|
}
|
|
<%}%>
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/delete.do")) {%>
|
|
if(row.status=='${Flag_Edit}'){
|
|
str += '<img class="iconImg ext-icon-table_delete" title="删除" onclick="deleteFun(\''+row.id+'\');"/> ';
|
|
}else if(row.suspended=='${Flag_Suspend}'){
|
|
str += '<img class="iconImg ext-icon-table_lightning" title="激活" onclick="suspendFun(\''+row.id+'\',\''+row.suspended+'\');"/> ';
|
|
}else if(row.suspended=='${Flag_Active}'){
|
|
str += '<img class="iconImg ext-icon-table_link" title="挂起" onclick="suspendFun(\''+row.id+'\',\''+row.suspended+'\');"/> ';
|
|
}
|
|
<%}%>
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/edit.do")) {%>
|
|
if(row.status!='${Flag_Edit}'){
|
|
str += '<img class="iconImg ext-icon-bin" title="计划作废" onclick="invalidateFun(\''+row.id+'\');"/> ';
|
|
}
|
|
str += '<img class="iconImg ext-icon-arrow_up" title="计划置顶" onclick="ToTop(\''+row.id+'\');"/> ';
|
|
<%}%>
|
|
}
|
|
return str;
|
|
}
|
|
},
|
|
{width : '80', title : '提示', field : 'remark',align:'center'}
|
|
] ],
|
|
toolbar : '#toolbar',
|
|
onResize:function(){
|
|
},
|
|
onLoadSuccess:function(){
|
|
dailyPlans=$(this).datagrid("getData");
|
|
console.info(dailyPlans);
|
|
//允许拖拽
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
|
$(this).datagrid('enableDnd');
|
|
var rows = $("#grid").datagrid("getRows");
|
|
var ids="";
|
|
for(var i=0;i<rows.length;i++)
|
|
{
|
|
if(ids!=""){
|
|
ids+=",";
|
|
}
|
|
ids+=rows[i].id;
|
|
}
|
|
planAnalysisFun(ids);
|
|
planEquAnalysisFun(ids);
|
|
},
|
|
onStopDrag:function(row){
|
|
var rows = $("#grid").datagrid("getRows");
|
|
var ids="";
|
|
for(var i=0;i<rows.length;i++)
|
|
{
|
|
if(ids!=""){
|
|
ids+=",";
|
|
}
|
|
ids+=rows[i].id;
|
|
}
|
|
$.post(ext.contextPath + '/plan/dailyplan/saveDrag.do', {ids:ids} , function(data) {
|
|
if(data==0){
|
|
return;
|
|
}else if(data>0){
|
|
grid.datagrid('reload');
|
|
}else{
|
|
top.$.messager.alert('提示','操作失败','info');
|
|
}
|
|
});
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
|
}
|
|
});
|
|
$("#taskordercode").textbox('textbox').bind("click", function () {
|
|
selectTaskOrder();
|
|
});
|
|
|
|
});
|
|
//
|
|
var dailyPlans;//存储日计划及其任务量,用于判断未配置日计划任务量情况下,不能提交审核
|
|
//日计划排产统计
|
|
var planAnalysisFun = function(ids) {
|
|
$.post(ext.contextPath + '/plan/dailyplansummary/getTaskDemandsByPlanIds.do', {ids : ids}, function(data) {
|
|
dailyPlans=data.res;
|
|
var columns = new Array();
|
|
var columns1 ={width : '180', title : '物料名称', field : 'bomname', sortable : true, align:'center' , formatter : function(value, row){
|
|
if(row.materialBOM!=null){
|
|
return row.materialBOM.materialname;
|
|
}else{
|
|
return "";
|
|
}
|
|
}};
|
|
columns.push(columns1);
|
|
var columns2={width : '100', title : '销售订单号', field : 'salseno', halign:'center' ,formatter : function(value, row){
|
|
if(row.taskorder!=null){
|
|
return row.taskorder.salesno;
|
|
}else{
|
|
return "";
|
|
}
|
|
|
|
} };
|
|
columns.push(columns2);
|
|
//导入其他分值的循环
|
|
//alert(data.summary)
|
|
var summary= data.summary;
|
|
for (var i = 0; i < summary.length; i++) {
|
|
var column={
|
|
field:summary[i].taskcode,title:summary[i]._taskName,width:100,align:'center', formatter : function(value, row){
|
|
//console.log(row.demands)
|
|
for(var j=0;j<row.demands.length;j++){
|
|
if(row.demands[j].taskcode == this.field)
|
|
return row.demands[j].preamount;
|
|
}
|
|
|
|
}
|
|
}
|
|
columns.push(column);
|
|
}
|
|
//console.log(columns.length)
|
|
$('#grid_procedures').datagrid({
|
|
title: '',
|
|
data: data.res,
|
|
width: '100%',
|
|
rownumbers: true,
|
|
columns: [
|
|
columns
|
|
],
|
|
onLoadSuccess : function(datas) {
|
|
/* var rowstr ="";
|
|
//var col = JSON.parse(columns);
|
|
//console.log("columns:"+columns);
|
|
for(var i=0;i<columns.length;i++){
|
|
if(rowstr !=""){
|
|
rowstr+=",";
|
|
}
|
|
if(i>1){
|
|
rowstr=rowstr+"\""+columns[i].field+"\":"+0+"";//compute(columns[i].field)
|
|
}else{
|
|
rowstr=rowstr+"\""+columns[i].field+"\":\"合计\"";
|
|
}
|
|
|
|
}
|
|
rowstr="{"+rowstr+"}";
|
|
console.log(JSON.parse(rowstr));
|
|
var rows= $('#grid_procedures').datagrid('getData').rows;
|
|
console.log(rows[0]); */
|
|
//$('#grid_procedures').datagrid('appendRow', rowstr);
|
|
|
|
var length= $('#grid_procedures').datagrid('getData').rows.length;
|
|
if(length>0){
|
|
var rowIndex=length-1;
|
|
|
|
$('#grid_procedures').datagrid('mergeCells',{
|
|
index: rowIndex,
|
|
field: 'bomname',
|
|
colspan: 2
|
|
});
|
|
|
|
}
|
|
|
|
//$('.iconImg').attr('src', ext.pixel_0);
|
|
}
|
|
});
|
|
},'json');
|
|
};
|
|
//日计划排产统计
|
|
var planEquAnalysisFun = function(ids) {
|
|
$.post(ext.contextPath + '/plan/dailyplansummary/getWorkTaskEqusByPlanIds.do', {ids : ids}, function(data) {
|
|
var columns = new Array();
|
|
var columns1 ={width : '180', title : '物料名称', field : 'bomname', sortable : true, align:'center' , formatter : function(value, row){
|
|
if(row.materialBOM!=null){
|
|
return row.materialBOM.materialname;
|
|
}else{
|
|
return "";
|
|
}
|
|
}};
|
|
columns.push(columns1);
|
|
var columns2={width : '100', title : '销售订单号', field : 'salseno', halign:'center' ,formatter : function(value, row){
|
|
if(row.taskorder!=null){
|
|
return row.taskorder.salesno;
|
|
}else{
|
|
return "";
|
|
}
|
|
|
|
} };
|
|
columns.push(columns2);
|
|
//导入其他分值的循环
|
|
//alert(data.summary)
|
|
var summary= data.summary;
|
|
for (var i = 0; i < summary.length; i++) {
|
|
var column={
|
|
field:summary[i].taskcode,title:summary[i]._taskName,width:120,align:'center', formatter : function(value, row){
|
|
//console.log(row.demands)
|
|
for(var j=0;j<row.demands.length;j++){
|
|
if(row.demands[j].taskcode == this.field){
|
|
var preamount =row.demands[j].preamount;
|
|
if(preamount==null){
|
|
continue;
|
|
}
|
|
//console.log(preamount)
|
|
//row.remark=preamount;//用于最后一行合并shu
|
|
var items=preamount.split("/");
|
|
if(items.length==2){
|
|
//console.log(items)
|
|
if(parseFloat(items[0])<parseFloat(items[1])){
|
|
return '<span style="color:#F00">'+preamount+'</span>'
|
|
}else{
|
|
return preamount;
|
|
}
|
|
}else{
|
|
return preamount;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
columns.push(column);
|
|
}
|
|
//console.log(data.res.length)
|
|
$('#grid_equs').datagrid({
|
|
title: '',
|
|
rowStyler:function(index,row) {
|
|
if (data.res.length>0 && index > data.res.length-3){
|
|
return 'color:blue;font-weight:bold;';
|
|
}
|
|
},
|
|
data: data.res,
|
|
width: '100%',
|
|
rownumbers: true,
|
|
columns: [
|
|
columns
|
|
],
|
|
onLoadSuccess : function(datas) {
|
|
|
|
var length= $('#grid_equs').datagrid('getData').rows.length;
|
|
if(length>0){
|
|
var rowIndex=length-1;
|
|
|
|
var grid_squs=$('#grid_equs').datagrid('mergeCells',{
|
|
index: rowIndex,
|
|
field: 'bomname',
|
|
colspan: 2
|
|
});
|
|
grid_squs.datagrid('mergeCells',{
|
|
index: rowIndex-1,
|
|
field: 'bomname',
|
|
colspan: 2
|
|
});
|
|
var lastIndex=rowIndex;
|
|
var cols =grid_squs.datagrid('getColumnFields');
|
|
var CurValue="";
|
|
var CurCol="";
|
|
var span=1;
|
|
var demands =grid_squs.datagrid("getRows")[lastIndex].demands;
|
|
for(var i=2;i<cols.length;i++){
|
|
var col=cols[i];
|
|
var desValue="";
|
|
for(var j=0;j<demands.length;j++){
|
|
if(demands[j].taskcode==col){
|
|
desValue=demands[j].preamount;
|
|
break;
|
|
}
|
|
}
|
|
/* console.log(col);
|
|
console.log(desValue); */
|
|
if(CurValue==desValue){
|
|
span++;
|
|
if(i==cols.length-1 && CurValue!=""){
|
|
grid_squs.datagrid('mergeCells',{
|
|
index: lastIndex,
|
|
field: CurCol,
|
|
colspan: span
|
|
});
|
|
}
|
|
}else{
|
|
if(CurValue!=""){
|
|
grid_squs.datagrid('mergeCells',{
|
|
index: lastIndex,
|
|
field: CurCol,
|
|
colspan: span
|
|
});
|
|
}
|
|
CurValue=desValue;
|
|
CurCol=col;
|
|
span=1;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//$('.iconImg').attr('src', ext.pixel_0);
|
|
}
|
|
});
|
|
},'json');
|
|
};
|
|
//指定列求和
|
|
function compute(colName) {
|
|
var rows = $('#grid_procedures').datagrid('getRows');
|
|
var total = 0;
|
|
for (var i = 0; i < rows.length; i++) {
|
|
if(rows[i][colName]!=""){
|
|
total += parseFloat(rows[i][colName]);
|
|
}
|
|
|
|
}
|
|
return total;
|
|
}
|
|
function selectTaskOrder(){
|
|
var dialog = parent.ext.modalDialog({
|
|
title : '选择任务单',
|
|
width: 800,
|
|
height:550,
|
|
url : ext.contextPath + '/plan/taskorder/select.do',
|
|
buttons : [{
|
|
text : '确定',
|
|
iconCls:'icon-ok',
|
|
handler : function() {
|
|
var res=dialog.find('iframe').get(0).contentWindow.selectOK();
|
|
|
|
if(res!=null){
|
|
$("#taskordercode").textbox('setValue',res.tasklistcode);//easyui textbox赋值jquery不一样
|
|
$("#taskorderid").val(res.id);
|
|
}
|
|
dialog.dialog('destroy');
|
|
|
|
}
|
|
},
|
|
{
|
|
text : '取消',
|
|
iconCls:'icon-cancel',
|
|
handler : function() {
|
|
dialog.dialog('destroy');
|
|
|
|
}
|
|
}
|
|
]
|
|
});
|
|
}
|
|
//计划作废
|
|
var invalidateFun = function(id) {
|
|
parent.$.messager.confirm('提示', '您确定要此记录作废?计划作废后将无法撤销。', function(r) {
|
|
if (r) {
|
|
$.post(ext.contextPath + '/plan/dailyplan/invalidate.do', {id : id}, function(data) {
|
|
if(data==1){
|
|
top.$.messager.alert('提示','作废成功','info');
|
|
grid.datagrid('reload');
|
|
}else{
|
|
top.$.messager.alert('提示','作废失败','info');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
var invalidateday = function() {
|
|
parent.$.messager.confirm('提示', '您确定要作废全天计划?计划作废后将无法撤销。', function(r) {
|
|
if (r) {
|
|
var id='${dailyplansummary.id }';
|
|
$.post(ext.contextPath + '/plan/dailyplansummary/invalidateday.do', {id : id}, function(data) {
|
|
if(data==1){
|
|
top.$.messager.alert('提示','作废成功','info');
|
|
parent.$("#viewDialog").dialog('destroy');
|
|
}else{
|
|
top.$.messager.alert('提示','作废失败','info');
|
|
}
|
|
});
|
|
|
|
}
|
|
});
|
|
};
|
|
var distributeday = function() {
|
|
parent.$.messager.confirm('提示', '您确定要下发全天计划?', function(r) {
|
|
if (r) {
|
|
var id='${dailyplansummary.id }';
|
|
$.post(ext.contextPath + '/plan/dailyplansummary/distributeday.do', {id : id}, function(data) {
|
|
if(data.res=='1'){
|
|
top.$.messager.alert('提示','下发成功','info');
|
|
grid.datagrid('reload');
|
|
}else if(data.res=='0'){
|
|
top.$.messager.alert('提示','无可下发计划','info');
|
|
}else{
|
|
top.$.messager.alert('提示',data.res,'info');
|
|
}
|
|
},'json');
|
|
|
|
}
|
|
});
|
|
};
|
|
var submitday = function() {
|
|
parent.$.messager.confirm('提示', '您确定要提交全天待提交计划?', function(r) {
|
|
if (r) {
|
|
var id='${dailyplansummary.id }';
|
|
$.post(ext.contextPath + '/plan/dailyplansummary/submitday.do', {id : id}, function(data) {
|
|
if(data.res!='0'){
|
|
top.$.messager.alert('提示','成功提交'+data.res+'条记录','info');
|
|
$('#addtd').hide();
|
|
grid.datagrid('reload');
|
|
}else{
|
|
top.$.messager.alert('提示','无可提交计划','info');
|
|
}
|
|
},'json');
|
|
|
|
}
|
|
});
|
|
};
|
|
|
|
function reset(){
|
|
$('#searchForm').form('clear');
|
|
ddvpid='${dailyplansummary.id }';
|
|
grid.datagrid('load',{pid:'${dailyplansummary.id }'});
|
|
$('#sdt').val('${wsdt}');
|
|
$('#edt').val('${wedt}');
|
|
notallowDnd();
|
|
}
|
|
function allowDnd(){
|
|
grid.datagrid('enableDnd');
|
|
var nad =document.getElementById("notallowDndbtn");
|
|
var ad =document.getElementById("allowDndbtn");
|
|
nad.style.display="";
|
|
ad.style.display="none";
|
|
showTips('列表拖拽已启用', 1);
|
|
//grid.datagrid('reload');
|
|
}
|
|
function notallowDnd(){
|
|
grid.datagrid('reload');
|
|
var nad =document.getElementById("notallowDndbtn");
|
|
var ad =document.getElementById("allowDndbtn");
|
|
ad.style.display="";
|
|
nad.style.display="none";
|
|
//showTips('列表拖拽已禁用', 1);
|
|
}
|
|
function ToTop(id){
|
|
var rows = $("#grid").datagrid("getRows");
|
|
var ids=id;
|
|
for(var i=0;i<rows.length;i++)
|
|
{
|
|
if(rows[i].id!=id){
|
|
ids+=","+rows[i].id;
|
|
}
|
|
|
|
}
|
|
$.post(ext.contextPath + '/plan/dailyplan/saveDrag.do', {ids:ids} , function(data) {
|
|
if(data==0){
|
|
return;
|
|
}else if(data>0){
|
|
grid.datagrid('reload');
|
|
}else{
|
|
top.$.messager.alert('提示','操作失败','info');
|
|
}
|
|
});
|
|
}
|
|
$(function(){
|
|
$("#taskOrderStatistics").attr("src",ext.contextPath+"/plan/taskorder/viewTaskOrderDayPlanAmount.do?displaymodel=" + "DP");
|
|
$('#mm').switchbutton({
|
|
onChange: function(checked){
|
|
if(checked==true){
|
|
$('#notdisplayinvalid').val("1");
|
|
}else{
|
|
$('#notdisplayinvalid').val("");
|
|
}
|
|
//alert($('#mm').switchbutton('options').checked);
|
|
$('#pid').val('${dailyplansummary.id }');
|
|
grid.datagrid('load',ext.serializeObject($('#searchForm')));//搜索
|
|
}
|
|
});
|
|
if('${addpermit}'=='1'||'${dailyplansummary.insertpid}'!=null||'${dailyplansummary.insertpid}'!=''){
|
|
$('#addtd').show();
|
|
}else{
|
|
$('#addtd').hide();
|
|
}
|
|
if('${dailyplansummary.insertpid}'!=null||'${dailyplansummary.insertpid}'!=''){
|
|
$('#addoldtd').show();
|
|
}else{
|
|
$('#addoldtd').hide();
|
|
}
|
|
});
|
|
var importcsv = function() {
|
|
var dialog = parent.ext.modalDialog({
|
|
title : '选择文件',
|
|
width: 600,
|
|
height:300,
|
|
closeOnEscape:true,
|
|
url : ext.contextPath + '/plan/dailyplan/doimportcsv.do',
|
|
buttons : [ {
|
|
text : '导入数据',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.doimport(dialog, grid);
|
|
}
|
|
} ]
|
|
});
|
|
|
|
|
|
};
|
|
</script>
|
|
</head>
|
|
<body >
|
|
<div id="cc" class="easyui-layout" data-options="fit:true,border:false">
|
|
<div class="easyui-tabs" data-options="region:'north',title:'统计信息',split:false,border:false" style="height:50%;width:100%">
|
|
<div title="当日计划量统计" data-options="fit:true">
|
|
<table id="grid_procedures" data-options="fit:true,border:false"></table>
|
|
</div>
|
|
<div title="当日设备统计" data-options="fit:true">
|
|
<table id="grid_equs" data-options="fit:true,border:false"></table>
|
|
</div>
|
|
<div title="任务单信息" data-options="fit:true">
|
|
<table id="grid_taskorder" data-options="fit:true,border:false"></table>
|
|
</div>
|
|
<div title="任务单信息一览" data-options="fit:true">
|
|
<iframe id="taskOrderStatistics" src="" allowTransparency="true" style="border: 0; width: 100%; height: 100%;"
|
|
frameBorder="0" scrolling="auto"></iframe>
|
|
</div>
|
|
|
|
</div>
|
|
<div data-options="region:'center',title:'日计划(${dt})'" style="padding:0px;height:50%;width:100%">
|
|
<div class="easyui-layout" data-options="fit:true,border:false">
|
|
<div id="toolbar" style="display: none;">
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
<table>
|
|
<tr>
|
|
<c:if test="${param.olddayflag!=1}">
|
|
<%-- <%if (sessionManager.havePermission(session,"plan/dailyplan/add.do")) {%> --%>
|
|
<security:authorize buttonUrl="plan/dailyplan/add.do">
|
|
<td id="addtd" name="addtd">
|
|
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true"
|
|
onclick="addFun('');">添加</a>
|
|
</td>
|
|
</security:authorize>
|
|
<%-- <%}%> --%>
|
|
</c:if>
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/delete.do")) {%>
|
|
<td>
|
|
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true"
|
|
onclick="deletesFun();">删除</a>
|
|
</td>
|
|
<%}%>
|
|
<%if (sessionManager.havePermission(session,"plan/dailyplan/edit.do")) {%>
|
|
<td id="edittd" name="edittd" >
|
|
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_go',plain:true" onclick="dosubmits();">提交</a>
|
|
</td>
|
|
<%}%>
|
|
<!-- <td><a id="allowDndbtn" href="javascript:void(0);"
|
|
class="easyui-linkbutton"
|
|
data-options="iconCls:'ext-icon-control_play_blue',plain:true"
|
|
onclick="allowDnd();">启用拖拽</a><a id="notallowDndbtn" href="javascript:void(0);"
|
|
class="easyui-linkbutton"
|
|
data-options="iconCls:'ext-icon-control_stop_blue',plain:true"
|
|
onclick="notallowDnd();" style="display:none">禁用拖拽</a></td> -->
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<form id="searchForm">
|
|
<input id="pid" name="pid" type="hidden" value="${dailyplansummary.id }" />
|
|
<table>
|
|
<tr>
|
|
<td>任务单号</td>
|
|
<td><input id="taskordercode" name="taskordercode" class="easyui-textbox" style="width: 150px;" data-options="validType:'isBlank',prompt:'单击选择'" value=""/>
|
|
<input id="taskorderid" name="taskorderid" type="hidden" value="" /></td>
|
|
<td >计划状态</td>
|
|
<td colspan='4'><select id="search_status" name="search_status" class="easyui-combobox" style="width:152px;">
|
|
<option value='all' select>全部</option>
|
|
<option value='edit'>待提交</option>
|
|
<option value='submit'>待审核</option>
|
|
<option value='audited'>待下发</option>
|
|
<option value='inprogress'>已下发</option>
|
|
<option value='completed'>已完成</option>
|
|
<option value='rearrenged'>已重排</option>
|
|
<option value='invalid'>已作废</option>
|
|
</select>
|
|
</td>
|
|
<!-- </tr> -->
|
|
<!-- <tr> -->
|
|
<!-- <td>计划下达日期</td> -->
|
|
<td><input id="sdt" name="sdt" class="Wdate" type="hidden"
|
|
value="${wsdt}"
|
|
onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'edt\')}'})"
|
|
readonly></td>
|
|
<!-- <td>到</td> -->
|
|
<td><input id="edt" name="edt" class="Wdate" type="hidden"
|
|
value="${wedt}"
|
|
onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'sdt\')}'})"
|
|
readonly></td>
|
|
<td>隐藏作废/重排计划 <input id="mm"
|
|
class="easyui-switchbutton" style="height:22px;width:50px;"
|
|
data-options="onText:'是',offText:'否'" unchecked></td>
|
|
<input id="notdisplayinvalid" name="notdisplayinvalid" type="hidden"
|
|
value="" />
|
|
<td><a href="javascript:void(0);" class="easyui-linkbutton"
|
|
data-options="iconCls:'ext-icon-search',plain:true"
|
|
onclick="$('#pid').val('${dailyplansummary.id }');grid.datagrid('load',ext.serializeObject($('#searchForm')));notallowDnd();">搜索</a>
|
|
<a href="javascript:void(0);" class="easyui-linkbutton"
|
|
data-options="iconCls:'icon-reload',plain:true"
|
|
onclick="reset();">重置</a>
|
|
<!-- <a href="javascript:void(0);" class="easyui-linkbutton" -->
|
|
<!-- data-options="iconCls:'ext-icon-search',plain:true" -->
|
|
<!-- onclick="$('#searchForm').form('clear');ddvpid='';grid.datagrid('load',{});">全部计划</a> -->
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div data-options="region:'center',fit:true,border:false">
|
|
<table id="grid" data-options="fit:true,border:false"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
|