diff --git a/src/main/resources/static/js/stockTaking/stockTakingForLocationCard.js b/src/main/resources/static/js/stockTaking/stockTakingForLocationCard.js
new file mode 100644
index 00000000..5c1e2322
--- /dev/null
+++ b/src/main/resources/static/js/stockTaking/stockTakingForLocationCard.js
@@ -0,0 +1,847 @@
+
+
+// 用于添加标签
+function addItem(obj) {
+}
+
+// 用于删除标签
+function deleteItem(obj) {
+}
+
+
+// 用于加载物料选择菜单
+function selectMaterialForLocation() {
+
+}
+
+// 用于通过物料名称获取物料
+function selectMaterialByNameForLocation() {
+
+}
+
+// 用于编码查询
+function selectCodeForLocation(obj) {
+}
+
+// 用于扫描物料编码
+function scanMaterialCodeForTaking() {
+
+}
+
+// 用于二次渲染页面
+function Coverpage() {
+
+}
+
+// 用于计算盘点结果
+function calculate(obj) {
+
+}
+
+// 用于监听下拉框变化
+function changeSelectValueForUnit(obj){
+
+}
+
+// 用于监听下拉框变化
+function changeSelectValueForProducedDate(obj){
+
+}
+
+// 用于暂存卡片个数
+let params = [];
+// 用于卡片编号
+var NewIdNumber = 1;
+
+
+let needToUpdate = {};
+layui.use(['form', 'step', 'flow', 'laydate', 'inputTag'], function () {
+ var $ = layui.$,
+ form = layui.form,
+ step = layui.step;
+
+
+ // 实现卡片添加
+ addItem = function (obj) {
+ // 获取父元素id
+ var parentId = obj.parentNode.id;
+ NewIdNumber = NewIdNumber + 1;
+ var materialItem = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `;
+ // 获取当前高度
+ var height = parseInt(($("#stepForm1").css('height')).split("px")[0]);
+ params.push(NewIdNumber);
+ // $("#form1").css("height", height + 682 + 'px');
+ $("#stepForm1").css("height", height + 625 + 'px');
+ $("#" + parentId).after(materialItem);
+ };
+
+ // 实现卡片删除
+ deleteItem = function (obj) {
+ // 获取父节点
+ var parent = obj.parentNode;
+ var parentId = parent.id;
+ parentId = parseInt(parentId.split("InventoryDetails")[1]);
+ // 获取祖父节点
+ var reparent = parent.parentNode;
+ var height = parseInt(($("#stepForm1").css('height')).split("px")[0]);
+ $("#stepForm1").css("height", height - 625 + 'px');
+ params = remove(params, parentId);
+ reparent.removeChild(parent);
+ };
+
+ //删除数组中指定元素
+ function remove(arr, item) {
+ var result = [];
+ for (let i = 0; i < arr.length; i++) {
+ if (arr[i] === item) {
+ continue;
+ }
+ result.push(arr[i]);
+ }
+ return result;
+ }
+
+
+
+ // 用于打开物料树形菜单
+ selectMaterialForLocation = function (obj) {
+ if (depositoryId !== undefined && departmentManagerIdForLocation !== undefined && departmentManagerIdForLocation !== "") {
+ var parent = obj.parentNode.parentNode.parentNode.parentNode;
+ var parentId = parent.id;
+ // 物料编码父级
+ var codeChildren = parent.childNodes[7];
+ // 物料名称父级
+ var materialChildren = parent.childNodes[5];
+ // 物料类型父级
+ var typeChildren = parent.childNodes[9];
+ // 材质父级
+ var textureChildren = parent.childNodes[11];
+ // 规格型号父级
+ var versionChildren = parent.childNodes[13];
+ // 计量单位父级
+ var unitChildren = parent.childNodes[15];
+ // 库存数量父级
+ var inventoryChildren = parent.childNodes[19];
+
+ // 编码条目
+ var codeItem = codeChildren.childNodes[3].childNodes[1];
+ // 具体条码
+ var codeValue = codeItem.childNodes[1];
+
+ // 物料条目
+ var materialItem = materialChildren.childNodes[3].childNodes;
+ // 物料名称
+ var materialName = materialItem[1].childNodes[1];
+ // 物料编码
+ var materialId = materialItem[3];
+ // 输入的物料名称
+ var mname = materialName.value;
+ // 物料种类条目
+ var materialTypeItem = typeChildren.childNodes[3].childNodes;
+
+ layer.open({
+ type: 2,
+ title: '弹窗内容',
+ skin: 'layui-layer-rim',
+ maxmin: true,
+ shadeClose: true, //点击遮罩关闭层
+ area: ['70%', '70%'],
+ move: '.layui-layer-title',
+ fixed: false,
+ content: '/getMaterialAll?mname=' + mname + '&type=3&clickObj=' + parentId + '&placeId=' + placeId + '&depositoryId=' + depositoryId,
+ success: function (layero, index) {
+ var children = layero.children();
+ var content = $(children[1]);
+ var iframeChildren = $(content.children());
+ content.css('height', '100%');
+ iframeChildren.css('height', '100%');
+ },
+ end: function () {
+ var mid = materialId.value;
+ if (mid !== '') {
+ $.ajax({
+ url: "/material/findInventoryByIdAndPid?mid=" + mid + "&pid=" + placeId,
+ type: "get",
+ dataType: 'json',
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var material = d.data.materialById;
+ var code = material.code;
+ if (code === undefined) {
+ code = "";
+ }
+ codeValue.value = code;
+ materialTypeItem[1].value = material.typeName;
+ materialTypeItem[3].value = material.typeId;
+ textureChildren.childNodes[3].childNodes[1].value = material.texture === null || material.texture === undefined ? '' : material.texture;
+ versionChildren.childNodes[3].childNodes[1].value = material.version === null || material.version === undefined ? '' : material.version;
+ inventoryChildren.childNodes[3].childNodes[1].value = material.quantity;
+ var materialAndBarCodeList = material.materialAndBarCodeList;
+ var idNumber = materialId.name.split("mid")[1];
+ let unitItem = $("#unit" + idNumber);
+ unitItem.empty();
+ unitItem.append(new Option(material.unit, "-1"));
+ let splitInfoList = material.splitInfoList;
+ if (splitInfoList.length > 0) {
+ $.each(splitInfoList, function (index, item) {
+ unitItem.append(new Option(item.newUnit, item.newUnit));
+ })
+ }
+ form.render();
+ var shelfLife = material.shelfLife;
+ if (shelfLife !== null && shelfLife !== undefined) {
+ $("#" + "producedDateItem" + idNumber).show();
+ var producedDateList = d.data['producedDateList'];
+ if (producedDateList !== null && producedDateList !== undefined && producedDateList.length > 0) {
+ $.each(producedDateList, function (index, item) {
+ $("#" + "producedDate" + idNumber).append(new Option(item, item));
+ })
+ }
+ form.render();
+ } else {
+ $("#" + "producedDateItem" + idNumber).hide();
+ form.render();
+ }
+
+ }
+ });
+ }
+ }
+ });
+ } else {
+ layer.msg("请先选择盘点位置或负责人", {
+ icon: 0,
+ time: 500
+ })
+ }
+ };
+
+
+ // 用于实现通过编码查询物料
+ selectCodeForLocation = function (obj) {
+ if (depositoryId !== undefined && departmentManagerIdForLocation !== undefined && departmentManagerIdForLocation !== "") {
+ // 输入code
+ var code = obj.value;
+ if(code.trim() !== ""){
+ var parent = obj.parentNode.parentNode.parentNode.parentNode;
+ // 物料编码父级
+ var codeChildren = parent.childNodes[7];
+ // 物料名称父级
+ var materialChildren = parent.childNodes[5];
+ // 物料类型父级
+ var typeChildren = parent.childNodes[9];
+ // 材质父级
+ var textureChildren = parent.childNodes[11];
+ // 规格型号父级
+ var versionChildren = parent.childNodes[13];
+ // 计量单位父级
+ var unitChildren = parent.childNodes[15];
+ // 库存数量父级
+ var inventoryChildren = parent.childNodes[19];
+
+ // 编码条目
+ var codeItem = codeChildren.childNodes[3].childNodes[1];
+ // 物料条目
+ var materialItem = materialChildren.childNodes[3].childNodes;
+ // 物料名称
+ var materialName = materialItem[1].childNodes[1];
+ // 物料编码
+ var materialId = materialItem[3];
+ // 物料种类条目
+ var materialTypeItem = typeChildren.childNodes[3].childNodes;
+ // 获取对应元素
+ var req = {};
+ req.code = code;
+ req.depositoryId = depositoryId;
+ req.placeId = placeId;
+ $.ajax({
+ url: "/material/findMatrialByCodeForTaking",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var d = d.data;
+ if (d == null) {
+ layer.msg("该位置暂未该物品,请确认是否输入正确");
+ materialName.value = "";
+ materialId.value = "";
+ obj.value = "";
+ materialTypeItem[1].value = "";
+ materialTypeItem[3].value = "";
+ textureChildren.childNodes[3].childNodes[1].value = "";
+ versionChildren.childNodes[3].childNodes[1].value = "";
+ unitChildren.childNodes[3].childNodes[1].value = "";
+ inventoryChildren.childNodes[3].childNodes[1].value = "";
+ } else {
+ materialName.value = d.mname;
+ materialId.value = d.id;
+ materialTypeItem[1].value = d.typeName;
+ materialTypeItem[3].value = d.typeId;
+ textureChildren.childNodes[3].childNodes[1].value = d.texture === null || d.texture === undefined ? '' : d.texture;
+ versionChildren.childNodes[3].childNodes[1].value = d.version === null || d.version === undefined ? '' : d.version;
+ inventoryChildren.childNodes[3].childNodes[1].value = d.quantity;
+ // 获取物料与条形码的对应关系
+ var materialAndBarCodeList = d["materialAndBarCodeList"];
+ var idNumber = materialId.name.split("mid")[1];
+ let unit = $("#unit" + idNumber);
+ unit.empty();
+ unit.append(new Option(d.baseUnit, "-1"));
+ if (d.splitInfoList !== null && d.splitInfoList.length > 0) {
+ $.each(d.splitInfoList, function (index, item) {
+ unit.append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素
+ });
+ form.render();
+ }
+ var producedDateItem = $("#producedDate" + idNumber);
+ if (producedDateItem.length > 0) {
+ producedDateItem.empty();
+ }
+ var shelfLife = d.shelfLife;
+ if (shelfLife !== null && shelfLife !== undefined) {
+ $("#" + "producedDateItem" + idNumber).show();
+ var producedDateList = d['producedDateList'];
+ if (producedDateList != null && producedDateList != undefined && producedDateList.length > 0) {
+ $.each(producedDateList, function (index, item) {
+ $("#" + "producedDate" + idNumber).append(new Option(item, item));
+ })
+ }
+ form.render();
+ } else {
+ $("#" + "producedDateItem" + idNumber).hide();
+ form.render();
+ }
+
+ }
+ }
+ });
+ }
+
+ } else {
+ layer.msg("请先选择盘点位置或负责人", {
+ icon: 0,
+ time: 500
+ },function () {
+ obj.value = "";
+ })
+ }
+ };
+
+
+ // 通过物料名称获取物料
+ selectMaterialByNameForLocation = function (obj) {
+ if (depositoryId !== undefined && departmentManagerIdForLocation !== undefined && departmentManagerIdForLocation !== "") {
+ // 如果已经选择盘点的位置
+
+ // 输入物料名称
+ var data = obj.value;
+
+ var parent = obj.parentNode.parentNode.parentNode.parentNode;
+ var parentId = parent.id;
+ // 物料编码父级
+ var codeChildren = parent.childNodes[7];
+ // 物料名称父级
+ var materialChildren = parent.childNodes[5];
+ // 物料类型父级
+ var typeChildren = parent.childNodes[9];
+ // 材质父级
+ var textureChildren = parent.childNodes[11];
+ // 规格型号父级
+ var versionChildren = parent.childNodes[13];
+ // 计量单位父级
+ var unitChildren = parent.childNodes[15];
+ // 库存数量父级
+ var inventoryChildren = parent.childNodes[19];
+
+
+ // 编码条目
+ var codeItem = codeChildren.childNodes[3].childNodes[1];
+ // 具体条码
+ var codeValue = codeItem.childNodes[1];
+
+ // 物料条目
+ var materialItem = materialChildren.childNodes[3].childNodes;
+ // 物料名称
+ var materialName = materialItem[1].childNodes[1];
+ // 物料编码
+ var materialId = materialItem[3];
+ // 物料种类条目
+ var materialTypeItem = typeChildren.childNodes[3].childNodes;
+
+ var req = {};
+ data = data.split(",")[0];
+ if(data !== ""){
+ req.mname = data;
+ req.depositoryId = depositoryId;
+ req.placeId = placeId;
+ $.ajax({
+ url: "/material/findMaterialForTaking",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ if (d.count > 1) {
+ layer.msg("请点击右侧搜索确定物品");
+ materialId.value = "";
+ codeValue.value = "";
+ textureChildren.childNodes[3].childNodes[1].value = "";
+ versionChildren.childNodes[3].childNodes[1].value = "";
+ unitChildren.childNodes[3].childNodes[1].value = "";
+ inventoryChildren.childNodes[3].childNodes[1].value = "";
+ return false;
+ } else if (d.count === 0) {
+ layer.msg("没有该物品,请确认输入是否正确");
+ materialId.value = "";
+ codeValue.value = "";
+ materialName.value = "";
+ materialTypeItem[1].value = '';
+ materialTypeItem[3].value = "";
+ textureChildren.childNodes[3].childNodes[1].value = "";
+ versionChildren.childNodes[3].childNodes[1].value = "";
+ unitChildren.childNodes[3].childNodes[1].value = "";
+ inventoryChildren.childNodes[3].childNodes[1].value = "";
+ return false;
+ } else {
+ var material = d.data;
+ materialName.value = material.mname;
+ materialId.value = material.id;
+ codeValue.value = material.code;
+ materialTypeItem[1].value = material.typeName;
+ materialTypeItem[3].value = material.typeId;
+ textureChildren.childNodes[3].childNodes[1].value = material.texture === null || material.texture === undefined ? '' : material.texture;
+ versionChildren.childNodes[3].childNodes[1].value = material.version === null || material.version === undefined ? '' : material.version;
+ inventoryChildren.childNodes[3].childNodes[1].value = material.baseUnitQuantity;
+ var idNumber = materialId.name.split("mid")[1];
+ // 获取物料与条形码的对应关系
+ let unitItem = $("#unit" + idNumber);
+ unitItem.empty();
+ unitItem.append(new Option(material.baseUnit, "-1"));
+ let splitInfoList = material.splitInfoList;
+ if (splitInfoList.length > 0) {
+ $.each(splitInfoList, function (index, item) {
+ unitItem.append(new Option(item.newUnit, item.newUnit));
+ })
+ }
+ var shelfLife = d.shelfLife;
+ if (shelfLife !== null && shelfLife !== undefined) {
+ $("#" + "producedDateItem" + idNumber).show();
+ var producedDateList = d['producedDateList'];
+ if (producedDateList !== null && producedDateList !== undefined && producedDateList.length > 0) {
+ $.each(producedDateList, function (index, item) {
+ $("#" + "producedDate" + idNumber).append(new Option(item, item));
+ })
+ }
+ form.render();
+ } else {
+ $("#" + "producedDateItem" + idNumber).hide();
+ form.render();
+ }
+ }
+ }
+ });
+ }
+
+ } else {
+ layer.msg("请先选择盘点位置或负责人", {
+ icon: 0,
+ time: 500
+ },function () {
+ obj.value = "";
+ })
+ }
+
+ };
+
+
+ // 用于二次渲染页面
+ Coverpage = function (num, obj) {
+
+ // 获取待添加父类
+ NewIdNumber = num;
+ if (num === 0) { // 如果是第一个
+ NewIdNumber = "";
+ }
+ var texture = obj.texture === null || obj.texture === undefined ? "" : obj.texture;
+ var version = obj.version === null || obj.version === undefined ? "" : obj.version;
+ var unit = obj.unit === null || obj.unit === undefined ? "" : obj.unit;
+ var materialItem = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `;
+ // 获取当前高度
+ var height = parseInt(($("#stepForm1").css('height')).split("px")[0]);
+ if (NewIdNumber !== "") {
+ params.push(NewIdNumber)
+ }
+ $("#stepForm1").css("height", height + 682 + 'px');
+ var oldIdNumber = NewIdNumber - 1;
+ if (oldIdNumber === 0) {
+ oldIdNumber = "";
+ }
+ $("#InventoryDetails" + oldIdNumber).after(materialItem);
+ };
+
+ // 用于扫描物料编码
+ scanMaterialCodeForTaking = function (obj) {
+ if (depositoryId !== undefined && departmentManagerIdForLocation !== undefined && departmentManagerIdForLocation !== "") {
+
+ parent.wx.scanQRCode({
+ desc: 'scanQRCode desc',
+ needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
+ scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
+ success: function (res) {
+ // 回调
+ var result = res.resultStr;//当needResult为1时返回处理结果
+ var req = {};
+ req.qrCode = result;
+ req.placeId = placeId;
+ req.depositoryId = depositoryId;
+ req.codeFlag = 2;
+ $.ajax({
+ url: "/material/qywxStockTakingScanQrCode",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var data = d.data;
+ if (data == null) {
+ layer.msg("对于编码:" + result + ",并未发现对应的物料", {
+ icon: 0,
+ time: 1000 //0.5秒关闭(如果不配置,默认是3秒)
+ }, function () {
+ })
+ } else {
+
+ var parent = obj.parentNode.parentNode.parentNode.parentNode;
+ var parentId = parent.id;
+ // 物料编码父级
+ var codeChildren = parent.childNodes[7];
+ // 物料名称父级
+ var materialChildren = parent.childNodes[5];
+
+ // 物料类型父级
+ var typeChildren = parent.childNodes[9];
+ // 材质父级
+ var textureChildren = parent.childNodes[11];
+ // 规格型号父级
+ var versionChildren = parent.childNodes[13];
+ // 计量单位父级
+ var unitChildren = parent.childNodes[15];
+ // 库存数量父级
+ var inventoryChildren = parent.childNodes[19];
+
+ // 编码条目
+ var codeItem = codeChildren.childNodes[3].childNodes[1];
+ // 具体条码
+ var codeValue = codeItem.childNodes[1];
+
+ // 物料条目
+ var materialItem = materialChildren.childNodes[3].childNodes;
+ // 物料名称
+ var materialName = materialItem[1].childNodes[1];
+ // 物料编码
+ var materialId = materialItem[3];
+ // 物料种类条目
+ var materialTypeItem = typeChildren.childNodes[3].childNodes;
+
+
+ materialName.value = data.mname;
+ materialId.value = data.id;
+
+ materialTypeItem[1].value = data.typeName;
+ materialTypeItem[3].value = data.typeId;
+ codeValue.value = data.code;
+ textureChildren.childNodes[3].childNodes[1].value = data.texture === null || data.texture === undefined ? '' : data.texture;
+ versionChildren.childNodes[3].childNodes[1].value = data.version === null || data.version === undefined ? '' : data.version;
+ unitChildren.childNodes[3].childNodes[1].value = data.unit === null || data.unit === undefined ? '' : data.unit;
+ inventoryChildren.childNodes[3].childNodes[1].value = data.quantity;
+ // 获取物料与条形码的对应关系
+ var idNumber = materialId.name.split("mid")[1];
+ var unitItem = $("#unit" + idNumber);
+ unitItem.empty();
+ unitItem.append(new Option(data.unit, "-1"));
+ let splitInfoList = data.splitInfoList;
+ if (splitInfoList.length > 0) {
+ $.each(splitInfoList, function (index, item) {
+ unitItem.append(new Option(item.newUnit, item.newUnit));
+ })
+ }
+ form.render();
+ var shelfLife = data.shelfLife;
+ if (shelfLife !== null && shelfLife !== undefined) {
+ $("#" + "producedDateItem" + idNumber).show();
+ var producedDateList = data['producedDateList'];
+ if (producedDateList !== null && producedDateList !== undefined && producedDateList.length > 0) {
+ $.each(producedDateList, function (index, item) {
+ $("#" + "producedDate" + idNumber).append(new Option(item, item));
+ })
+ }
+ form.render();
+ } else {
+ $("#" + "producedDateItem" + idNumber).hide();
+ form.render();
+ }
+ }
+ }
+ })
+ }
+ })
+
+ } else {
+ layer.msg("请先选择盘点位置或负责人", {
+ icon: 0,
+ time: 500
+ },function () {
+
+ })
+ }
+ };
+
+ // 用于计算盘点结果
+ calculate = function (obj) {
+ var parent = obj.parentNode.parentNode.parentNode;
+
+ var oldInventoryItem = parent.childNodes[19].childNodes[3].childNodes[1];
+ var nowInventoryItem = parent.childNodes[21].childNodes[3].childNodes[1];
+ var resultItem = parent.childNodes[23].childNodes[3].childNodes[1];
+ var InventoryItem = parent.childNodes[25].childNodes[3].childNodes[1];
+
+ var oldInventory = Number(oldInventoryItem.value);
+ var nowInventory = Number(nowInventoryItem.value);
+ $('#' + resultItem.id).empty();
+ if (oldInventory > nowInventory) {
+ // 如果盘点数目小于库存数目
+ $('#' + resultItem.id).append(new Option("盘亏", 'Inventory_down'));//往下拉菜单里添加元素
+ $("#" + InventoryItem.id).val(oldInventory - nowInventory);
+ } else if (oldInventory < nowInventory) {
+ // 如果盘点数目大于库存数目
+ $('#' + resultItem.id).append(new Option("盘盈", 'Inventory_up'));//往下拉菜单里添加元素
+ $("#" + InventoryItem.id).val(nowInventory - oldInventory);
+ } else {
+ // 如果盘点数目等于库存数目
+ $('#' + resultItem.id).append(new Option("正常", 'Inventory_normal'));//往下拉菜单里添加元素
+ $("#" + InventoryItem.id).val(nowInventory - oldInventory);
+ }
+ form.render();
+ };
+
+
+
+ changeSelectValueForProducedDate = function(obj){
+ let req = {};
+ var id = obj.id;
+ var idNumber = id.split('producedDate')[1]; // 得到当前id对应数字
+ req.mid = $("#" + "midForLocation" + idNumber).val();
+ req.producedDate = obj.value;
+ $.ajax({
+ url: "/material/findQuantityByProducedDate",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ $("#" + "oldInventory" + idNumber).val(d.data)
+ }
+ });
+ };
+
+
+});
\ No newline at end of file
diff --git a/src/main/resources/static/js/stockTaking/stockTakingForLocationTable.js b/src/main/resources/static/js/stockTaking/stockTakingForLocationTable.js
new file mode 100644
index 00000000..27a3b5e6
--- /dev/null
+++ b/src/main/resources/static/js/stockTaking/stockTakingForLocationTable.js
@@ -0,0 +1,335 @@
+
+// 用于扫描条形码或二维码
+function scanCode(obj) {
+}
+
+
+// 用于计算盘点结果
+function calculateForLocation(obj) {
+
+}
+
+
+function updateTableShowForLocation() {
+
+}
+
+
+layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () {
+ var $ = layui.$,
+ form = layui.form,
+ table = layui.table,
+ inputTag = layui.inputTag,
+ dropdown = layui.dropdown, //下拉菜单
+ step = layui.step;
+ departmentManagerIdForLocation = $("#departmentManagerIdForLocation").val();
+
+
+
+
+ let tagData = [];
+ let tempData = $("#departmentManagerForLocation").val().split(",");
+ $.each(tempData, function (index, item) {
+ if (item !== "") {
+ tagData.push(item)
+ }
+ });
+ $("#departmentManagerForLocation").val("");
+
+
+
+
+ let tagLabel1 = inputTag.render({
+ elem: '#departmentManagerForLocation',
+ data: tagData,//初始值
+ removeKeyNum: 8,//删除按键编号 默认,BackSpace 键
+ createKeyNum: 13,//创建按键编号 默认,Enter 键
+ onChange: function (data, value, type, index) {
+ if (type === "remove") {
+ let split = departmentManagerIdForLocation.split(",");
+ split.splice(index, 1);
+ departmentManagerIdForLocation = split.toString();
+ $("#departmentManagerIdForLocation").val(departmentManagerIdForLocation);
+ }
+ }
+ });
+
+ // 用于打开负责人树形菜单
+ $("#selectdepartmentManagerForLocation").on('click', function () {
+ layer.open({
+ type: 2,
+ title: '弹窗内容',
+ skin: 'layui-layer-rim',
+ maxmin: true,
+ shadeClose: true, //点击遮罩关闭层
+ area: ['70%', '70%'],
+ move: '.layui-layer-title',
+ fixed: false,
+ content: '/selectManager?type=Location',
+ end: function () {
+ departmentManagerIdForLocation = $("#departmentManagerIdForLocation").val();
+ tagLabel1.createItem();
+ },
+ success: function (layero, index) {
+ var children = layero.children();
+ var content = $(children[1]);
+ var iframeChildren = $(content.children());
+ content.css('height', '100%');
+ iframeChildren.css('height', '100%');
+ }
+ });
+ });
+
+
+ // 通过位置盘点物料页面
+ table.render({
+ elem: "#currentTableForLocation",
+ url: '/material/findInventoryForStockTaking',
+ parseData: function (res) { //res 即为原始返回的数据
+ return {
+ "status": res.status, //解析接口状态
+ "message": res.statusInfo.message, //解析提示文本
+ "count": res.count, //解析数据长度
+ "data": res.data //解析数据列表
+ };
+ },
+ request: {
+ pageName: 'page', //页码的参数名称,默认:page
+ limitName: 'size' //每页数据量的参数名,默认:limit
+ },
+ response: {
+ statusName: 'status' //规定数据状态的字段名称,默认:code
+ , statusCode: 200 //规定成功的状态码,默认:0
+ , msgName: 'message' //规定状态信息的字段名称,默认:msg
+ , countName: 'count' //规定数据总数的字段名称,默认:count
+ , dataName: 'data' //规定数据列表的字段名称,默认:data
+ },
+ where: {
+ depositoryId: "-1"
+ },
+ height: 'full-255',//固定高度-即固定表头固定第一行首行
+ cols: [
+ [
+ {field: 'mcode', width: 150, title: '存货编码', fixed: 'left'},
+ {field: 'mname', width: 150, title: '物料名称'},
+ {field: 'typeName', width: 100, title: '物料种类'},
+ {field: 'version', width: 150, title: '规格型号',},
+ {field: 'pcode', width: 150, title: '所处库位',},
+ {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
+ {field: 'inventory', width: 100, title: '库存数'},
+ {field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'},
+ {field: 'takingResultString', width: 100, title: '盘点结果'},
+ {field: 'takingInventory', width: 100, title: '盈亏数量'},
+ ]
+ ],
+ limits: [10, 15, 20, 25, 50, 100],
+ limit: 10,
+ page: true,
+ skin: 'line',
+ done: function (res, curr, count) {
+ $.each(res['data'], function (i, j) {
+ let takingUnit = j["takingUnit"];
+ if (takingUnit !== null) {
+ let parentItem = $("[lay-id='currentTableForLocation'] tr:eq(" + (i + 1) + ")");
+ let unitHandleItem = parentItem.children()[5];
+ let quantityHandleItem = parentItem.children()[6];
+ unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit;
+ quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit];
+ }
+ });
+ }
+ });
+
+
+ // 扫码盘点位置
+ scanCode = function () {
+ parent.wx.scanQRCode({
+ desc: 'scanQRCode desc',
+ needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
+ scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
+ success: function (res) {
+ // 回调
+ var result = res.resultStr;//当needResult为1时返回处理结果
+ var req = {};
+ req.qrCode = result;
+ req.codeFlag = 2;
+ $.ajax({
+ url: "/place/qywxApplicationInScanQrCode",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var data = d.data;
+ var flag = data["flag"];
+ if (flag === 0) {
+ // 如果没有获取到位置
+ layer.msg("并未查询到对应位置,请重新扫描", {
+ icon: 0,
+ time: 1000
+ }, function () {
+ depositoryId = -1;
+ placeId = -1;
+
+ });
+ } else if (flag === 1) {
+ // 如果获取到的是库位
+ var place = data["place"];
+ $("#placeId").val(place.id);
+ $("#openSonByDepository").val(place.depositoryName);
+ $("#depositoryId").val(place.did);
+
+ depositoryId = place.did;
+ placeId = place.id;
+ } else if (flag === 2) {
+ // 如果获取到的是仓库
+ var depository = data["depository"];
+ $("#placeId").val("0");
+ $("#openSonByDepository").val(depository.dname);
+ $("#depositoryId").val(depository.id);
+
+ depositoryId = depository.id;
+ placeId = "0";
+
+ }
+ updateTableShow();
+ }
+ })
+ }
+ })
+ };
+
+
+ table.on('edit(currentTableFilterForLocation)', function (obj) {
+ obj.update({stockTakingQuantity: obj.value});//修改当前行数据
+ calculateForLocation(obj);
+ });
+
+
+ // 用于监听下拉菜单
+ table.on('tool(currentTableFilterForLocation)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
+ var data = obj.data //获得当前行数据
+ , layEvent = obj.event; //获得 lay-event 对应的值
+ if (layEvent === 'more') {
+ let splitInfoList = obj.data.splitInfoList;
+ if (splitInfoList.length > 0) {
+ let dropDownDataList = [];
+ for (var i = 0; i < splitInfoList.length; i++) {
+ let dropDownData = {};
+ dropDownData.title = splitInfoList[i].newUnit;
+ dropDownData.id = obj.data.id;
+ dropDownDataList.push(dropDownData);
+ }
+ dropdown.render({
+ elem: this //触发事件的 DOM 对象
+ , show: true //外部事件触发即显示
+ , data: dropDownDataList
+ , click: function (unit) {
+ this.elem[0].childNodes[0].data = unit.title;
+ obj.tr[0].childNodes[6].childNodes[0].innerText = obj.data.splitInventory[unit.title];
+ }
+ , align: 'right' //右对齐弹出(v2.6.8 新增)
+ , style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
+ })
+ }
+ //下拉菜单
+
+ }
+ });
+
+ // 用于计算盘点结果
+ calculateForLocation = function (obj) {
+ let oldInventory = Number(obj.tr[0].childNodes[6].childNodes[0].innerText);
+ let nowInventory = Number(obj.value);
+ let number = 0;
+ let takingResult = '';
+ let takingResultString = '';
+ let req = {};
+ if ((oldInventory) > (nowInventory)) {
+ number = oldInventory - nowInventory;
+ takingResult = "Inventory_down";
+ takingResultString = "盘亏";
+ } else if ((oldInventory) < (nowInventory)) {
+ number = nowInventory - oldInventory;
+ takingResult = "Inventory_up";
+ takingResultString = "盘盈";
+ } else {
+ takingResult = "Inventory_normal";
+ takingResultString = "正常";
+ }
+ obj.tr[0].childNodes[8].childNodes[0].innerText = takingResultString;
+ obj.tr[0].childNodes[9].childNodes[0].innerText = number;
+ obj.update({takingResult: takingResult});
+ obj.update({takingInventory: number});
+ req.number = number + "";
+ req.takingResult = takingResult;
+ req.takingResultString = takingResultString;
+ req.id = obj.data.id + "";
+ req.unit = obj.tr[0].childNodes[5].childNodes[0].innerText;
+ req.oldInventory = oldInventory + "";
+ $.ajax({
+ url: "/stockTaking/temporaryStorageForTakingResult",
+ dataType: "json",
+ data: JSON.stringify(req),
+ type: "POST",
+ contentType: "application/json;charset=utf-8"
+ });
+ };
+
+
+ // 用于打开仓库树形菜单
+ $('#openSonByDepository').on('click', function () {
+ layer.open({
+ type: 2,
+ title: '弹窗内容',
+ skin: 'layui-layer-rim',
+ maxmin: true,
+ shadeClose: true, //点击遮罩关闭层
+ area: ['70%', '70%'],
+ move: '.layui-layer-title',
+ fixed: false,
+ content: '/selectDepository?type=2',
+ success: function (layero, index) {
+ var children = layero.children();
+ var content = $(children[1]);
+ var iframeChildren = $(content.children());
+ content.css('height', '100%');
+ iframeChildren.css('height', '100%');
+ },
+ end: function () {
+ var nowDepositoryId = $("#depositoryId").val();
+ var nowPlaceId = $("#placeId").val();
+ if (nowDepositoryId !== depositoryId || nowPlaceId !== placeId) {
+ // 如果重新选择盘点位置
+ var nowDepositoryName = $("#openSonByDepository").val();
+ $("#form1")[0].reset();
+ $("#depositoryId").val(nowDepositoryId);
+ $("#placeId").val(nowPlaceId);
+ $("#openSonByDepository").val(nowDepositoryName);
+ form.render();
+ }
+ if (nowDepositoryId !== null && nowDepositoryId !== "") {
+ depositoryId = nowDepositoryId;
+ placeId = nowPlaceId;
+ updateTableShowForLocation();
+ }
+
+ }
+ });
+ });
+
+
+ updateTableShowForLocation = function () {
+ let req = {};
+ req.depositoryId = depositoryId;
+ req.placeId = placeId;
+ table.reload('currentTableForLocation', {
+ url: '/material/findInventoryForStockTaking',
+ page: {
+ curr: 1
+ },
+ where: req
+ }, 'data');
+ };
+
+});
\ No newline at end of file
diff --git a/src/main/resources/static/js/stockTaking/stockTakingForMaterial.js b/src/main/resources/static/js/stockTaking/stockTakingForMaterial.js
new file mode 100644
index 00000000..df5d12b1
--- /dev/null
+++ b/src/main/resources/static/js/stockTaking/stockTakingForMaterial.js
@@ -0,0 +1,386 @@
+
+// 用于扫描条形码或二维码
+function scanCode(obj) {
+}
+
+// 用于加载物料选择菜单
+function selectMaterial() {
+
+}
+
+// 用于通过物料名称获取物料
+function selectMaterialByName() {
+
+}
+
+// 用于编码查询
+function selectCode(obj) {
+}
+
+
+// 用于扫描物料码
+function scanCodeForMaterial() {
+
+}
+
+// 用于计算盘点结果
+function calculateForMaterial(obj) {
+
+}
+
+
+function updateTableShowForMaterial() {
+
+}
+
+
+
+
+
+
+layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () {
+ var $ = layui.$,
+ form = layui.form,
+ table = layui.table,
+ inputTag = layui.inputTag,
+ dropdown = layui.dropdown, //下拉菜单
+ step = layui.step;
+ departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val();
+
+
+
+ let tagData = [];
+ let tempData = $("#departmentManagerForMaterial").val().split(",");
+ $.each(tempData, function (index, item) {
+ if (item !== "") {
+ tagData.push(item)
+ }
+ });
+ $("#departmentManagerForMaterial").val("");
+
+
+ let tagLabel = inputTag.render({
+ elem: '#departmentManagerForMaterial',
+ data: tagData,//初始值
+ removeKeyNum: 8,//删除按键编号 默认,BackSpace 键
+ createKeyNum: 13,//创建按键编号 默认,Enter 键
+ onChange: function (data, value, type, index) {
+ if (type === "remove") {
+ let split = departmentManagerIdForMaterial.split(",");
+ split.splice(index, 1);
+ departmentManagerIdForMaterial = split.toString();
+ $("#departmentManagerIdForMaterial").val(departmentManagerIdForMaterial);
+ }
+ }
+ });
+
+
+
+ updateTableShowForMaterial = function () {
+ let req = {};
+ req.mid = $("#mid").val();
+ table.reload('currentTableForMaterial', {
+ url: '/material/findMaterialByConditionForStockTaking',
+ page: {
+ curr: 1
+ },
+ where: req
+ }, 'data');
+ };
+
+ table.render({
+ elem: "#currentTableForMaterial",
+ url: '/material/findMaterialByConditionForStockTaking',
+ parseData: function (res) { //res 即为原始返回的数据
+ return {
+ "status": res.status, //解析接口状态
+ "message": res.statusInfo.message, //解析提示文本
+ "count": res.count, //解析数据长度
+ "data": res.data //解析数据列表
+ };
+ },
+ request: {
+ pageName: 'page', //页码的参数名称,默认:page
+ limitName: 'size' //每页数据量的参数名,默认:limit
+ },
+ response: {
+ statusName: 'status' //规定数据状态的字段名称,默认:code
+ , statusCode: 200 //规定成功的状态码,默认:0
+ , msgName: 'message' //规定状态信息的字段名称,默认:msg
+ , countName: 'count' //规定数据总数的字段名称,默认:count
+ , dataName: 'data' //规定数据列表的字段名称,默认:data
+ },
+ where: {
+ depositoryId: "-1"
+ },
+ height: 'full-255',//固定高度-即固定表头固定第一行首行
+ cols: [
+ [
+ {field: 'mcode', width: 100, title: '存货编码', fixed: 'left'},
+ {field: 'mname', width: 150, title: '物料名称'},
+ {field: 'version', width: 150, title: '规格型号',},
+ {field: 'tname', width: 120, title: '物料种类'},
+ {field: 'dname', width: 150, title: '所处仓库'},
+ {field: 'pcode', width: 150, title: '所处库位',},
+ {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
+ {field: 'inventory', width: 100, title: '库存数'},
+ {field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'},
+ {field: 'takingResultString', width: 100, title: '盘点结果'},
+ {field: 'takingInventory', width: 100, title: '盈亏数量'},
+ ]
+ ],
+ limits: [10, 15, 20, 25, 50, 100],
+ limit: 10,
+ page: true,
+ skin: 'line',
+ done: function (res, curr, count) {
+ $.each(res['data'], function (i, j) {
+ let takingUnit = j["takingUnit"];
+ if (takingUnit !== null) {
+ let parentItem = $("[lay-id='currentTableForMaterial'] tr:eq(" + (i + 1) + ")");
+ let unitHandleItem = parentItem.children()[6];
+ let quantityHandleItem = parentItem.children()[7];
+ unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit;
+ quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit];
+ }
+ });
+ }
+ });
+
+
+ // 用于打开负责人树形菜单
+ $("#selectdepartmentManagerForMaterial").on('click', function () {
+ layer.open({
+ type: 2,
+ title: '弹窗内容',
+ skin: 'layui-layer-rim',
+ maxmin: true,
+ shadeClose: true, //点击遮罩关闭层
+ area: ['70%', '70%'],
+ move: '.layui-layer-title',
+ fixed: false,
+ content: '/selectManager?type=Material',
+ end: function () {
+ departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val();
+ tagLabel.createItem();
+ },
+ success: function (layero, index) {
+ var children = layero.children();
+ var content = $(children[1]);
+ var iframeChildren = $(content.children());
+ content.css('height', '100%');
+ iframeChildren.css('height', '100%');
+ }
+ });
+ });
+
+
+
+
+ table.on('edit(currentTableFilterForMaterial)', function (obj) {
+ obj.update({stockTakingQuantity: obj.value});//修改当前行数据
+ calculateForMaterial(obj);
+ });
+ // 用于监听下拉菜单
+ table.on('tool(currentTableFilterForMaterial)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
+ var data = obj.data //获得当前行数据
+ , layEvent = obj.event; //获得 lay-event 对应的值
+ if (layEvent === 'more') {
+ let splitInfoList = obj.data.splitInfoList;
+ if (splitInfoList.length > 0) {
+ let dropDownDataList = [];
+ for (var i = 0; i < splitInfoList.length; i++) {
+ let dropDownData = {};
+ dropDownData.title = splitInfoList[i].newUnit;
+ dropDownData.id = obj.data.id;
+ dropDownDataList.push(dropDownData);
+ }
+ dropdown.render({
+ elem: this //触发事件的 DOM 对象
+ , show: true //外部事件触发即显示
+ , data: dropDownDataList
+ , click: function (unit) {
+ this.elem[0].childNodes[0].data = unit.title;
+ obj.tr[0].childNodes[7].childNodes[0].innerText = obj.data.splitInventory[unit.title];
+ }
+ , align: 'right' //右对齐弹出(v2.6.8 新增)
+ , style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
+ })
+ }
+ //下拉菜单
+
+ }
+ });
+
+ // 用于计算盘点结果
+ calculateForMaterial = function (obj) {
+ let oldInventory = Number(obj.tr[0].childNodes[7].childNodes[0].innerText);
+ let nowInventory = Number(obj.value);
+ let number = 0;
+ let takingResult = '';
+ let takingResultString = '';
+ let req = {};
+ if ((oldInventory) > (nowInventory)) {
+ number = oldInventory - nowInventory;
+ takingResult = "Inventory_down";
+ takingResultString = "盘亏";
+ } else if ((oldInventory) < (nowInventory)) {
+ number = nowInventory - oldInventory;
+ takingResult = "Inventory_up";
+ takingResultString = "盘盈";
+ } else {
+ takingResult = "Inventory_normal";
+ takingResultString = "正常";
+ }
+ obj.tr[0].childNodes[9].childNodes[0].innerText = takingResultString;
+ obj.tr[0].childNodes[10].childNodes[0].innerText = number;
+ obj.update({takingResult: takingResult});
+ obj.update({takingInventory: number});
+ req.number = number + "";
+ req.takingResult = takingResult;
+ req.takingResultString = takingResultString;
+ req.id = obj.data.id + "";
+ req.unit = obj.tr[0].childNodes[6].childNodes[0].innerText;
+ req.oldInventory = oldInventory + "";
+ $.ajax({
+ url: "/stockTaking/temporaryStorageForTakingResult",
+ dataType: "json",
+ data: JSON.stringify(req),
+ type: "POST",
+ contentType: "application/json;charset=utf-8"
+ });
+ };
+
+ // 用于通过物料名称获取物料
+ selectMaterialByName = function (obj) {
+ // 输入code
+ var data = obj.value;
+ var req = {};
+ data = data.split(",")[0];
+ if (data !== "") {
+ req.mname = data;
+ $.ajax({
+ url: "/material/findMaterialByCondition",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ if (d.count > 1) {
+ layer.msg("请点击右侧搜索确定物品");
+ $("#openSonByMaterial").val("");
+ $("#mid").val("");
+ $("#code").val("");
+ return false;
+ } else if (d.count === 0) {
+ layer.msg("没有该物品,请确认输入是否正确");
+ $("#openSonByMaterial").val("");
+ $("#mid").val("");
+ $("#code").val("");
+ return false;
+ } else {
+ var material = d.data[0];
+ $("#openSonByMaterial").val(material.mname);
+ $("#mid").val(material.mid);
+ $("#code").val(material.code);
+ form.render();
+ updateTableShowForMaterial();
+ }
+ }
+ });
+ }
+
+ };
+
+
+ // 用于实现通过编码查询物料
+ selectCode = function (obj) {
+ // 输入code
+ var code = obj.value;
+ var req = {};
+ req.code = code;
+ req.type = "out";
+ if (code !== "") {
+ $.ajax({
+ url: "/material/findMatrialByCode",
+ type: "get",
+ dataType: 'json',
+ data: (req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var d = d.data;
+ if (d == null) {
+ layer.msg("仓库中暂无该物料", {
+ icon: 0,
+ time: 1000
+ }, function () {
+ $("#openSonByMaterial").val("");
+ $("#mid").val("");
+ $("#code").val("");
+ updateTableShowForMaterial();
+ });
+
+ } else {
+ $("#openSonByMaterial").val(d.mname);
+ $("#mid").val(d.mid);
+ form.render();
+ updateTableShowForMaterial();
+
+ }
+ }
+ });
+ }
+
+ };
+
+
+ scanCodeForMaterial = function () {
+ let wxScan = parent;
+
+ if (wxScan.wx === undefined) {
+ wxScan = wxScan.parent.wx;
+ } else {
+ wxScan = wxScan.wx;
+ }
+ wxScan.scanQRCode({
+ desc: 'scanQRCode desc',
+ needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
+ scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
+ success: function (res) {
+ // 回调
+ var result = res.resultStr;//当needResult为1时返回处理结果
+ var req = {};
+ req.qrCode = result;
+ req.codeFlag = 2;
+ $.ajax({
+ url: "/material/qywxApplicationOutScanQrCode",
+ type: "post",
+ dataType: 'json',
+ data: JSON.stringify(req),
+ contentType: "application/json;charset=utf-8",
+ success: function (d) {
+ var data = d.data;
+ if (data === null) {
+ layer.msg("对于编码:" + result + ",并未发现仓库中存在对应的物料", {
+ icon: 0,
+ time: 1000 //0.5秒关闭(如果不配置,默认是3秒)
+ }, function () {
+ $("#openSonByMaterial").val("");
+ $("#mid").val("");
+ $("#code").val("");
+ updateTableShowForMaterial();
+ })
+ } else {
+ $("#openSonByMaterial").val(data.mname);
+ $("#mid").val(data.id);
+ $("#code").val(data.code);
+ updateTableShowForMaterial();
+ }
+ }
+ })
+ }
+ })
+ };
+
+
+});
diff --git a/src/main/resources/templates/pages/stockTaking/stockTaking.html b/src/main/resources/templates/pages/stockTaking/stockTaking.html
index 31fe5587..3fd9a730 100644
--- a/src/main/resources/templates/pages/stockTaking/stockTaking.html
+++ b/src/main/resources/templates/pages/stockTaking/stockTaking.html
@@ -34,7 +34,12 @@
.layui-form-select {
width: 100%;
- border-style: none;
+ height: 38px;
+ line-height: 1.3;
+ border-width: 1px;
+ border-style: solid;
+ background-color: #fff;
+
}
.lay-step {
@@ -55,7 +60,6 @@