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.

495 lines
20 KiB

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