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.

398 lines
16 KiB

  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  7. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  8. <script src="~/Content/js/select2/select2.min.js"></script>
  9. <style>
  10. #Additem {
  11. margin-left: 45%;
  12. }
  13. #AddTemitem {
  14. margin-right: 45%;
  15. }
  16. </style>
  17. <script>
  18. var _Clos = new Array();
  19. var rfqcode = $.request("rfqcode");
  20. var ID = $.request("ID");
  21. var POCode = $.request("POCode");
  22. var WHCode = $.request("WHCode");
  23. var VenCode = $.request("VenCode");
  24. var DepCode = $.request("DepCode");
  25. var POCode = $.request("POCode");
  26. $(function () {
  27. SetCols();
  28. InitControl();
  29. var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  30. var now = new Date();
  31. var date = now.toLocaleDateString();
  32. $("#txtMUSER").val(Muser);
  33. $("#txtMTIME").val(date);
  34. $("#txtPOCode").val(POCode);
  35. $("#sel_WHCode").val([WHCode]).trigger("change");
  36. $("#txtVenCode").val(VenCode);
  37. $("#txtDept").val(DepCode);
  38. $("#txtPOCode").val(POCode);
  39. ClearTemp();
  40. reloadData();
  41. })
  42. function SetCols() {
  43. $.ajax({
  44. url: "/Print/SelectColumnName?" + Math.random(),
  45. dataType: "json",
  46. async: false,
  47. success: function (data) {
  48. var cols = new Array();
  49. var collast = { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true };
  50. cols.push(collast);
  51. var collast = { label: 'ID', name: 'ID', hidden: true };
  52. cols.push(collast);
  53. var collast = {
  54. label: '查看', width: 100, align: 'left',
  55. formatter: btnLook
  56. };
  57. cols.push(collast);
  58. var collast = { label: '退料子ID', name: 'TLZID', hidden: true };
  59. cols.push(collast);
  60. var collast = { label: '采购订单号', name: 'PoCode', width: 150, align: 'left' };
  61. cols.push(collast);
  62. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  63. cols.push(collast);
  64. var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
  65. cols.push(collast);
  66. var collast = { label: '规格型号', name: 'InvStd', width: 100, align: 'left' };
  67. cols.push(collast);
  68. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } };
  69. cols.push(collast);
  70. var collast = { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' };
  71. cols.push(collast);
  72. var collast = { label: '单位', name: 'InvUnit', width: 100, align: 'left' };
  73. cols.push(collast);
  74. var collast = { label: '子件ID', name: 'ZJID', width: 100, align: 'left' };
  75. cols.push(collast);
  76. var collast = { label: '自由项ID', name: 'ExtensionID', hidden: true };
  77. cols.push(collast);
  78. if (data != null && data.length > 0) {
  79. DateList = data;
  80. for (var i = 0; i < data.length; i++) {
  81. var ColName = data[i].ColName;
  82. var ColCode = data[i].ColCode;
  83. var obj = new Array();
  84. obj = {
  85. label: ColName,
  86. name: ColCode,
  87. width: 80,
  88. align: "left",
  89. editable: true
  90. }
  91. cols.push(obj);
  92. }
  93. }
  94. _Clos = cols;
  95. }
  96. });
  97. }
  98. function reloadData() {
  99. $("#gridList").dataGrid({
  100. url: "/WMS/PurOrder/GetICSMOApplyNegDetailTemp?POCode=" + $("#txtPOCode").val() + "&" + Math.random(),
  101. //postData: { rfqno: $("#RFQNO").val() },
  102. height: $(window).height() - 200,
  103. width: $(window).width(),
  104. cellEdit: true,
  105. colModel: _Clos,
  106. // colModel: [
  107. //{ label: '主键', name: 'ID', width: 150, align: 'left' ,hidden: true, key: true },
  108. //{ label: 'ID', name: 'ID', hidden: true },
  109. // {
  110. // label: '查看', width: 100, align: 'left',
  111. // formatter: btnLook
  112. // },
  113. //{ label: '退料子ID', name: 'TLZID', hidden: true },
  114. //{ label: '退料单号', name: 'POCode', width: 150, align: 'left' },
  115. //{ label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  116. //{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  117. //{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  118. //{ label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } },
  119. //{ label: '辅计量数量', name: 'Amount', width: 150, align: 'left' },
  120. //{ label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  121. //{ label: '子件ID', name: 'ZJID', width: 100, align: 'left' },
  122. //{ label: '已发数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
  123. //{ label: '自由项ID', name: 'ExtensionID', hidden: true },
  124. // ],
  125. cellsubmit: "clientArray",
  126. width: "100%",
  127. autowidth: true,
  128. rownumbers: true,
  129. viewrecords: true,
  130. });
  131. }
  132. function btnLook(cellvalue, options, rowObject) {
  133. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "','" + rowObject.TLZID + "')\">查看</a>";
  134. }
  135. function UpLoadClick(ID,TLZID) {
  136. debugger;
  137. $.modalOpen({
  138. id: "selectDeatil",
  139. title: "查看修改物料",
  140. url: "/WMS/PurOrder/SeachInventory?TLZID=" + TLZID + "&Type=" + 1 + "&TLZID=" + TLZID + "&" + Math.random(),
  141. width: "1000px",
  142. height: "1000px",
  143. callBack: function (iframeId) {
  144. //top.frames[iframeId].submitForm();
  145. //top.frames[iframeId].Close();
  146. //$("#gridList").jqGrid().setGridParam({ datatype: 'json' }, { postData: { rfqno: $("#RFQNO").val() } }).trigger('reloadGrid');
  147. $("#gridList").jqGrid("delRowData", ID)
  148. var obj = top.frames[iframeId].submitForm();
  149. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  150. $(".unwritten").hide();
  151. top.frames[iframeId].Close();
  152. }
  153. });
  154. }
  155. function guid() {
  156. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  157. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  158. return v.toString(16);
  159. });
  160. }
  161. //最后一行新增数据
  162. function AddRowToLast() {
  163. var obj = {
  164. ID: guid(),
  165. };
  166. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  167. $(".unwritten").hide();
  168. }
  169. function DeleteRowToLast() {
  170. debugger;
  171. var rowid = $("#gridList").jqGridRowValue().ID
  172. $("#gridList").delRowData(rowid);
  173. }
  174. function InitControl() {
  175. var $VenCode = $("#sel_WHCode");
  176. $VenCode.select2({
  177. allowClear: true,
  178. escapeMarkup: function (m) {
  179. return m;
  180. }
  181. });
  182. $.ajax({
  183. url: "/WMS/PurOrder/GetWHCode" + "?" + Math.random(),
  184. dataType: "json",
  185. async: false,
  186. success: function (data) {
  187. $.each(data, function (index, item) {
  188. $VenCode.append("<option value='" + item.WarehouseCode + "'>&nbsp;" + item.WarehouseName + "</option>");
  189. });
  190. }
  191. });
  192. }
  193. function ClearTemp() {
  194. $.ajax({
  195. url: "/WMS/PurOrder/ClearTemp?" + Math.random(),
  196. datatype: "json",
  197. async: false
  198. })
  199. }
  200. function submitForm() {
  201. var WHCode = $("#sel_WHCode").val();
  202. if (WHCode == "") {
  203. $.modalAlertNew("WMS00041");
  204. return;
  205. }
  206. debugger;
  207. var VenCode = $("#txtVenCode").val();
  208. var PoCode = $("#txtPOCode").val();
  209. var DepCode = $("#txtDept").val();
  210. var IDlist = "";
  211. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  212. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  213. var myDate = new Date();
  214. var year = myDate.getFullYear(); //获取当前年
  215. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  216. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  217. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  218. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  219. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  220. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  221. var Details = [];
  222. var ICSASN = [];
  223. var obj_vendor = $("#gridList");
  224. var rowIds_vendor = obj_vendor.getDataIDs();
  225. var arrayData_vendor = new Array();
  226. if (rowIds_vendor.length > 0) {
  227. for (var i = 0; i < rowIds_vendor.length; i++) {
  228. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  229. if (vendorRowData.Quantity == '0' || vendorRowData.Quantity == 0) {
  230. $.modalAlertNew("WMS00089");
  231. return;
  232. }
  233. var obj = {
  234. ID: ID,
  235. VenCode: VenCode,
  236. DepCode: DepCode,
  237. WHCode: WHCode,
  238. User: RoleEnCode,
  239. MTIME: date,
  240. WorkPoint: WorkPoint,
  241. Type: '1',
  242. //Detail: Details,
  243. Sequence: i + 1,
  244. PoCode: PoCode,
  245. InvCode: vendorRowData.InvCode,
  246. Quantity: vendorRowData.Quantity,
  247. Amount: vendorRowData.Amount,
  248. SourceDetailID: vendorRowData.ZJID,
  249. //ExtensionID: vendorRowData.ExtensionID,
  250. ProjectCode: vendorRowData.ProjectCode,
  251. BatchCode: vendorRowData.BatchCode,
  252. Version: vendorRowData.Version,
  253. Brand: vendorRowData.Brand,
  254. cFree1: vendorRowData.cFree1,
  255. cFree2: vendorRowData.cFree2,
  256. cFree3: vendorRowData.cFree3,
  257. cFree4: vendorRowData.cFree4,
  258. cFree5: vendorRowData.cFree5,
  259. cFree6: vendorRowData.cFree6,
  260. cFree7: vendorRowData.cFree7,
  261. cFree8: vendorRowData.cFree8,
  262. cFree9: vendorRowData.cFree9,
  263. cFree10: vendorRowData.cFree10
  264. };
  265. ICSASN.push(obj);
  266. }
  267. //var ICSASNs = {
  268. // ID:ID,
  269. // WHCode: WHCode,
  270. // User: RoleEnCode,
  271. // MTIME: date,
  272. // WorkPoint: WorkPoint,
  273. // Type:'1',
  274. // //Detail: Details,
  275. // Sequence: i + 1,
  276. // PoCode: vendorRowData.PoCode,
  277. // InvCode: vendorRowData.InvCode,
  278. // Quantity: vendorRowData.Quantity,
  279. // Amount: vendorRowData.Amount,
  280. // SourceDetailID: vendorRowData.ZJID,
  281. // //ExtensionID: vendorRowData.ExtensionID,
  282. // ProjectCode: vendorRowData.ProjectCode,
  283. // BatchCode: vendorRowData.BatchCode,
  284. // Version: vendorRowData.Version,
  285. // Brand: vendorRowData.Brand,
  286. // cFree1: vendorRowData.cFree1,
  287. // cFree2: vendorRowData.cFree2,
  288. // cFree3: vendorRowData.cFree3,
  289. // cFree4: vendorRowData.cFree4,
  290. // cFree5: vendorRowData.cFree5,
  291. // cFree6: vendorRowData.cFree6,
  292. // cFree7: vendorRowData.cFree7,
  293. // cFree8: vendorRowData.cFree8,
  294. // cFree9: vendorRowData.cFree9,
  295. // cFree10: vendorRowData.cFree10,
  296. //}
  297. $.submitForm({
  298. url: "/WMS/PurOrder/UpdateICSPurOrder?" + Math.random(),
  299. param: { ICSASN: JSON.stringify(ICSASN) },
  300. success: function () {
  301. $.currentWindow().$("#gridList").trigger("reloadGrid");
  302. }
  303. })
  304. }
  305. }
  306. </script>
  307. <form id="form1">
  308. <div class="topPanel" style="height:10px">
  309. <div class="btn-group">
  310. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  311. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  312. </div>
  313. </div>
  314. <div style="margin-right: 20px;">
  315. <table class="form">
  316. <thead>主表信息</thead>
  317. <tr>
  318. <th class="formTitle MOPick">采购单号:</th>
  319. <td class="formValue MOPick">
  320. <input type="text" id="txtPOCode" class="form-control" readonly="readonly"/>
  321. </td>
  322. @*<th class="formTitle">仓库编码:</th>
  323. <td class="formValue">
  324. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  325. <input type="hidden" id="hidetext" />
  326. </td>*@
  327. </tr>
  328. <tr>
  329. <th class="formTitle">维护人:</th>
  330. <td class="formValue">
  331. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  332. </td>
  333. <th class="formTitle">维护时间:</th>
  334. <td class="formValue">
  335. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  336. </td>
  337. </tr>
  338. <tr>
  339. <th class="formTitle">供应商:</th>
  340. <td class="formValue">
  341. <input id="txtVenCode" type="text" class="form-control" />
  342. </td>
  343. <th class="formTitle">部门:</th>
  344. <td class="formValue">
  345. <input id="txtDept" type="text" class="form-control" />
  346. </td>
  347. </tr>
  348. </table>
  349. </div>
  350. <div class="gridPanel" style="margin-left:10px">
  351. <span><strong>子表信息</strong></span>
  352. <table id="gridList"></table>
  353. <div style="text-align:center">
  354. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  355. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  356. </div>
  357. </div>
  358. </form>