ProductionReport.cshtml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. @using ShwasherSys
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Views.Shared.New.Modals
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @{
  7. ViewBag.Title = "车间生产统计";
  8. string activeMenu = PermissionNames.PagesStatisticMgProductionReportMg; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. }
  11. @section css{
  12. <link href="~/Content/Css/statistic.css" rel="stylesheet" />
  13. <style>
  14. #table1 th.td:not(.index) {
  15. min-width: 120px;
  16. max-width: 300px;
  17. }
  18. </style>
  19. }
  20. <div class="box-tool">
  21. <div class="tool-form">
  22. <form id="tool-form">
  23. <div style="float: left">
  24. <select id="year" name="year" class="form-control" autocomplete="off" style="width: 120px;">
  25. <option value="">请选择年份</option>
  26. @for (int i = DateTime.Now.Year; i >= 2019; i--)
  27. {
  28. <option value="@(i)">@(i)年</option>
  29. }
  30. </select>
  31. <select id="month" name="month" class="form-control" autocomplete="off" style="width: 180px;">
  32. <option value="">请选择月份/季度/年度</option>
  33. <optgroup label="月份">
  34. @for (int j = 1; j <= 12; j++)
  35. {
  36. <option value="@(j)">@(j)月</option>
  37. }
  38. </optgroup>
  39. <optgroup label="季度">
  40. @for (int j = 1; j <= 4; j++)
  41. {
  42. <option value="@(j+12)">第 @(j) 季度</option>
  43. }
  44. </optgroup>
  45. <optgroup label="年度">
  46. <option value="19">整年度</option>
  47. <option value="17">上半年</option>
  48. <option value="18">下半年</option>
  49. </optgroup>
  50. </select>
  51. @*<input id="query-date1" class="form-control iwb-date" type="text" value="" placeholder="请输入查询开始日期..." style="width: 250px;"/>
  52. <input id="query-date2" class="form-control iwb-date" type="text" value="" placeholder="请输入查询结束日期..." style="width: 250px;"/>*@
  53. </div>
  54. <div style="width: 250px; float: left;margin-left: 10px;">
  55. <div class="input-group form-group-sm " style="width: 100%;">
  56. <input id="employeeId" name="employeeId" class="form-control" type="hidden" autocomplete="off" placeholder="" style="width: 250px;"/>
  57. <input class="form-control" id="query-man" name="query-man" type="text" autocomplete="off" required="" placeholder="请输入查询员工..." readonly="">
  58. <div class="input-group-addon" onclick="ShowQueryModal('query_employee_modal', '.tool-form');">
  59. <i class="iconfont icon-search"></i>
  60. </div>
  61. <div class="input-group-addon" title="清除员工信息" onclick="ClearQueryValue(this);">
  62. <i class="iconfont icon-close"></i>
  63. </div>
  64. </div>
  65. </div>
  66. </form>
  67. </div>
  68. <div class="tool-btn">
  69. @if (IsGranted(PermissionNames.PagesStatisticMgProductionReportMgQuery))
  70. {
  71. <button class="btn btn-info btn-sm" onclick="Query()">查询</button>
  72. }
  73. @* <button class="btn btn-success btn-sm" onclick="Export()">导出</button>*@
  74. </div>
  75. </div>
  76. <div class="box-data">
  77. <div class="box-body">
  78. <table id="table1" style="display: none">
  79. <thead>
  80. <tr class="title">
  81. <td class="td" colspan="20">上海上垫垫圈有限公司车间生产统计表</td>
  82. </tr>
  83. <tr class="title-sm">
  84. <th class="td department" colspan="3">部门:生产车间</th>
  85. <th class="td date" colspan="3">日期:<span class="date">2020-01-20</span></th>
  86. </tr>
  87. <tr>
  88. <th class="td index">序号</th>
  89. <th class="td">工号</th>
  90. <th class="td">姓名</th>
  91. <th class="td">重量(kg)</th>
  92. <th class="td">千件</th>
  93. <th class="td">日期</th>
  94. </tr>
  95. </thead>
  96. <tbody class="tbody"></tbody>
  97. <tfoot>
  98. <tr>
  99. <td class="td" colspan="1"></td>
  100. <td class="td detail" colspan="2">
  101. 总重量:<strong class="kg"></strong> kg
  102. </td>
  103. <td class="td detail" colspan="2">
  104. 总件数: <strong class="pcs"></strong> 千件
  105. </td>
  106. <td class="td" colspan="1"></td>
  107. @*<th class="td" colspan="1">本月总计</th>
  108. <td class="td detail" colspan="3">
  109. <p>总重量:<strong id="kg">44</strong> kg</p>
  110. <p>总件数:<strong id="pcs">55</strong> 千件</p>
  111. </td>*@
  112. </tr>
  113. </tfoot>
  114. </table>
  115. <table id="table2" style="display: none">
  116. <thead>
  117. <tr class="title">
  118. <td class="td" colspan="20">上海上垫垫圈有限公司车间生产统计表</td>
  119. </tr>
  120. <tr class="title-sm">
  121. <th class="td department" colspan="4">部门:生产车间</th>
  122. <th class="td" colspan="2" style="border-left:none">工号:<span class="eNo"></span></th>
  123. <th class="td" colspan="2" style="border-left:none">姓名:<span class="eName"></span></th>
  124. <th class="td date" colspan="3">日期:<span class="date">2020-01-20</span></th>
  125. </tr>
  126. <tr>
  127. <th class="td index">序号</th>
  128. <th class="td">流转单号</th>
  129. <th class="td">重量(kg)</th>
  130. <th class="td">千件</th>
  131. <th class="td">千件重</th>
  132. <th class="td">日期</th>
  133. <th class="td">半成品名称</th>
  134. <th class="td">零件号</th>
  135. <th class="td">规格</th>
  136. <th class="td">材质</th>
  137. <th class="td">表色</th>
  138. </tr>
  139. </thead>
  140. <tbody class="tbody"></tbody>
  141. <tfoot>
  142. <tr>
  143. <td class="td" colspan="1"></td>
  144. <td class="td detail" colspan="3">
  145. 总重量:<strong class="kg"></strong> kg
  146. </td>
  147. <td class="td detail" colspan="3">
  148. 总件数: <strong class="pcs"></strong> 千件
  149. </td>
  150. <td class="td" colspan="5"></td>
  151. @*<th class="td" colspan="1">本月总计</th>
  152. <td class="td detail" colspan="3">
  153. <p>总重量:<strong id="kg">44</strong> kg</p>
  154. <p>总件数:<strong id="pcs">55</strong> 千件</p>
  155. </td>*@
  156. </tr>
  157. </tfoot>
  158. </table>
  159. </div>
  160. </div>
  161. @section modal{
  162. @Html.Partial("Modals/Query/_Employee", "1:query-man,employeeId")
  163. }
  164. @section scripts
  165. {
  166. <script type="text/javascript">
  167. var $table = $('#table');
  168. $(function () {
  169. $('#year').val(@(DateTime.Now.Year)).select2();
  170. $('#month').val(@(DateTime.Now.Month)).select2();
  171. Query();
  172. });
  173. function Query() {
  174. var date = $('#year').val();
  175. if (date) {
  176. $.iwbAjax4({
  177. url: window.appUrl + 'ProductionOrders/QueryProductionReport' ,
  178. form:'tool-form',
  179. success: function (res) {
  180. $table = $('#employeeId').val() ? $('#table2') : $('#table1');
  181. var $table2 = $('#employeeId').val() ? $('#table1') : $('#table2');
  182. $table.find('.date').html(res.dayDate || "");
  183. $table.find('.eNo').html(res.employeeNo || "");
  184. $table.find('.eName').html(res.employeeName || "");
  185. $table.find('.kg').html(res.kgTotal || "");
  186. $table.find('.pcs').html(res.pcsTotal || "");
  187. if (res) {
  188. var str = ItemFormatter(res.items);
  189. $table.find('.tbody').html(str);
  190. $table.fadeIn();
  191. $table2.hide();
  192. } else {
  193. $table.hide();
  194. $table2.hide();
  195. abp.message.warn("未查询到数据。");
  196. }
  197. }
  198. });
  199. } else {
  200. abp.message.warn("请选择年份。");
  201. }
  202. }
  203. function ItemFormatter(data) {
  204. var str = "";
  205. if (data && data.length > 0) {
  206. for (var i = 0; i < data.length; i++) {
  207. var item = data[i];
  208. str += '<tr>';
  209. str += '<td class="td">{0}</td>'.format(i+1);
  210. if ($('#employeeId').val()) {
  211. str += '<td class="td">{0}</td>'.format(item.productionOrderNo || "");
  212. str += '<td class="td">{0}</td>'.format(item.kgQuantity || "");
  213. str += '<td class="td">{0}</td>'.format(item.pcsQuantity || "");
  214. str += '<td class="td">{0}</td>'.format(item.kgWeight || "");
  215. str += '<td class="td">{0}</td>'.format(new Date(item.productDate).format('yyyy-MM-dd'));
  216. str += '<td class="td">{0}</td>'.format(item.productName || "");
  217. str += '<td class="td">{0}</td>'.format(item.partNo || "");
  218. str += '<td class="td">{0}</td>'.format(item.model || "");
  219. str += '<td class="td">{0}</td>'.format(item.material || "");
  220. str += '<td class="td">{0}</td>'.format(item.surfaceColor || "");
  221. }else
  222. {
  223. str += '<td class="td">{0}</td>'.format(item.employeeNo || "");
  224. str += '<td class="td">{0}</td>'.format(item.employeeName || "");
  225. str += '<td class="td">{0}</td>'.format(item.kgQuantity || "");
  226. str += '<td class="td">{0}</td>'.format(item.pcsQuantity || "");
  227. str += '<td class="td">{0}</td>'.format(new Date(item.productDate).format('yyyy-MM-dd'));
  228. }
  229. str += '</tr>';
  230. }
  231. } else {
  232. str += '<tr>';
  233. str += '<td class="td" colspan="20" style="color:red;padding:10px;">未查询到生产明细</td>';
  234. str += '</tr>';
  235. }
  236. return str;
  237. }
  238. function Export() {
  239. }
  240. function ClearQueryValue(that) {
  241. var $that = $(that).closest('.input-group');
  242. $that.find('input').val("");
  243. }
  244. </script>
  245. }
  246. <section style="display: none">
  247. <select id="hid-type">
  248. <option value=""></option>
  249. </select>
  250. @*@Html.DropDownList("hid-type", type)*@
  251. </section>