OrderPrint.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. @using IwbZero.Setting
  2. @using NPOI.SS.Formula.Functions
  3. @using ShwasherSys
  4. @using ShwasherSys.CustomerInfo
  5. @using ShwasherSys.Order
  6. @using ShwasherSys.Order.Dto
  7. @using ShwasherSys.OrderSendInfo
  8. @using ShwasherSys.OrderSendInfo.Dto
  9. @{
  10. Layout = null;
  11. ViewBag.Title = "OrderPrint";
  12. OrderHeaderDto orderHeader = ViewBag.OrderHeadDto;
  13. Customer customer = ViewBag.Customer;
  14. CustomerSend customerSend = ViewBag.CustomerSend;
  15. List<ViewOrderItems> orderItems = ViewBag.OrderItems;
  16. var tddate = orderHeader.OrderDate.ToString("yyyy-MM-dd");
  17. }
  18. <html>
  19. <head>
  20. <title>订单打印</title>
  21. <link href="~/Content/Css/PrintPage.css" rel="stylesheet" media="all" />
  22. <link href="~/Content/Plugins/PrintPreView/print-preview.css" rel="stylesheet" />
  23. @*<link href="~/Content/Plugins/jquery-print-preview/src/css/print-preview.css" rel="stylesheet" media="screen" />
  24. <script src="https://cdn.bootcss.com/jquery-tools/1.2.7/jquery.tools.min.js"></script>
  25. <script src="~/Content/Plugins/jquery-print-preview/src/jquery.print-preview.js"></script>*@
  26. @*<script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>*@
  27. <style>
  28. </style>
  29. </head>
  30. <body>
  31. <header style="height: 40px;">
  32. <div style="position: absolute;left: calc(50% - 100px)">
  33. <input type="button" value="打印" class="btn" id="printBtn" />
  34. @*<input type="button" value="导入Excel" class="btn" onclick="ExportExcel('printContent','订单明细','exportCss')" />*@
  35. <input type="button" value="导入Excel" class="btn" id="exportBtn" />
  36. </div>
  37. <hr class="hr01" />
  38. </header>
  39. <div id="printContent">
  40. <table id="OrderDetailTBL0" border="0" align="center" cellpadding="1" cellspacing="1" style="width:900px; height:91px; border-collapse:collapse;" runat="server">
  41. <tr>
  42. <td colspan="12" style="text-align: center; height:30px;font-size:large;font-weight:bold;">分&nbsp;配&nbsp;单</td>
  43. </tr>
  44. <tr>
  45. <td id="tdCustomerId" colspan="12" style="text-align: center; height: 30px;font-size:large;font-weight:bold;"> @customer.CustomerName</td>
  46. </tr>
  47. <tr>
  48. <td colspan="2" style="height: 20px; width: 50px;">
  49. <div style="text-align: center"> <strong>流水号</strong>:</div>
  50. </td>
  51. <td colspan="3" style="height: 20px; width: 300px;">@orderHeader.Id</td>
  52. <td style="width: 50px ; height: 20px;" colspan="2">
  53. <div style="text-align: center"> <strong>订单号</strong>:</div>
  54. </td>
  55. <td style="width: auto; height: 20px;" colspan="5" id="TextStockNo">@orderHeader.StockNo</td>
  56. </tr>
  57. <tr>
  58. <td colspan="2" style="width: 50px ;height: 20px;"><div style="text-align: center"> <strong>送货地址</strong>:</div></td>
  59. <td colspan="10" style="height: 20px; width: auto;" id="tdSendAddr">@customerSend.SendAdress</td>
  60. </tr>
  61. <tr>
  62. <td colspan="2" style="width: 50px;height: 20px;">
  63. <div style="text-align: center"> <strong>联系人</strong>:</div>
  64. </td>
  65. <td id="tdLinkName" colspan="3" style="height: 20px; width: 300px;">@orderHeader.LinkName</td>
  66. <td style="width:50px ; height: 20px;" colspan="2">
  67. <div style="text-align: center"> <strong>电话</strong>:</div>
  68. </td>
  69. <td style="width: auto ; height: 20px;" colspan="5" id="TextTel">@orderHeader.Telephone</td>
  70. </tr>
  71. <tr>
  72. <td style="width:500px ; height: 28px;" colspan="5"></td>
  73. <td style="width: 100px ; height: 17px;" colspan="2">
  74. <div style="text-align: center"><strong> 订单日期</strong>:</div>
  75. </td>
  76. <td style="width: auto ; height: 17px;" id="tdOrderDate" colspan="5">@tddate</td>
  77. </tr>
  78. <tr>
  79. <td colspan="14">
  80. <table id="OrderDetailTBL" class="table-body" style="width: 1000px; height: 38px; border-collapse:collapse; table-layout: auto;" >
  81. <tr style="height:18px;">
  82. <td align="center" style="width:3%;">
  83. <strong>序号</strong>
  84. </td>
  85. <td align="center" style="width:8%;">
  86. <strong>零件号</strong>
  87. </td>
  88. <td align="center" style="width:8%; ">
  89. <strong>规格</strong>
  90. </td>
  91. <td align="center" style="width:8%">
  92. <strong>型号</strong>
  93. </td>
  94. <td align="center" style="width:8%; ">
  95. <strong>表色</strong>
  96. </td>
  97. <td align="center" style="width:8%; ">
  98. <strong>材质</strong>
  99. </td>
  100. <td align="center" style="width:8%;">
  101. <strong>硬度</strong>
  102. </td>
  103. <td align="center" style="width:4%;">
  104. <strong>数量</strong>
  105. </td>
  106. <td align="center" style="width:4%; ">
  107. <strong>单位</strong>
  108. </td>
  109. <td align="center" style="width:8% ">
  110. <strong>送货日期</strong>
  111. </td>
  112. <td align="center" style="width:10%">
  113. <strong>备注</strong>
  114. </td>
  115. <td align="center" style="width:12%">
  116. <strong>成品编号</strong>
  117. </td>
  118. <td align="center" style="width:6%">
  119. <strong>行号</strong>
  120. </td>
  121. <td align="center" style="width:6%">
  122. <strong>紧急程度</strong>
  123. </td>
  124. </tr>
  125. @{
  126. int index = 1;
  127. foreach (var item in orderItems)
  128. {
  129. string orderSendDate = item.SendDate ==new DateTime(1900,1,1) ? "" : string.Format("{0:d}", item.SendDate);
  130. string emergencyLevelStr = item.EmergencyLevel == OrderItemEmergencyLevel.Normal ? "正常" : item.EmergencyLevel == OrderItemEmergencyLevel.Urge ? "紧急" : "延期";
  131. <tr class="trColor">
  132. <td align="center">@index</td>
  133. <td align="center">@item.PartNo</td>
  134. <td align="center">@item.Model</td>
  135. <td align="center">@item.ProductName</td>
  136. <td align="center">@item.SurfaceColor</td>
  137. <td align="center">@item.Material</td>
  138. <td align="center">@item.Rigidity</td>
  139. <td align="center">@item.Quantity</td>
  140. <td align="center">@item.OrderUnitName</td>
  141. <td align="center">@orderSendDate</td>
  142. <td align="center">@item.OrderItemDesc</td>
  143. <td align="center">@item.ProductNo</td>
  144. <td align="center">@item.CustomerRowNo</td>
  145. <td align="center">@emergencyLevelStr</td>
  146. </tr>
  147. index++;
  148. }
  149. }
  150. </table>
  151. </td>
  152. </tr>
  153. </table>
  154. </div>
  155. <div id="exportCss">
  156. <style>
  157. #OrderDetailTBL tr td{
  158. border: 1pt solid gray;
  159. }
  160. </style>
  161. </div>
  162. <script src="~/Content/Scripts/Jquery/jquery-3.3.1.min.js"></script>
  163. @*<script src="~/Content/Plugins/printThis/printThis.js"></script>*@
  164. <script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>
  165. <script src="~/Content/Scripts/MyScript/ExportExcel.js"></script>
  166. <script src="~/Abp/Framework/scripts/abp.js"></script>
  167. <script src="~/Abp/Framework/scripts/libs/abp.jquery.js"></script>
  168. <script src="~/Content/Scripts/MyScript/UtilJs.js"></script>
  169. <script>
  170. $(function () {
  171. /*$("#printBtn").on('click',
  172. function () {
  173. $("#printContent").printThis({
  174. debug: false, // show the iframe for debugging
  175. importCSS: true, // import page CSS
  176. importStyle: false, // import style tags
  177. printContainer: true, // grab outer container as well as the contents of the selector
  178. //loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple
  179. pageTitle: "", // add title to print page
  180. removeInline: false, // remove all inline styles from print elements
  181. printDelay: 333, // variable print delay
  182. header: null, // prefix to html
  183. footer: null, // postfix to html
  184. base: false, // preserve the BASE tag, or accept a string for the URL
  185. formValues: true, // preserve input/form values
  186. canvas: false, // copy canvas elements (experimental)
  187. //doctypeString: "...", // enter a different doctype for older markup
  188. removeScripts: false, // remove script tags from print content
  189. copyTagClasses: false // copy classes from the html & body tag#1#
  190. });
  191. });*/
  192. $("#printBtn").printPreview({
  193. printBody: "#printContent",
  194. modalWidth: 900
  195. })
  196. $("#exportBtn").on('click',
  197. function (e) {
  198. SaveAjax({
  199. url: "/api/services/app/OrderItems/ExportOrderItemsCommon",
  200. isValidate: false,
  201. isAlert: false,
  202. data: { id: "@orderHeader.Id" },
  203. success: function (res) {
  204. var urlPath = window.document.location.href; //浏览器显示地址 http://10.15.5.83:5555/ISV/demo.aspx?a=1&b=2
  205. var docPath = window.document.location.pathname; //文件在服务器相对地址 /ISV/demo.aspx
  206. var index = urlPath.indexOf(docPath);
  207. var serverPath = urlPath.substring(0, index); //服务器地址 http://10.15.5.83:5555
  208. window.location.href = serverPath+"/" + res;
  209. }
  210. });
  211. });
  212. })
  213. </script>
  214. </body>
  215. </html>