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.

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