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.

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