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.

485 lines
19 KiB

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