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.

425 lines
18 KiB

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. debugger;
  8. var myDate = new Date;
  9. var year = myDate.getFullYear(); //获取当前年
  10. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  11. var date = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  12. var MtimeFrom = year + "-" + mon + "-" + date;
  13. var MtimeArrive = year + "-" + mon + "-" + date;
  14. var _Clos = new Array();
  15. var _Clos2 = new Array();
  16. var _Clos1 = new Array();
  17. var flag = '1';
  18. var mark = '';
  19. var Arguments = '';
  20. $(function () {
  21. $("#TimeFrom").val(MtimeFrom);
  22. $("#TimeArrive").val(MtimeArrive);
  23. SetCols();
  24. GetPickingListType();
  25. gridList();
  26. });
  27. function Selchange() {
  28. document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
  29. gridList();
  30. }
  31. function SetCols() {
  32. $.ajax({
  33. url: "/Print/SelectColumnName?" + Math.random(),
  34. dataType: "json",
  35. async: false,
  36. success: function (data) {
  37. var cols = new Array();
  38. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  39. cols.push(collast);
  40. var collast = { label: '单据号', name: 'Code', width: 120, align: 'left' };
  41. cols.push(collast);
  42. var collast = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
  43. cols.push(collast);
  44. var collast = { label: '维护人', name: 'MUSER', width: 80, align: 'left' };
  45. cols.push(collast);
  46. var collast = { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' };
  47. cols.push(collast);
  48. var collast = { label: '合并拣料ID', name: 'IsNew', width: 80, align: 'left' };
  49. cols.push(collast);
  50. var collast = { label: '是否占料', name: 'IsOccupy', width: 80, align: 'left' };
  51. cols.push(collast);
  52. var cols2 = new Array();
  53. var collast2 = { label: '合并拣料ID', name: 'MergeID', width: 120, align: 'left' };
  54. cols2.push(collast2);
  55. var collast2 = { label: '单据号', name: 'Code', width: 120, align: 'left' };
  56. cols2.push(collast2);
  57. var collast2 = { label: '单据行号', name: 'Sequence', width: 100, align: 'left' };
  58. cols2.push(collast2);
  59. var collast2 = { label: '条码', name: 'LotNO', width: 200, align: 'left' };
  60. cols2.push(collast2);
  61. var collast2 = { label: '料品编码', name: 'InvCode', width: 150, align: 'left' };
  62. cols2.push(collast2);
  63. var collast2 = { label: '料品名称', name: 'InvName', width: 150, align: 'left' };
  64. cols2.push(collast2);
  65. var collast2 = { label: '料品描述', name: 'InvDesc', width: 150, align: 'left' };
  66. cols2.push(collast2);
  67. var collast2 = { label: '规格型号', name: 'InvStd', width: 150, align: 'left' };
  68. cols2.push(collast2);
  69. var collast2 = { label: '料品单位', name: 'InvSInvUnittd', width: 150, align: 'left' };
  70. cols2.push(collast2);
  71. var collast2 = { label: '应发数量', name: 'iQuantity', width: 100, align: 'left' };
  72. cols2.push(collast2);
  73. //var collast2 = { label: '库存数量', name: 'QTY', width: 100, align: 'left' };
  74. //cols2.push(collast2);
  75. var collast2 = { label: '单位', name: 'InvUnit', width: 100, align: 'left' };
  76. cols2.push(collast2);
  77. var collast2 = { label: '维护人', name: 'MUSER', width: 80, align: 'left' };
  78. cols2.push(collast2);
  79. var collast2 = { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' };
  80. cols2.push(collast2);
  81. var collast2 = { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' };
  82. cols2.push(collast2);
  83. var collast2 = { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' };
  84. cols2.push(collast2);
  85. var collast2 = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
  86. cols2.push(collast2);
  87. if (data != null && data.length > 0) {
  88. DateList = data;
  89. for (var i = 0; i < data.length; i++) {
  90. var ColName = data[i].ColName;
  91. var ColCode = data[i].ColCode;
  92. var obj = new Array();
  93. obj = {
  94. label: ColName,
  95. name: ColCode,
  96. width: 80,
  97. align: "left"
  98. }
  99. cols.push(obj);
  100. //cols1.push(obj);
  101. cols2.push(obj);
  102. }
  103. }
  104. _Clos = cols;
  105. _Clos2 = cols2;
  106. }
  107. });
  108. }
  109. function gridList() {
  110. var Type = $("#selShow").val();
  111. var $gridList = $("#gridList");
  112. var queryJson = {
  113. POCode: $("#txt_POCode").val(),
  114. InvCode: $("#txt_InvCode").val(),
  115. TimeFrom: $("#TimeFrom").val(),
  116. TimeArrive: $("#TimeArrive").val(),
  117. }
  118. $gridList.dataGrid({
  119. url: "/WMS/PickMaterial/GetGridJsonSeizeM? " + Math.random(),
  120. postData: { queryJson: JSON.stringify(queryJson), Type: Type },
  121. height: $(window).height() - 150,
  122. width: $(window).width() - 500,
  123. colModel: _Clos,
  124. //colModel: [
  125. // { label: "主键", name: "ID", hidden: true, key: true },
  126. // { label: '单据号', name: 'Code', width: 120, align: 'left' },
  127. // { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
  128. // { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
  129. // { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
  130. // { label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
  131. //],
  132. shrinkToFit: false,//宽度自适应
  133. autowidth: true,
  134. gridComplete: function () {
  135. },
  136. rowNum: 10000,
  137. autoScroll: true,
  138. sortname: 'Code',
  139. sortorder: "desc",
  140. viewrecords: true,
  141. multiselect: true,
  142. subGrid: true, // (1)开启子表格支持
  143. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  144. $("#gridList").jqGrid("setSelection", rowid, false);
  145. bindSubGrid(subgrid_id, rowid)
  146. },
  147. gridComplete: function () {
  148. debugger;
  149. var strIds = $("#gridList").jqGrid("getDataIDs");
  150. }
  151. });
  152. }
  153. function bindSubGrid(subgrid_id, rowid) {
  154. var Type = $("#selShow").val();
  155. $("#gridList").jqGrid("setSelection", rowid, false);
  156. var subgrid_table_id;
  157. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  158. var subgrid_pager_id;
  159. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  160. // (5)动态添加子报表的table和pager
  161. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  162. var Code = $("#gridList").jqGrid('getRowData', rowid).Code;
  163. //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  164. // (6)创建jqGrid对象
  165. $("#" + subgrid_table_id).dataGrid({
  166. cellEdit: true,
  167. url: "/WMS/PickMaterial/GetSubGridJsonSeizeM?Code=" + Code + "&Type=" + Type + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  168. //colModel: [
  169. // { label: '单据号', name: 'Code', width: 120, align: 'left' },
  170. // { label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
  171. // { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
  172. // { label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
  173. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  174. // { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  175. // { label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
  176. // { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  177. // { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  178. // { label: '已发数量', name: 'IssueQuantity', width: 100, align: 'left' },
  179. // { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  180. // { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
  181. // { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
  182. // { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
  183. // { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
  184. //],
  185. colModel: _Clos2,
  186. //colModel: ColModelSub,
  187. shrinkToFit: true,//宽度自适应
  188. //multiselect: true,
  189. prmNames: { search: "search" },
  190. viewrecords: true,
  191. height: "100%",
  192. rowNum: 20,
  193. pager: subgrid_pager_id,
  194. });
  195. }
  196. function btnPrint() {
  197. debugger;
  198. var mold = '';
  199. if (mark == '') {
  200. $.modalAlertNew("WMS00093");
  201. return;
  202. }
  203. if (mark == '合并拣料') {
  204. var objArr = '';
  205. var arr = [];
  206. var obj_Item1 = $("#gridList2");
  207. var rowIds_Item1 = obj_Item1.getDataIDs();
  208. var arrayData_Item1 = new Array();
  209. var Enables = '';
  210. if (rowIds_Item1.length > 0) {
  211. debugger;
  212. for (var i = 0; i < rowIds_Item1.length; i++) {
  213. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
  214. objArr += "'" + RowData_Item1.MergeID + "',";
  215. objArr = objArr.slice(0, objArr.length - 1);
  216. objArr = "" + objArr + "|";
  217. arr.push(objArr);
  218. }
  219. Arguments = arr;
  220. mold = 'HBJL00001';
  221. }
  222. }
  223. if (mark == '拣料') {
  224. var objArr = '';
  225. var arr = [];
  226. var obj_Item1 = $("#gridList2");
  227. var rowIds_Item1 = obj_Item1.getDataIDs();
  228. var arrayData_Item1 = new Array();
  229. var Enables = '';
  230. if (rowIds_Item1.length > 0) {
  231. debugger;
  232. for (var i = 0; i < rowIds_Item1.length; i++) {
  233. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
  234. objArr += "'" + RowData_Item1.Code + "',";
  235. objArr = objArr.slice(0, objArr.length - 1);
  236. objArr = "" + objArr + "|";
  237. arr.push(objArr);
  238. }
  239. Arguments = arr;
  240. mold = 'JL00001';
  241. }
  242. }
  243. $.modalOpen({
  244. id: "PrintLot",
  245. title: "打印",
  246. url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(Arguments)) + "&mold=" + mold + "&" + Math.random(),
  247. width: "550px",
  248. height: "1000px",
  249. callBack: function (iframeId) {
  250. top.frames[iframeId].submitForm();
  251. }
  252. });
  253. }
  254. function GetPickingListType() {
  255. $.ajax({
  256. url: "/WMS/PickMaterial/GetPickingListType",
  257. dataType: "json",
  258. async: false,
  259. success: function (data) {
  260. if (data != false && data != null && data.length > 0) {
  261. $("#selShow").find("option").remove();
  262. //$("#selShow").append("<option value=''>==请选择站点==</option>");
  263. for (var i = 0; i < data.length; i++) {
  264. $("#selShow").append("<option value='" + data[i].Code + "'>" + data[i].Name + "</option>");
  265. }
  266. $("#selShow").val([data[0].Code]).trigger("change");
  267. }
  268. }
  269. });
  270. }
  271. function btnBackMaterial() {
  272. debugger;
  273. var objArr = '';
  274. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  275. for (var i = 0; i < objList.length; i++) {
  276. var rowId = objList[i];
  277. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  278. objArr += "'" + rowData.Code + "',";
  279. }
  280. if (objArr == '') {
  281. $.modalAlert("请选择单据后取消占料!", "warning");
  282. return;
  283. }
  284. debugger;
  285. $.deleteForm({
  286. url: "/WMS/PickMaterial/DelPickLog" + "?" + Math.random(),
  287. param: { objCode: JSON.stringify(objArr) },
  288. success: function () {
  289. $.currentWindow().$("#gridList").trigger("reloadGrid");
  290. }
  291. })
  292. }
  293. function fullscreen() {
  294. var docElm = document.documentElement;
  295. if (docElm.requestFullscreen) {
  296. docElm.requestFullscreen();
  297. } else if (docElm.mozRequestFullScreen) {
  298. docElm.mozRequestFullScreen();
  299. } else if (docElm.webkitRequestFullScreen) {
  300. docElm.webkitRequestFullScreen();
  301. } else if (docElm.msRequestFullscreen) {
  302. docElm.msRequestFullscreen();
  303. }
  304. $(window).bind('resize', function () {
  305. $("#gridList").setGridWidth($(window).width());
  306. }).trigger('resize');
  307. $(window).bind('resize', function () {
  308. $("#gridList").setGridHeight($(window).height());
  309. }).trigger('resize');
  310. }
  311. </script>
  312. <div class="topPanel" style="height:60px;">
  313. <div class="toolbar">
  314. <div class="btn-group">
  315. <a id="NF-BackMaterial" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnBackMaterial()"><i class="fa fa-pencil-square-o"></i>回撤拣配</a>
  316. <a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><i class="fa fa-pencil-square-o"></i>打印</a>
  317. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  318. </div>
  319. <script>$('.toolbar').authorizeButton()</script>
  320. </div>
  321. <div class="search">
  322. <table>
  323. <tr>
  324. <td>
  325. <label>&nbsp;&nbsp;&nbsp;类型:</label>
  326. </td>
  327. <td>
  328. <div class="input-group">
  329. <select id="selShow" name="F_Target" class="form-control" style="width: 100px;" onchange="Selchange()">
  330. @*<option value="1" selected="selected">工单备料</option>
  331. <option value="2" selected="selected">工单领料</option>
  332. <option value="3" selected="selected">工单材料出库</option>
  333. <option value="4" selected="selected">委外备料</option>
  334. <option value="5" selected="selected">委外领料</option>
  335. <option value="6" selected="selected">委外材料出库</option>
  336. <option value="7" selected="selected">销售发货</option>
  337. <option value="8" selected="selected">其它出库</option>
  338. <option value="9" selected="selected">借用</option>
  339. <option value="10" selected="selected">物料调拨</option>
  340. <option value="11" selected="selected">两步调出</option>*@
  341. </select>
  342. </div>
  343. </td>
  344. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  345. <td>
  346. <div class="input-group">
  347. <input id="txt_POCode" type="text" class="form-control" style="width: 150px;">
  348. </div>
  349. </td>
  350. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  351. <td>
  352. <div class="input-group">
  353. <input id="txt_InvCode" type="text" class="form-control" style="width: 150px;">
  354. </div>
  355. </td>
  356. <td style="text-align:right;"><label class="lglabel" for="txt_TimeFrom">&nbsp;&nbsp;&nbsp;日期(从)</label>:</td>
  357. <td>
  358. <div class="input-group">
  359. <input id="TimeFrom" name="Time" type="text" class="form-control required" style="width:85%;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder="日期(从)" />
  360. </div>
  361. </td>
  362. <td style="text-align:right;"><label class="lglabel" for="txt_TimeArrive">&nbsp;&nbsp;&nbsp;日期(到)</label>:</td>
  363. <td>
  364. <div class="input-group">
  365. <input id="TimeArrive" name="Time" type="text" class="form-control required" style="width:85%;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期(到)" />
  366. </div>
  367. </td>
  368. <td>
  369. <span class="input-group-btn">
  370. <button id="btn_search" type="button" class="btn btn-primary" onclick="Selchange()"><i class="fa fa-search"></i></button>
  371. </span>
  372. </td>
  373. </tr>
  374. </table>
  375. </div>
  376. </div>
  377. <div class="gridPanel" id="gridPanel">
  378. <span><strong>详细信息</strong></span>
  379. <table id="gridList"></table>
  380. </div>