/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/production/production_status.aspx
310 строк
9 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="production_status.aspx.vb" Inherits="production_status" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Production status</title> <script src="../Scripts/jquery-1.9.1.min.js"></script> <script src="../Scripts/bootstrap.js"></script> <script src="../Scripts/popover.js"></script> <style> #blink { -webkit-animation: blink 2s linear infinite; animation: blink 2s linear infinite; } @-webkit-keyframes blink { 50% { color: rgb(255, 0, 0); } } @keyframes blink { 50% { color: rgb(255, 0, 0); } } @font-face { font-family: "Agency FB"; src: url('../fonts/AGENCYB.TTF'); } html, body, form { width: 100%; height: 100%; background-color: transparent; font-family: 'Agency FB', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 18pt !important; margin: 0; } table { width: 100%; height: 100%; text-align : center; } #report td { height: 7%; font-size: 20pt; } .remark { font-size: 20pt !important; } .time { font-size: 40pt !important; } th{ background-color: steelblue; color: white; font-size: 26pt; } .footer td{ background-color: steelblue; color: white; font-size: 26pt; } caption { color: White; font-weight: bold; background-color: DarkGray; } </style> </head> <body> <form id="form1" runat="server"> <div> <%-- FITST TABLE ------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------- --%> <asp:GridView ID="report" runat="server" CellPadding="4" ForeColor="#333333" Style="margin: 0 auto;" AutoGenerateColumns="True" HorizontalAlign="Center" EditIndex="-1"> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#2461BF" /> <EmptyDataRowStyle BackColor="Red" /> <FooterStyle BackColor="#229EE5" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#229EE5" Font-Bold="True" ForeColor="White" /> <PagerSettings Mode="NumericFirstLast" PageButtonCount="5" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center" VerticalAlign="Middle" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F5F7FB" /> <SortedAscendingHeaderStyle BackColor="#6D95E1" /> <SortedDescendingCellStyle BackColor="#E9EBEF" /> <SortedDescendingHeaderStyle BackColor="#4870BE" /> </asp:GridView> <asp:SqlDataSource ID="sdsPlanStatus" runat="server" ConnectionString="<%$ ConnectionStrings:CATVConnectionString %>" SelectCommand=" declare @sql as nvarchar(max) declare @lines as nvarchar(max) declare @lines_r as nvarchar(max) declare @lines_t as nvarchar(max) set @lines = ( SELECT QUOTENAME(line) + ',' from UserModules.[user].CATV_LINE_LIST where ACTIVE = 'Y' order by line FOR XML PATH('') ) SET @lines = SUBSTRING(@lines,0,LEN(@lines)) set @lines_R = ( SELECT QUOTENAME(line+'_') + ',' from UserModules.[user].CATV_LINE_LIST where ACTIVE = 'Y' order by line FOR XML PATH('') ) SET @lines_r = SUBSTRING(@lines_r,0,LEN(@lines_r)) set @lines_t = ( SELECT 'max(' + QUOTENAME(line) +') AS' + QUOTENAME(line) + ',' +'max(' + QUOTENAME(line+'_') +') AS '+QUOTENAME(line+'_remark') + ',' from UserModules.[user].CATV_LINE_LIST where ACTIVE = 'Y' order by line FOR XML PATH('') ) SET @lines_t = SUBSTRING(@lines_t,0,LEN(@lines_t)) set @sql = ' declare @start int declare @finish int declare @i int declare @interval int declare @shift table ([hour] time(0)) declare @history_cashe table (line nvarchar(10), dif nvarchar(10), updated datetime) set @interval = 30 SELECT @start = substring (min ([plan start]),1,2) ,@finish = substring(max([plan end]),1,2) + 1 FROM [CATV].[dbo].[TB_CATV_MAIN_LINE_DETAILS] where [line] <> ''W'' set @i = 0 while @i <=(@finish - @start) * 60 / @interval begin insert into @shift values( dateadd(minute, @i*@interval, cast(cast(@start as varchar)+'':00:00'' as time(0))) ) set @i = @i + 1 end insert into @history_cashe select line, dif, updated as time_mark from catv.dbo.TB_COM_MAIN_LINE_H where datepart(year, updated) = datepart(year, getdate()) and datepart(MONTH, updated) = datepart(month, getdate()) and datepart(DAY, updated) = datepart(day, getdate()) and [LINE] in (''M01'', ''M02'', ''M03'', ''M04'', ''W'') select timemark, '+ @lines_t +' from ( select t2.line as LINE ,t2.line +''_'' as LINE_R ,remark.REMARK as remark ,dif as DIF ,ca2.[hour] as TimeMark ,updated from @history_cashe t2 cross apply ( select * from ( select [hour], time_mark, line from ( select [hour] from @shift ) t1 cross apply ( select min(updated) as time_mark ,line from @history_cashe where cast(updated as time(0))>= t1.hour group by line ) ca ) inner_ca where inner_ca.time_mark = t2.updated and inner_ca.line = t2.line )ca2 left join [UserModules].[user].[PRODUCTION_STATUS_776] remark on remark.[line] collate Cyrillic_General_CI_AS = t2.line collate Cyrillic_General_CI_AS and cast(ca2.[hour] as time(0))= cast(remark.[TIME] as time(0)) and cast(ca2.time_mark as date) = cast(remark.[DATE] as date) ) final pivot (max(dif) FOR line in ('+@lines+')) as pvt pivot (max(remark) for line_r in ('+@lines_r+')) as pvt1 group by timemark ' exec(@sql) "></asp:SqlDataSource> </div> <script type="text/javascript"> var text = ''; var cell; $(".remark").dblclick(function () { bindEditEvent($(this)); }); function bindEditEvent(c) { if (cell != null) { cancelEdit(cell) } cell = c; text = c.text(); var mode = ''; if (!$.trim(c.text())) { mode = "insert"; } else { mode = "update"; } c.html("<input type=\"search\" name=\"foo\" type=\"text\" id=\"foo\" value=\"" + c.text() + "\">" + "<br><img id='saveChanges' src='../images/buttons/set2/save.png' class='buttonImage icon_small' />" + " <img id='cancelChanges' src='../images/buttons/set2/no.png' class='buttonImage icon_small' />"); $("#saveChanges").click(function (e) { SaveData(mode, c.attr("id"));}); $("#cancelChanges").bind("click", function (e) { cancelEdit(c);}); $("#foo").focus(); bindSubmit("#foo", mode, c.attr("id")); }; function SaveData(mode, id) { //alert(mode); var request = $.ajax({ url: ("../handlers/Production_status.ashx"), data: { mode: mode, value: $("#foo").val(), id: id } }); request.done(SaveDataSuccess); request.fail(SaveDataFail); }; function SaveDataSuccess(result) { if (result == 'ok') { document.location.reload(); } else alert("Data procession failed"); }; function SaveDataFail(result) { alert("Data procession failed"); cell = null; }; function cancelEdit(c) { c.html(text); c = null; var timer = $find('Timer1'); timer._startTimer(); }; function bindSubmit(controlName, mode, id) { $(controlName).bind('keydown', function (e) { if ((e.which == 13) && (e.shiftKey == false)) { e.preventDefault(); SaveData(mode, id); return false; } else { var timer = $find('Timer1'); timer._stopTimer(); } }); }; </script> <asp:Timer ID="Timer1" runat="server" Interval="60000"> </asp:Timer> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </form> </body> </html>