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.

507 lines
20 KiB

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