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.

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