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.

494 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
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. 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. }
  193. function GridList2Click(ID, Sequence) {
  194. $("#gridList2").find("td").css("background-color", "");
  195. $("#" + ID).find("td").css("background-color", "yellow");
  196. ZSequence = Sequence;
  197. $("#gridList3").jqGrid("clearGridData");
  198. gridList3();
  199. }
  200. function btnDelete(cellvalue, options, rowObject) {
  201. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"Delete('" + rowObject.ID + "')\">删除</a>";
  202. }
  203. function Delete(ID) {
  204. $("#gridList3").delRowData(ID);
  205. }
  206. function SeachMO() {
  207. $.modalOpen({
  208. id: "SeachMO",
  209. title: "工单",
  210. url: "/OMAY/OMAYMoOutbound/SeachMoInfo" + "?" + Math.random(),
  211. width: "500px",
  212. height: "600px",
  213. callBack: function (iframeId) {
  214. var obj = top.frames[iframeId].submitForm();
  215. $("#txt_Code").val(obj.MOCode);
  216. $("#gridList").jqGrid("clearGridData");
  217. $("#gridList2").jqGrid("clearGridData");
  218. $("#gridList3").jqGrid("clearGridData");
  219. gridList();
  220. $(".unwritten").hide();
  221. top.frames[iframeId].Close();
  222. }
  223. });
  224. }
  225. function LotNoBinding() {
  226. //if (count!=0) {
  227. // if (ZSequence == '') {
  228. // $.modalAlert("请先选择工单子件!", "warning");
  229. // return;
  230. // }
  231. //}
  232. //count = count + 1;
  233. var Msg = '';
  234. $("#LotNo").keydown(function (e) {
  235. var curKey = e.which;rowIds
  236. debugger;
  237. if (curKey == 13) {
  238. var Code = $("#txt_Code").val();//工单号
  239. var LotNos = $("#LotNo").val();//条码号
  240. var LotNo = LotNos.replace(/\s+/g, '');
  241. if (LotNo=='') {
  242. $.modalAlert("扫入的条码异常,请重新扫入!", "warning");
  243. return;
  244. }
  245. var gridList3 = $("#gridList3");
  246. var rowIds = gridList3.getDataIDs();
  247. if (rowIds.length > 0) {
  248. for (var i = 0; i < rowIds.length; i++) {
  249. var RowData = gridList3.getRowData(rowIds[i]);
  250. if (RowData.LotNo == LotNo) {
  251. $.modalAlert("条码" + LotNo + "重复扫入,请确认!", "warning");
  252. return;
  253. }
  254. }
  255. }
  256. var TransType = '生产退料-生产退料单';
  257. WorkPoint
  258. var keyValue = {
  259. TransCode: Code,
  260. TransSequence: TransSequence,
  261. Code: LotNo,
  262. TransType: TransType,
  263. WorkPoint: WorkPoint,
  264. User: User,
  265. }
  266. $.ajax({
  267. url: "/OMAY/OMAYMoOutbound/GetLotNotInfo" + "?" + Math.random(),
  268. data: { keyValue: JSON.stringify(keyValue) },
  269. dataType: "json",
  270. async: false,
  271. success: function (data) {
  272. debugger;
  273. if (data == "" || data == null) {
  274. $.modalAlertNew("WMS00022");
  275. return;
  276. }
  277. //Msg = data.msg;
  278. if (data.msg!="") {
  279. $.modalAlert(data.msg);
  280. return;
  281. }
  282. var cQuantity = data.dt[0].Quantity;
  283. if (data.dt[0].AmountEnable == true) {
  284. cQuantity = data.dt[0].Amount;
  285. }
  286. //最后一行新增数据
  287. var obj = {
  288. ID: data.dt[0].ID,
  289. LotNo: data.dt[0].LotNo,
  290. InvCode: data.dt[0].InvCode,
  291. InvName: data.dt[0].InvName,
  292. InvStd: data.dt[0].InvStd,
  293. InvUnit: data.dt[0].InvUnit,
  294. ProductDate: data.dt[0].ProductDate,
  295. Quantity: data.dt[0].Quantity,
  296. CurrentQuantity: cQuantity,
  297. ProjectCode: data.dt[0].ProjectCode,
  298. BatchCode: data.dt[0].BatchCode,
  299. Version: data.dt[0].Version,
  300. Brand: data.dt[0].Brand,
  301. cFree1: data.dt[0].cFree1,
  302. cFree2: data.dt[0].cFree2,
  303. cFree3: data.dt[0].cFree3,
  304. cFree4: data.dt[0].cFree4,
  305. cFree5: data.dt[0].cFree5,
  306. cFree6: data.dt[0].cFree6,
  307. cFree7: data.dt[0].cFree7,
  308. cFree8: data.dt[0].cFree8,
  309. cFree9: data.dt[0].cFree9,
  310. cFree10: data.dt[0].cFree10,
  311. LogID: data.dt[0].LogID,
  312. QTY: cQuantity
  313. };
  314. $("#gridList3").jqGrid('addRowData', obj.ID, obj, 'first');
  315. $(".unwritten").hide();
  316. }
  317. });
  318. var LotNo = $("#LotNo");
  319. LotNo.select();
  320. }
  321. });
  322. };
  323. function submitForm() {
  324. debugger;
  325. var AllLotNoNum = 0;
  326. var Code = $("#txt_Code").val();//工单号
  327. var Details = [];
  328. var myDate = new Date();
  329. var year = myDate.getFullYear(); //获取当前年
  330. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  331. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  332. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  333. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  334. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  335. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  336. var gridList3 = $("#gridList3");
  337. var rowIds = gridList3.getDataIDs();
  338. if (rowIds.length > 0) {
  339. for (var i = 0; i < rowIds.length; i++) {
  340. var RowData = gridList3.getRowData(rowIds[i]);
  341. if (RowData.CurrentQuantity == 0 || RowData.CurrentQuantity == '') {
  342. $.modalAlert("条码" + RowData.LotNo + "未输入本次退料数量,请确认!", "warning");
  343. // $.modalAlert("条码" + RowData.LotNo + "未输入本次退料数量,请确认!", "warning");
  344. return;
  345. }
  346. if (Number(RowData.CurrentQuantity) > Number(RowData.QTY)) {
  347. $.modalAlert("条码" + RowData.LotNo + "所输入本次退料数量大于条码剩余数量,请确认!", "warning");
  348. return;
  349. }
  350. AllLotNoNum = AllLotNoNum + Number(RowData.CurrentQuantity);
  351. var obj = {
  352. LotNo: RowData.LotNo,
  353. Quantity: RowData.CurrentQuantity,
  354. TransSequence: TransSequence,
  355. TransCode: Code,
  356. LogID: RowData.LogID
  357. };
  358. Details.push(obj);
  359. }
  360. var ICSASNs = {
  361. WorkPoint: WorkPoint,
  362. User: User,
  363. Amount: Amounts,
  364. Quantity: AllLotNoNum,
  365. TransType: "生产退料-生产退料单",
  366. MTime: date,
  367. Detail: Details,
  368. }
  369. var ICSASN = [];
  370. ICSASN.push(ICSASNs);
  371. $.modalConfirm("请确认是否回仓!", function (r) {
  372. if (r) {
  373. $.submitForm({
  374. url: "/OMAY/ICSInvCodeHC/BindingICSInvCodeHC?" + Math.random(),
  375. param: { ICSASN: JSON.stringify(ICSASN) },
  376. success: function () {
  377. $("#gridList3").jqGrid("clearGridData");
  378. gridList2(MODetailIDs);
  379. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  380. }
  381. })
  382. }
  383. })
  384. } else {
  385. $.modalAlert("请扫入条码!", "warning");
  386. return;
  387. }
  388. };
  389. </script>
  390. <div class="topPanel" style="height:50px">
  391. <div class="toolbar">
  392. <div class="btn-group">
  393. <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>
  394. </div>
  395. @*<script>$('.toolbar').authorizeButton()</script>*@
  396. </div>
  397. <div class="search">
  398. <table>
  399. <tr>
  400. <td>
  401. <label>工单号:</label>
  402. </td>
  403. <td>
  404. <div class="input-group">
  405. <input id="txt_Code" type="text" class="form-control" placeholder="工单号" style="width: 120px;">
  406. </div>
  407. </td>
  408. <td>
  409. <a id="Search" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="SeachMO()"><i class="fa fa-pencil-square-o"></i>查询</a>
  410. </td>
  411. <td style="width:20px"></td>
  412. <td>
  413. <label>条码:</label>
  414. </td>
  415. <td>
  416. <div class="input-group">
  417. <input id="LotNo" type="text" class="form-control" placeholder="条码" style="width: 500px;" οnkeydοwn="LotNoBinding()">
  418. </div>
  419. </td>
  420. </tr>
  421. <tr></tr>
  422. </table>
  423. </div>
  424. </div>
  425. <div class="gridPanel" id="gridPanel" style="width:99%;height:20%">
  426. <span><strong>工单信息</strong></span>
  427. <table id="gridList"></table>
  428. </div>
  429. <div class="gridPanel" id="gridPanel2" style="width:99%;height:28%">
  430. <span><strong>子件信息</strong></span>
  431. <table id="gridList2"></table>
  432. </div>
  433. <div class="gridPanel" id="gridPanel3" style="width:99%;height:28%">
  434. <span><strong>条码明细</strong></span>
  435. <table id="gridList3"></table>
  436. </div>