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.

234 lines
8.4 KiB

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