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.

471 lines
18 KiB

1 year ago
1 year ago
  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. var cQuantity = data.dt[0].Quantity;
  241. if (data.dt[0].AmountEnable == true) {
  242. cQuantity = data.dt[0].Amount;
  243. }
  244. //最后一行新增数据
  245. var obj = {
  246. ID: data.dt[0].ID,
  247. LotNo: data.dt[0].LotNo,
  248. InvCode: data.dt[0].InvCode,
  249. InvName: data.dt[0].InvName,
  250. InvStd: data.dt[0].InvStd,
  251. InvUnit: data.dt[0].InvUnit,
  252. ProductDate: data.dt[0].ProductDate,
  253. Quantity: data.dt[0].Quantity,
  254. CurrentQuantity: cQuantity,
  255. Amount: data.dt[0].Amount,
  256. ProjectCode: data.dt[0].ProjectCode,
  257. BatchCode: data.dt[0].BatchCode,
  258. Version: data.dt[0].Version,
  259. Brand: data.dt[0].Brand,
  260. cFree1: data.dt[0].cFree1,
  261. cFree2: data.dt[0].cFree2,
  262. cFree3: data.dt[0].cFree3,
  263. cFree4: data.dt[0].cFree4,
  264. cFree5: data.dt[0].cFree5,
  265. cFree6: data.dt[0].cFree6,
  266. cFree7: data.dt[0].cFree7,
  267. cFree8: data.dt[0].cFree8,
  268. cFree9: data.dt[0].cFree9,
  269. cFree10: data.dt[0].cFree10
  270. };
  271. $("#gridList3").jqGrid('addRowData', obj.ID, obj, 'first');
  272. $(".unwritten").hide();
  273. }
  274. });
  275. }
  276. var LotNo = $("#LotNo");
  277. LotNo.select();
  278. });
  279. };
  280. function submitForm() {
  281. debugger;
  282. var AllLotNoNum = 0;
  283. var Code = $("#txt_Code").val();//工单号
  284. var Details = [];
  285. var myDate = new Date();
  286. var year = myDate.getFullYear(); //获取当前年
  287. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  288. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  289. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  290. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  291. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  292. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  293. var gridList3 = $("#gridList3");
  294. var rowIds = gridList3.getDataIDs();
  295. if (rowIds.length > 0) {
  296. for (var i = 0; i < rowIds.length; i++) {
  297. var RowData = gridList3.getRowData(rowIds[i]);
  298. if (RowData.CurrentQuantity == 0) {
  299. $.modalAlert("条码" + RowData.LotNo + "未输入本次发货数量,请确认!", 'warning');
  300. return;
  301. }
  302. if (RowData.CurrentQuantity > RowData.Quantity) {
  303. $.modalAlert("条码" + RowData.LotNo + "所输入本次发货数量大于条码剩余数量,请确认!", 'warning');
  304. return;
  305. }
  306. AllLotNoNum = AllLotNoNum + Number(RowData.CurrentQuantity);
  307. var obj = {
  308. LotNo: RowData.LotNo,
  309. CurrentQuantity: RowData.CurrentQuantity,
  310. CurrentAmount: RowData.Amount
  311. };
  312. Details.push(obj);
  313. }
  314. var ICSASNs = {
  315. WorkPoint: WorkPoint,
  316. TransSequence: TransSequence,
  317. User: User,
  318. TransCode: Code,
  319. Amount: Amounts,
  320. Quantity: AllLotNoNum,
  321. TransType: "销售发货-销售发货单",
  322. MTime: date,
  323. Detail: Details,
  324. }
  325. var ICSASN = [];
  326. ICSASN.push(ICSASNs);
  327. $.modalConfirm("请确认是否出库!", function (r) {
  328. $.submitForm({
  329. url: "/OMAY/OMAYSalesDelivery/SaveSalesDelivery?" + Math.random(),
  330. param: { ICSASN: JSON.stringify(ICSASN) },
  331. success: function () {
  332. $("#gridList3").jqGrid("clearGridData");
  333. //gridList2(MODetailIDs);
  334. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  335. }
  336. })
  337. })
  338. } else {
  339. $.modalAlert("请扫入条码!", 'warning');
  340. return;
  341. }
  342. };
  343. </script>
  344. <div class="topPanel" style="height:100px">
  345. <div class="toolbar">
  346. <div class="btn-group">
  347. <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>
  348. </div>
  349. @*<script>$('.toolbar').authorizeButton()</script>*@
  350. </div>
  351. <div class="search">
  352. <table>
  353. <tr>
  354. <td>
  355. <label>工单号:</label>
  356. </td>
  357. <td>
  358. <div class="input-group">
  359. <input id="txt_Code" type="text" class="form-control" placeholder="工单号" style="width: 120px;">
  360. </div>
  361. </td>
  362. <td>
  363. <a id="Search" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="SeachMO()"><i class="fa fa-pencil-square-o"></i>查询</a>
  364. </td>
  365. <td style="width:20px"></td>
  366. <td>
  367. <label>条码:</label>
  368. </td>
  369. <td>
  370. <div class="input-group">
  371. <input id="LotNo" type="text" class="form-control" placeholder="条码" style="width: 500px;" οnkeydοwn="LotNoBinding()">
  372. </div>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td>
  377. <label>客户代码:&nbsp;&nbsp;</label>
  378. </td>
  379. <td>
  380. <div class="input-group">
  381. <input id="txt_CusCode" type="text" class="form-control" disabled="disabled" placeholder="客户代码" style="width: 120px;">
  382. </div>
  383. </td>
  384. <td>
  385. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客户名称:&nbsp;&nbsp;</label>
  386. </td>
  387. <td>
  388. <div class="input-group">
  389. <input id="txt_CusName" type="text" class="form-control" disabled="disabled" placeholder="客户名称" style="width: 220px;">
  390. </div>
  391. </td>
  392. <td>
  393. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;经办人:&nbsp;&nbsp;</label>
  394. </td>
  395. <td>
  396. <div class="input-group">
  397. <input id="txt_CreatePerson" type="text" class="form-control" disabled="disabled" placeholder="经办人" style="width: 120px;">
  398. </div>
  399. </td>
  400. </tr>
  401. </table>
  402. </div>
  403. </div>
  404. <div class="gridPanel" id="gridPanel" style="width:99%;height:20%">
  405. <span><strong>行信息</strong></span>
  406. <table id="gridList"></table>
  407. </div>
  408. @*<div class="gridPanel" id="gridPanel2" style="width:99%;height:28%">
  409. <span><strong>子件信息</strong></span>
  410. <table id="gridList2"></table>
  411. </div>*@
  412. <div class="gridPanel" id="gridPanel3" style="width:99%;height:28%">
  413. <span><strong>条码明细</strong></span>
  414. <table id="gridList3"></table>
  415. </div>