var curRow, curCol, loading = null, import_dialog = null, SYSTEM = parent.SYSTEM, tempAssistPropGroupInfo = {}, queryConditions = { goods: "", showZero: 0, isSerNum: 0 }, qtyPlaces = Number(parent.SYSTEM.qtyPlaces), pricePlaces = Number(parent.SYSTEM.pricePlaces), amountPlaces = Number(parent.SYSTEM.amountPlaces), THISPAGE = { init: function(a) { this.initDom(a), this.addEvent(), this.loadGrid([]), $(".ui-jqgrid-bdiv").addClass("no-query") }, initDom: function() { this.$_storage = $("#storage"), this.$_category = $("#category"), this.$_goods = $("#goods"), this.$_note = $("#note"), this.chkField = $("#chkField").cssCheckbox(), this.storageCombo = $("#storage").combo({ data: function() { return parent.SYSTEM.storageInfo }, text: "name", value: "id", width: 120, defaultSelected: 0, addOptions: { text: "所有仓库", value: -1 }, cache: !1 }).getCombo(), this.categoryTree = Public.categoryTree(this.$_category, { rootTxt: "所有类别", width: 200 }), 1 != SYSTEM.ISSERNUM && $("#chkField").find("label:eq(1)").hide() }, loadGrid: function(a) { $("#grid").jqGrid("GridUnload"); var b = $(window).height() - $(".grid-wrap").offset().top - 124; $("#grid").jqGrid({ data: a, mtype: "GET", autowidth: !0, height: b, rownumbers: !0, altRows: !0, gridview: !0, colModel: [{ name: "locationId", label: "仓库ID", width: 0, hidden: !0 }, { name: "locationName", label: "仓库", width: 100 }, { name: "assistName", label: "商品类别", width: 100 }, { name: "invId", label: "商品ID", width: 0, hidden: !0 }, { name: "invNumber", label: "商品编号", width: 100 }, { name: "invName", label: "商品名称", width: 200, classes: "ui-ellipsis" }, { name: "skuId", label: "属性ID", hidden: !0 }, { name: "skuName", label: "属性", width: 100, classes: "ui-ellipsis", hidden: !SYSTEM.enableAssistingProp, formatter: function(a, b, c) { if (!a && c.skuId) { if (tempAssistPropGroupInfo[c.skuId]) return tempAssistPropGroupInfo[c.skuId].skuName; for (var d = 0, e = parent.SYSTEM.assistPropGroupInfo.length; e > d; d++) { var f = SYSTEM.assistPropGroupInfo[d]; if (tempAssistPropGroupInfo[f.skuId] = f, f.skuId == c.skuId) return f.skuName } } return a || " " } }, { name: "invSpec", label: "规格型号", width: 100 }, { name: "unitId", label: "单位ID", width: 0, hidden: !0 }, { name: "unitName", label: "单位", width: 50 }, { name: "qty", label: "系统库存", width: 100, align: "right", formatter: "number", formatoptions: { decimalPlaces: qtyPlaces } }, { name: "checkInventory", label: "盘点库存", width: 100, title: !1, align: "right", editable: !0, formatter: "number", formatoptions: { decimalPlaces: qtyPlaces } }, { name: "change", label: "盘盈盘亏", width: 100, align: "right", formatter: "number", formatoptions: { decimalPlaces: qtyPlaces } }], cmTemplate: { sortable: !1 }, sortname: "number", sortorder: "desc", pager: "#page", rowNum: 20, rowList: [100, 200, 500], viewrecords: !0, shrinkToFit: !1, forceFit: !1, cellEdit: !0, triggerAdd: !1, cellsubmit: "clientArray", localReader: { root: "data.rows", records: "data.records", repeatitems: !1, total: "data.total", page: "data.page", id: "-1" }, jsonReader: { root: "data.rows", records: "data.records", repeatitems: !1, total: "data.total", page: "data.page", id: "-1" }, gridComplete: function() { $("tr#1").find("td:eq(11)").trigger("click") }, afterSaveCell: function(a, b, c, d, e) { if ("checkInventory" == b) { var f = $("#grid").jqGrid("getCell", a, e - 1); if (!isNaN(parseFloat(f))) { $("#" + a).find("td:eq(-1)").removeClass("red"); var g = parseFloat(c) - parseFloat(f); 0 > g ? $("#grid").jqGrid("setCell", a, "change", g, "red") : $("#grid").jqGrid("setCell", a, "change", g) } } }, loadError: function() {} }) }, reloadData: function(a) { $("#grid").jqGrid("setGridParam", { url: "../scm/invOi/queryToPD?action=queryToPD", datatype: "json", postData: a, page: 1 }).trigger("reloadGrid") }, _getEntriesData: function() { null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null); for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) { var e, f = b[c], g = $("#grid").jqGrid("getRowData", f); e = { invId: g.invId, invNumber: g.invNumber, invName: g.invName, skuId: g.skuId || -1, skuName: g.skuName || "", invSpec: g.invSpec, locationId: g.locationId, locationName: g.locationName, unitId: g.unitId, mainUnit: g.unitName, invCost: g.invCost, qty: g.qty, checkInventory: g.checkInventory, change: g.change }, a.push(e) } return a }, manager: { _makeOutBound: function(a) { parent.tab.addTabItem({ tabid: "storage-otherOutbound", text: "其他出库", url: "../scm/invOi?action=initOi&type=out&cacheId=" + a }) }, _makeWarehouse: function(a) { parent.tab.addTabItem({ tabid: "storage-otherWarehouse", text: "其他入库", url: "../scm/invOi?action=initOi&type=in&cacheId=" + a }) }, makeOrder: function(a) { var b = this, c = {}, d = function(a) { var c = !0; "out" === a && b.$input_out.length ? b.$input_out.removeClass("ui-label-warning").addClass("ui-label-success") : b.$input_in.length && b.$input_in.removeClass("ui-label-warning").addClass("ui-label-success"), b.$input_in.length && !b.$input_in.hasClass("ui-label-success") && (c = !1), b.$input_out.length && !b.$input_out.hasClass("ui-label-success") && (c = !1), c && (b.pop.close(), $("#search").trigger("click")) }; if (a.items && a.items.length) for (var e = a.items.length - 1; e >= 0; e--)"OO" === a.items[e].billType ? c.outboundData = a.items[e] : c.warehouseData = a.items[e]; var f = (new Date).getTime() + ""; parent.Cache = parent.Cache || {}, parent.Cache[f] = { data: c, callback: d }; var g = "", h = ""; c.outboundData && (g = '