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.

465 lines
18 KiB

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  6. <link href="~/Content/js/dialog/dialog.css?v=20120420" rel="stylesheet" />
  7. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  8. <script src="~/Content/js/select2/select2.min.js"></script>
  9. <style>
  10. .selected-row {
  11. background-color: yellow;
  12. }
  13. </style>
  14. <style>
  15. .divbox {
  16. margin-left: 20px;
  17. margin-top: 10px;
  18. display: inline-block;
  19. float: left;
  20. }
  21. .divformValue {
  22. display: inline-block;
  23. float: left;
  24. }
  25. .divformTitle {
  26. display: inline-block;
  27. float: left;
  28. }
  29. /*.divformValue{
  30. display:inline-block;
  31. }*/
  32. </style>
  33. <script>
  34. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  35. var User = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  36. var MODetailID = '';
  37. var TransSequence = '';
  38. var ZSequence = '';
  39. var Quantitys = '';
  40. var Amounts = '';
  41. var MODetailIDs = '';
  42. var count = 0;
  43. var selectedRowId = null;
  44. debugger;
  45. $(function () {
  46. gridList();
  47. //gridList3();
  48. LotNoBinding();
  49. });
  50. function gridList() {
  51. document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
  52. var queryJson = {
  53. Code: $("#txt_Code").val(),
  54. }
  55. $("#gridList").dataGrid({
  56. url: "/OMAY/OMAYSalesDelivery/GetSalesByCode" + "?" + Math.random(),
  57. postData: { queryJson: JSON.stringify(queryJson) },
  58. height:150,
  59. width: $(window).width() - 700,
  60. colModel: [
  61. { label: '选择', width: 100, align: 'left', formatter: BtnLookPick },
  62. { label: '主键', name: 'ID', hidden: true, key: true },
  63. { label: '销售单号', name: 'SDNCode', width: 100, align: 'left' },
  64. { label: '销售行号', name: 'Sequence', width: 100, align: 'left' },
  65. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  66. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  67. { label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
  68. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  69. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  70. { label: '已发数量', name: 'SDNQuantity', width: 100, align: 'left' },
  71. { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  72. { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
  73. //{ label: 'ERP工单行ID', name: 'MODetailID', width: 100, align: 'left' },
  74. { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  75. ],
  76. width: "100%",
  77. autowidth: true,
  78. gridComplete: function () {
  79. },
  80. pager: "#gridPager",
  81. sortname: 'SDNCode',
  82. sortorder: "desc",
  83. viewrecords: true,
  84. multiselect: false,
  85. beforeSelectRow: function (rowid, e) {
  86. $("#gridList").jqGrid('resetSelection');
  87. selectedRowId = rowid;
  88. return (true);
  89. }
  90. });
  91. }
  92. function gridList3() {
  93. $("#gridList3").dataGrid({
  94. height:250,
  95. width: $(window).width() - 400,
  96. cellEdit: true,
  97. cellsubmit: "clientArray",
  98. colModel: [
  99. { label: "主键", name: "ID", hidden: true, key: true },
  100. {
  101. label: '删除', width: 100, align: 'left',
  102. formatter: btnDelete
  103. },
  104. { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  105. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  106. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  107. { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  108. { label: '单位', name: 'InvUnit', width: 80, align: 'left' },
  109. { label: '生产日期', name: 'ProductDate', width: 150, align: 'left' },
  110. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  111. { label: '辅计量', name: 'Amount', width: 100, align: 'left' },
  112. { label: '本次发料数量', name: 'CurrentQuantity', width: 200, align: 'left', editable: true },
  113. { label: '项目号', name: 'ProjectCode', width: 200, align: 'left', hidden: true },
  114. { label: '批次', name: 'BatchCode', width: 200, align: 'left', hidden: true },
  115. { label: '版本', name: 'Version', width: 200, align: 'left', hidden: true },
  116. { label: '厂牌', name: 'Brand', width: 200, align: 'left', hidden: true },
  117. { label: '自由项1', name: 'cFree1', width: 200, align: 'left', hidden: true },
  118. { label: '自由项2', name: 'cFree2', width: 200, align: 'left', hidden: true },
  119. { label: '自由项3', name: 'cFree3', width: 200, align: 'left', hidden: true },
  120. { label: '自由项4', name: 'cFree4', width: 200, align: 'left', hidden: true },
  121. { label: '自由项5', name: 'cFree5', width: 200, align: 'left', hidden: true },
  122. { label: '自由项6', name: 'cFree6', width: 200, align: 'left', hidden: true },
  123. { label: '自由项7', name: 'cFree7', width: 200, align: 'left', hidden: true },
  124. { label: '自由项8', name: 'cFree8', width: 200, align: 'left', hidden: true },
  125. { label: '自由项9', name: 'cFree9', width: 200, align: 'left', hidden: true },
  126. { label: '自由项10', name: 'cFree10', width: 200, align: 'left', hidden: true },
  127. ],
  128. width: "100%",
  129. autowidth: true,
  130. rownumbers: true,
  131. viewrecords: true,
  132. });
  133. }
  134. //查看子件信息
  135. function BtnLookPick(cellvalue, options, rowObject) {
  136. debugger;
  137. return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"GridListClick('" + rowObject.ID + "','" + rowObject.Sequence + "','" + rowObject.Quantity + "','" + rowObject.Amount + "')\">选择</a>";
  138. }
  139. function GridListClick(ID, Sequence, Quantity, Amount) {
  140. debugger;
  141. $("#gridList").find("td").css("background-color", "");
  142. $("#" + ID).find("td").css("background-color", "yellow");
  143. TransSequence = Sequence;
  144. Quantitys = Quantity;
  145. Amounts = Amount;
  146. $("#gridList3").jqGrid("clearGridData");
  147. gridList3();
  148. }
  149. //function GridList2Click(ID, Sequence) {
  150. // $("#gridList2").find("td").css("background-color", "");
  151. // $("#" + ID).find("td").css("background-color", "yellow");
  152. // ZSequence = Sequence;
  153. // $("#gridList3").jqGrid("clearGridData");
  154. // gridList3();
  155. //}
  156. function btnDelete(cellvalue, options, rowObject) {
  157. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"Delete('" + rowObject.ID + "')\">删除</a>";
  158. }
  159. function Delete(ID) {
  160. $("#gridList3").delRowData(ID);
  161. }
  162. function SeachMO() {
  163. $.modalOpen({
  164. id: "SeachMO",
  165. title: "销售发货",
  166. url: "/OMAY/OMAYSalesDelivery/OMAYSalesDeliveryFrom" + "?" + Math.random(),
  167. width: "500px",
  168. height: "600px",
  169. callBack: function (iframeId) {
  170. var obj = top.frames[iframeId].submitForm();
  171. $("#txt_Code").val(obj.SDNCode);
  172. $("#txt_CusCode").val(obj.CusCode);
  173. $("#txt_CusName").val(obj.CusName);
  174. $("#txt_CreatePerson").val(obj.CreatePerson);
  175. $("#gridList").jqGrid("clearGridData");
  176. // $("#gridList2").jqGrid("clearGridData");
  177. $("#gridList3").jqGrid("clearGridData");
  178. gridList();
  179. $(".unwritten").hide();
  180. top.frames[iframeId].Close();
  181. }
  182. });
  183. }
  184. function LotNoBinding() {
  185. //if (count!=0) {
  186. // if (ZSequence == '') {
  187. // $.modalAlert("请先选择工单子件!", "warning");
  188. // return;
  189. // }
  190. //}
  191. //count = count + 1;
  192. var Msg = '';
  193. $("#LotNo").keydown(function (e) {
  194. var curKey = e.which;rowIds
  195. debugger;
  196. if (curKey == 13) {
  197. var Code = $("#txt_Code").val();//销售单号
  198. var LotNo = $("#LotNo").val();//条码号
  199. if (LotNo=='') {
  200. $.modalAlert("扫入的条码异常,请重新扫入!", 'warning');
  201. return;
  202. }
  203. var gridList3 = $("#gridList3");
  204. var rowIds = gridList3.getDataIDs();
  205. if (rowIds.length > 0) {
  206. for (var i = 0; i < rowIds.length; i++) {
  207. var RowData = gridList3.getRowData(rowIds[i]);
  208. if (RowData.LotNo == LotNo) {
  209. $.modalAlert("条码" + LotNo + "重复扫入,请确认!", 'warning');
  210. return;
  211. }
  212. }
  213. }
  214. var TransType = '销售发货-销售发货单';
  215. WorkPoint
  216. var keyValue = {
  217. TransCode: Code,
  218. TransSequence: TransSequence,
  219. Code: LotNo,
  220. TransType: TransType,
  221. WorkPoint: WorkPoint,
  222. User: User,
  223. }
  224. $.ajax({
  225. url: "/OMAY/OMAYSalesDelivery/GetLotNotInfo" + "?" + Math.random(),
  226. data: { keyValue: JSON.stringify(keyValue) },
  227. dataType: "json",
  228. async: false,
  229. success: function (data) {
  230. debugger;
  231. if (data == "" || data == null) {
  232. $.modalAlertNew("WMS00022");
  233. return;
  234. }
  235. //Msg = data.msg;
  236. if (data.msg!="") {
  237. $.modalAlert(data.msg, 'warning');
  238. return;
  239. }
  240. //最后一行新增数据
  241. var obj = {
  242. ID: data.dt[0].ID,
  243. LotNo: data.dt[0].LotNo,
  244. InvCode: data.dt[0].InvCode,
  245. InvName: data.dt[0].InvName,
  246. InvStd: data.dt[0].InvStd,
  247. InvUnit: data.dt[0].InvUnit,
  248. ProductDate: data.dt[0].ProductDate,
  249. Quantity: data.dt[0].Quantity,
  250. CurrentQuantity: 0,
  251. Amount: data.dt[0].Amount,
  252. ProjectCode: data.dt[0].ProjectCode,
  253. BatchCode: data.dt[0].BatchCode,
  254. Version: data.dt[0].Version,
  255. Brand: data.dt[0].Brand,
  256. cFree1: data.dt[0].cFree1,
  257. cFree2: data.dt[0].cFree2,
  258. cFree3: data.dt[0].cFree3,
  259. cFree4: data.dt[0].cFree4,
  260. cFree5: data.dt[0].cFree5,
  261. cFree6: data.dt[0].cFree6,
  262. cFree7: data.dt[0].cFree7,
  263. cFree8: data.dt[0].cFree8,
  264. cFree9: data.dt[0].cFree9,
  265. cFree10: data.dt[0].cFree10
  266. };
  267. $("#gridList3").jqGrid('addRowData', obj.ID, obj, 'first');
  268. $(".unwritten").hide();
  269. }
  270. });
  271. }
  272. });
  273. };
  274. function submitForm() {
  275. debugger;
  276. var AllLotNoNum = 0;
  277. var Code = $("#txt_Code").val();//工单号
  278. var Details = [];
  279. var myDate = new Date();
  280. var year = myDate.getFullYear(); //获取当前年
  281. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  282. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  283. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  284. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  285. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  286. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  287. var gridList3 = $("#gridList3");
  288. var rowIds = gridList3.getDataIDs();
  289. if (rowIds.length > 0) {
  290. for (var i = 0; i < rowIds.length; i++) {
  291. var RowData = gridList3.getRowData(rowIds[i]);
  292. if (RowData.CurrentQuantity == 0) {
  293. $.modalAlert("条码" + RowData.LotNo + "未输入本次发货数量,请确认!", 'warning');
  294. return;
  295. }
  296. if (RowData.CurrentQuantity > RowData.Quantity) {
  297. $.modalAlert("条码" + RowData.LotNo + "所输入本次发货数量大于条码剩余数量,请确认!", 'warning');
  298. return;
  299. }
  300. AllLotNoNum = AllLotNoNum + Number(RowData.CurrentQuantity);
  301. var obj = {
  302. LotNo: RowData.LotNo,
  303. CurrentQuantity: RowData.CurrentQuantity,
  304. CurrentAmount: RowData.Amount
  305. };
  306. Details.push(obj);
  307. }
  308. var ICSASNs = {
  309. WorkPoint: WorkPoint,
  310. TransSequence: TransSequence,
  311. User: User,
  312. TransCode: Code,
  313. Amount: Amounts,
  314. Quantity: AllLotNoNum,
  315. TransType: "销售发货-销售发货单",
  316. MTime: date,
  317. Detail: Details,
  318. }
  319. var ICSASN = [];
  320. ICSASN.push(ICSASNs);
  321. $.modalConfirm("请确认是否出库!", function (r) {
  322. $.submitForm({
  323. url: "/OMAY/OMAYSalesDelivery/SaveSalesDelivery?" + Math.random(),
  324. param: { ICSASN: JSON.stringify(ICSASN) },
  325. success: function () {
  326. $("#gridList3").jqGrid("clearGridData");
  327. gridList2(MODetailIDs);
  328. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  329. }
  330. })
  331. })
  332. } else {
  333. $.modalAlert("请扫入条码!", 'warning');
  334. return;
  335. }
  336. };
  337. </script>
  338. <div class="topPanel" style="height:100px">
  339. <div class="toolbar">
  340. <div class="btn-group">
  341. <a id="NF-Submit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="submitForm()"><i class="fa fa-pencil-square-o"></i>确定发货</a>
  342. </div>
  343. @*<script>$('.toolbar').authorizeButton()</script>*@
  344. </div>
  345. <div class="search">
  346. <table>
  347. <tr>
  348. <td>
  349. <label>工单号:</label>
  350. </td>
  351. <td>
  352. <div class="input-group">
  353. <input id="txt_Code" type="text" class="form-control" placeholder="工单号" style="width: 120px;">
  354. </div>
  355. </td>
  356. <td>
  357. <a id="Search" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="SeachMO()"><i class="fa fa-pencil-square-o"></i>查询</a>
  358. </td>
  359. <td style="width:20px"></td>
  360. <td>
  361. <label>条码:</label>
  362. </td>
  363. <td>
  364. <div class="input-group">
  365. <input id="LotNo" type="text" class="form-control" placeholder="条码" style="width: 500px;" οnkeydοwn="LotNoBinding()">
  366. </div>
  367. </td>
  368. </tr>
  369. <tr>
  370. <td>
  371. <label>客户代码:&nbsp;&nbsp;</label>
  372. </td>
  373. <td>
  374. <div class="input-group">
  375. <input id="txt_CusCode" type="text" class="form-control" disabled="disabled" placeholder="客户代码" style="width: 120px;">
  376. </div>
  377. </td>
  378. <td>
  379. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客户名称:&nbsp;&nbsp;</label>
  380. </td>
  381. <td>
  382. <div class="input-group">
  383. <input id="txt_CusName" type="text" class="form-control" disabled="disabled" placeholder="客户名称" style="width: 220px;">
  384. </div>
  385. </td>
  386. <td>
  387. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;经办人:&nbsp;&nbsp;</label>
  388. </td>
  389. <td>
  390. <div class="input-group">
  391. <input id="txt_CreatePerson" type="text" class="form-control" disabled="disabled" placeholder="经办人" style="width: 120px;">
  392. </div>
  393. </td>
  394. </tr>
  395. </table>
  396. </div>
  397. </div>
  398. <div class="gridPanel" id="gridPanel" style="width:99%;height:20%">
  399. <span><strong>行信息</strong></span>
  400. <table id="gridList"></table>
  401. </div>
  402. @*<div class="gridPanel" id="gridPanel2" style="width:99%;height:28%">
  403. <span><strong>子件信息</strong></span>
  404. <table id="gridList2"></table>
  405. </div>*@
  406. <div class="gridPanel" id="gridPanel3" style="width:99%;height:28%">
  407. <span><strong>条码明细</strong></span>
  408. <table id="gridList3"></table>
  409. </div>