You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
8.4 KiB

  1. 
  2. @{
  3. ViewBag.Title = "Form";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
  7. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  8. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  9. <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
  10. <style>
  11. * {
  12. box-sizing: border-box;
  13. }
  14. </style>
  15. <script>
  16. debugger;
  17. //var Arguments = decodeURI($.request("Arguments"));
  18. //var Arguments = '{"name":"wust", "url":"www.wust.edu.cn", "age":120}';
  19. var ID = $.request("ID");
  20. var mold = $.request("mold");
  21. if (mold == 'YLJL00001' || mold == 'HYJL00001') {
  22. var Arguments = sessionStorage.getItem("Arguments"); // 获取参数
  23. } else {
  24. var Arguments = decodeURI($.request("Arguments"));
  25. }
  26. $(function () {
  27. debugger;
  28. InitControl();
  29. $("#sel_LableType").val(mold).trigger("change");
  30. $("#sel_LableType").attr("disabled", "disabled");
  31. InitContro2();
  32. $("#sel_LableType").change(function () {
  33. InitContro2();
  34. });
  35. });
  36. //function GetTXT() {
  37. // if (!!ID) {
  38. // $.ajax({
  39. // url: "/WMS/BasicSettings/GetLabelTXT?ID=" + ID + "&" + Math.random(),
  40. // dataType: "json",
  41. // async: false,
  42. // success: function (data) {
  43. // debugger;
  44. // $("#txtLableCode").val(data.rows[0].LableCode);
  45. // $("#txtLableName").val(data.rows[0].LableName);
  46. // $("#sel_LableType").val(data.rows[0].LableType).trigger("change");
  47. // $("#sel_LableSourceID").val(data.rows[0].LableSourceID).trigger("change");
  48. // }
  49. // });
  50. // }
  51. //};
  52. function InitControl() {
  53. var $LableType = $("#sel_LableType");
  54. $LableType.select2({
  55. allowClear: true,
  56. escapeMarkup: function (m) {
  57. return m;
  58. }
  59. });
  60. $.ajax({
  61. url: "/WMS/Print/GetLableType" + "?" + Math.random(),
  62. dataType: "json",
  63. async: false,
  64. success: function (data) {
  65. $.each(data, function (index, item) {
  66. $LableType.append("<option value='" + item.F_ItemCode + "'>&nbsp;" + item.F_ItemName + "</option>");
  67. });
  68. }
  69. });
  70. }
  71. function InitContro2() {
  72. $("#Sys_LablesID").empty();
  73. var LableType= $("#sel_LableType").val();
  74. var $Sys_LablesID = $("#Sys_LablesID");
  75. $Sys_LablesID.select2({
  76. allowClear: true,
  77. escapeMarkup: function (m) {
  78. return m;
  79. }
  80. });
  81. $.ajax({
  82. url: "/WMS/Print/GetSys_LablesID?LableType=" + LableType + "&" + Math.random(),
  83. dataType: "json",
  84. async: false,
  85. success: function (data) {
  86. $.each(data, function (index, item) {
  87. $Sys_LablesID.append("<option value='" + item.ID + "'>&nbsp;" + item.LableName + "</option>");
  88. });
  89. $("#Sys_LablesID").val([data[1].ID]).trigger("change");
  90. }
  91. });
  92. }
  93. function submitForm() {
  94. var strPrintData;
  95. var bIsInstallPrintControl;
  96. var strPrintControlCookie;
  97. var objArr = {
  98. Sys_LablesID: $("#Sys_LablesID").val(),
  99. };
  100. //判断是否下载
  101. const GGID = localStorage.getItem("GGID");
  102. if (GGID == '' || GGID == null || GGID == undefined) {
  103. //if (confirm("打印控件未安装!已为你下载至浏览器,请自行安装!")) {
  104. document.getElementById("downPrintControl").click();
  105. localStorage.setItem("GGID", "1234567899");
  106. $.modalAlert("<span style='color: red;font-size:18px'>请自行确认打印控件是否安装,打印控件已为你下载至<br/> ** 浏览器的下载目录下** 。<br/>若未安装请自行安装,只有成功安装打印控件后才能进行打印!</span>", "warning");
  107. return;
  108. //}
  109. }
  110. if (mold == 'YLJL00001' ) {
  111. var params = {
  112. Url : "/WMS/Print/YLPrintItemLot",
  113. keyValue: JSON.stringify(objArr),
  114. Arguments: Arguments
  115. };
  116. }
  117. else if (mold == 'HYJL00001') {
  118. var params = {
  119. Url: "/WMS/Print/PrintItemLot",
  120. keyValue: JSON.stringify(objArr),
  121. Arguments: Arguments
  122. };
  123. }
  124. else {
  125. var params = {
  126. Url: "/WMS/Print/PrintItemLot",
  127. keyValue: JSON.stringify(objArr),
  128. Arguments: JSON.stringify(Arguments)
  129. };
  130. }
  131. $.ajax({
  132. url: params.Url,
  133. type: "post",
  134. data: { keyValue: params.keyValue, Parameter: params.Arguments },
  135. dataType: "json",
  136. async: false,
  137. success: function (data) {
  138. strPrintData = data.strPrintData_1;
  139. bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  140. strPrintControlCookie = data.strPrintControlCookie_1;
  141. }
  142. });
  143. if (strPrintData != '') {
  144. var test = "ChuLinPrint:" + strPrintData;
  145. $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  146. }
  147. //if (bIsInstallPrintControl == 'False') {
  148. // if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  149. // $("#downPrintControl").click();
  150. // }
  151. //}
  152. if (bIsInstallPrintControl == 'True') {
  153. var strPrintControlCookie = strPrintControlCookie;
  154. if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  155. setTimeout("checkPrintControlInstall()", 8000);
  156. function checkPrintControlInstall() {
  157. $.ajax({
  158. url: "/WMS/WMSCreateItemLot/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  159. dataType: "json",
  160. async: false,
  161. success: function (strResult) {
  162. if (strResult.indexOf("PrintControlInstall") == -1) {
  163. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  164. $("#downPrintControl").click();
  165. }
  166. }
  167. }
  168. });
  169. }
  170. }
  171. }
  172. }
  173. </script>
  174. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  175. <div class="btn-group" style="display:block;padding-left:2px;">
  176. <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
  177. @*<a id="DeleteLog" authorize="yes" class="btn btn-primary dropdown-text" ><i class="fa fa-download"></i>打印控件不工作点我后重试</a>*@
  178. </div>
  179. <form id="form1">
  180. <div class="widget-body">
  181. <div style="padding-top: 5px; ">
  182. <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
  183. <div class="step-pane active" id="step-1" style="padding-left: 5px; padding-top: 20px; margin-right: 20px;">
  184. <table class="form">
  185. <tr>
  186. <th class="formTitle">标签类型: </th>
  187. <td class="formValue">
  188. <select id="sel_LableType" name="sel_LableType" class="form-control select2" style="width: 230px" placeholder="请选择标签类型..."></select>
  189. <input type="hidden" id="hidetext" />
  190. </td>
  191. </tr>
  192. <tr>
  193. <th class="formTitle">打印模板:</th>
  194. <td class="formValue">
  195. <select id="Sys_LablesID" name="Sys_LablesID" class="form-control select2" style="width: 230px" placeholder="请选择标签类型..."></select>
  196. <input type="hidden" id="hidetext" />
  197. </td>
  198. </tr>
  199. </table>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. </form>