-
+
+
+
+
-
@@ -188,11 +291,20 @@
}
// 用于计算盘点结果
- function calculate(obj) {
+ function calculateForMaterial(obj) {
}
- function updateTableShow() {
+ // 用于计算盘点结果
+ function calculateForLocation(obj) {
+
+ }
+
+ function updateTableShowForMaterial() {
+
+ }
+
+ function updateTableShowForLocation() {
}
@@ -200,7 +312,8 @@
let depositoryId;
let placeId;
// 用于存储当前选择的负责人
- let departmentManagerId;
+ let departmentManagerIdForMaterial;
+ let departmentManagerIdForLocation;
layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () {
var $ = layui.$,
form = layui.form,
@@ -208,7 +321,8 @@
inputTag = layui.inputTag,
dropdown = layui.dropdown, //下拉菜单
step = layui.step;
- departmentManagerId = $("#departmentManagerId").val();
+ departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val();
+ departmentManagerIdForLocation = $("#departmentManagerIdForLocation").val();
// 用于分步表单加载
step.render({
@@ -223,36 +337,66 @@
}]
});
+ // 用于分步表单加载
+ step.render({
+ elem: '#stepForm1',
+ filter: 'stepForm',
+ width: '100%', //设置容器宽度
+ height: '900px',
+ stepItems: [{
+ title: '填写信息'
+ }, {
+ title: '提交成功'
+ }]
+ });
+
let tagData = [];
- let tempData = $("#departmentManager").val().split(",");
+ let tempData = $("#departmentManagerForMaterial").val().split(",");
$.each(tempData, function (index, item) {
if (item !== "") {
tagData.push(item)
}
});
- $("#departmentManager").val("");
+ $("#departmentManagerForMaterial").val("");
+ $("#departmentManagerForLocation").val("");
let tagLabel = inputTag.render({
- elem: '#departmentManager',
+ 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);
+ }
+ }
+ });
+
+
+ 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 = departmentManagerId.split(",");
+ let split = departmentManagerIdForLocation.split(",");
split.splice(index, 1);
- departmentManagerId = split.toString();
- $("#departmentManagerId").val(departmentManagerId);
+ departmentManagerIdForLocation = split.toString();
+ $("#departmentManagerIdForLocation").val(departmentManagerIdForLocation);
}
}
});
- updateTableShow = function () {
+ updateTableShowForMaterial = function () {
let req = {};
req.mid = $("#mid").val();
- table.reload('currentTableId', {
+ table.reload('currentTableForMaterial', {
url: '/material/findMaterialByConditionForStockTaking',
page: {
curr: 1
@@ -262,7 +406,7 @@
};
table.render({
- elem: "#currentTableId",
+ elem: "#currentTableForMaterial",
url: '/material/findMaterialByConditionForStockTaking',
parseData: function (res) { //res 即为原始返回的数据
return {
@@ -310,7 +454,7 @@
$.each(res['data'], function (i, j) {
let takingUnit = j["takingUnit"];
if (takingUnit !== null) {
- let parentItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")");
+ 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;
@@ -322,7 +466,7 @@
// 用于打开负责人树形菜单
- $("#selectdepartmentManager").on('click', function () {
+ $("#selectdepartmentManagerForMaterial").on('click', function () {
layer.open({
type: 2,
title: '弹窗内容',
@@ -334,7 +478,7 @@
fixed: false,
content: '/selectManager',
end: function () {
- departmentManagerId = $("#departmentManagerId").val();
+ departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val();
tagLabel.createItem();
},
success: function (layero, index) {
@@ -348,13 +492,44 @@
});
+ // 用于打开负责人树形菜单
+ $("#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',
+ 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%');
+ }
+ });
+ });
+
+
// 用于提交盘点情况
form.on('submit(formStep)', function (data) {
data = data.field;
data.depositoryId = depositoryId;
data.placeId = placeId;
- data.departmentManager = departmentManagerId;
-
+ let submitType = this.getAttribute("submitType");
+ if ("Material" === submitType) {
+ data.departmentManager = departmentManagerIdForMaterial;
+ } else if ("Location" === submitType) {
+ data.departmentManager = departmentManagerIdForLocation;
+ }
$.ajax({
url: "/stockTaking/submitStockTaking",
type: 'post',
@@ -393,14 +568,12 @@
});
- table.on('edit(currentTableFilter)', function (obj) {
+ table.on('edit(currentTableFilterForMaterial)', function (obj) {
obj.update({stockTakingQuantity: obj.value});//修改当前行数据
- calculate(obj);
+ calculateForMaterial(obj);
});
-
-
// 用于监听下拉菜单
- table.on('tool(currentTableFilter)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
+ table.on('tool(currentTableFilterForMaterial)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data //获得当前行数据
, layEvent = obj.event; //获得 lay-event 对应的值
if (layEvent === 'more') {
@@ -431,7 +604,7 @@
});
// 用于计算盘点结果
- calculate = function (obj) {
+ calculateForMaterial = function (obj) {
let oldInventory = Number(obj.tr[0].childNodes[7].childNodes[0].innerText);
let nowInventory = Number(obj.value);
let number = 0;
@@ -459,7 +632,7 @@
req.takingResultString = takingResultString;
req.id = obj.data.id + "";
req.unit = obj.tr[0].childNodes[6].childNodes[0].innerText;
- req.oldInventory = oldInventory+"";
+ req.oldInventory = oldInventory + "";
$.ajax({
url: "/stockTaking/temporaryStorageForTakingResult",
dataType: "json",
@@ -475,7 +648,7 @@
var data = obj.value;
var req = {};
data = data.split(",")[0];
- if(data !== ""){
+ if (data !== "") {
req.mname = data;
$.ajax({
url: "/material/findMaterialByCondition",
@@ -486,9 +659,9 @@
success: function (d) {
if (d.count > 1) {
layer.msg("请点击右侧搜索确定物品");
- $("#openSonByMaterial").val("");
- $("#mid").val("");
- $("#code").val("");
+ $("#openSonByMaterial").val("");
+ $("#mid").val("");
+ $("#code").val("");
return false;
} else if (d.count === 0) {
layer.msg("没有该物品,请确认输入是否正确");
@@ -502,7 +675,7 @@
$("#mid").val(material.mid);
$("#code").val(material.code);
form.render();
- updateTableShow();
+ updateTableShowForMaterial();
}
}
});
@@ -518,7 +691,7 @@
var req = {};
req.code = code;
req.type = "out";
- if(code !== ""){
+ if (code !== "") {
$.ajax({
url: "/material/findMatrialByCode",
type: "get",
@@ -528,21 +701,21 @@
success: function (d) {
var d = d.data;
if (d == null) {
- layer.msg("仓库中暂无该物料",{
- icon:0,
- time:1000
- },function () {
+ layer.msg("仓库中暂无该物料", {
+ icon: 0,
+ time: 1000
+ }, function () {
$("#openSonByMaterial").val("");
$("#mid").val("");
$("#code").val("");
- updateTableShow();
+ updateTableShowForMaterial();
});
} else {
$("#openSonByMaterial").val(d.mname);
$("#mid").val(d.mid);
- form.render();
- updateTableShow();
+ form.render();
+ updateTableShowForMaterial();
}
}
@@ -551,6 +724,256 @@
};
+
+ 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');
+ };
+
});
diff --git a/target/classes/templates/pages/stockTaking/stockTaking.html b/target/classes/templates/pages/stockTaking/stockTaking.html
index b2292994..afd9eaf9 100644
--- a/target/classes/templates/pages/stockTaking/stockTaking.html
+++ b/target/classes/templates/pages/stockTaking/stockTaking.html
@@ -46,108 +46,211 @@