Browse Source

修改移动端库存盘点页面

lwx_dev
erdanergou 3 years ago
parent
commit
43646c2f6d
  1. 284
      src/main/resources/static/js/stockTaking/stockTakingForLocation_mobile.js
  2. 4
      src/main/resources/static/js/stockTaking/stockTakingForMaterial_mobile.js
  3. 2
      src/main/resources/templates/pages/showInventory/showInventoryForLocation.html
  4. 2
      src/main/resources/templates/pages/showInventory/showInventoryForMaterial.html
  5. 192
      src/main/resources/templates/pages/stockTaking/stockTaking_mobile.html
  6. 2
      target/classes/templates/pages/showInventory/showInventoryForLocation.html

284
src/main/resources/static/js/stockTaking/stockTakingForLocation_mobile.js

@ -0,0 +1,284 @@
// 用于扫描条形码或二维码
function scanCode(obj) {
}
// 用于计算盘点结果
function calculateForLocation(obj) {
}
function updateFlowShowForLocation() {
}
layui.use(['form', 'step', 'flow', 'inputTag'], function () {
var $ = layui.$,
form = layui.form,
flow = layui.flow,
inputTag = layui.inputTag,
dropdown = layui.dropdown, //下拉菜单
step = layui.step;
departmentManagerIdForLocation = $("#departmentManagerIdForLocation").val();
let takingPre = 0;
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%');
}
});
});
// 扫码盘点位置
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();
}
})
}
})
};
// 用于计算盘点结果
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;
updateFlowShowForLocation();
}
}
});
});
updateFlowShowForLocation = function () {
$("#LAY_FlowForLocation").empty();
takingPre = 0;
let req = {};
req.depositoryId = depositoryId;
req.placeId = placeId;
req.size = size;
flow.load({
elem: '#LAY_FlowForLocation' //流加载容器
, done: function (page, next) { //执行下一页的回调
let result;
let lis = [];
req.page = page;
$.ajax({
url: '/material/findInventoryForStockTaking',
data: req,
type: 'get',
dataType: 'json',
contentType: "application/json;charset=utf-8",
success: function (res) {
result = res.data;
lis.push("<div class='clearfix'>");
for (let i = 0; i < result.length; i++) {
let splitInventory = result[i].splitInventory;
let keys = Object.keys(splitInventory);
let InventoryItem = "";
for (let j = 0; j < keys.length; j++) {
let key = keys[j];
let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>';
InventoryItem += item;
}
let brandItem ='<p>' + "物料品牌:"+result[i].mbrand + '</p>';
if(result[i].mbrand === ""){
brandItem = "";
}
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" iid='+result[i].id+' pid='+result[i].pid+' onclick="showDetail(this)">' +
'<div class="layui-card-header"><h2>' + "物料名称:" + result[i].mname + '</h2></div>');
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">'
+'<p>' + "物料编码:" + result[i].mcode + '</p>'
+'<p>' + "物料型号:" + result[i].version + '</p>'
+ brandItem
+'<p>' + "所处库位:" + result[i].kingdeecode + '</p>'
+ InventoryItem
+ '</div></div></li>');
}
lis.push('</div>');
takingPre += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), takingPre < res.count);
}
});
}
});
};
});

4
src/main/resources/static/js/stockTaking/stockTakingForMaterial_mobile.js

@ -77,6 +77,8 @@ layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () {
updateFlowShowForMaterial = function () { updateFlowShowForMaterial = function () {
$("#LAY_FlowForMaterial").empty();
takingPre = 0;
let req = {}; let req = {};
req.mid = $("#mid").val(); req.mid = $("#mid").val();
req.size = size; req.size = size;
@ -101,7 +103,7 @@ layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () {
let InventoryItem = ""; let InventoryItem = "";
for (let j = 0; j < keys.length; j++) { for (let j = 0; j < keys.length; j++) {
let key = keys[j]; let key = keys[j];
let item = '<p>' + "计量单位:" + key + ";库存数量:" + splitInventory[key] + '</p>'; let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>';
InventoryItem += item; InventoryItem += item;
} }
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" iid='+result[i].id+' pid='+result[i].pid+' onclick="showDetail(this)">' + lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" iid='+result[i].id+' pid='+result[i].pid+' onclick="showDetail(this)">' +

2
src/main/resources/templates/pages/showInventory/showInventoryForLocation.html

@ -175,7 +175,7 @@
} }
for (let j = 0; j < keys.length; j++) { for (let j = 0; j < keys.length; j++) {
let key = keys[j]; let key = keys[j];
let item = '<p>' + "计量单位:" + key + ";库存数量:" + splitInventory[key] + '</p>'; let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>';
InventoryItem += item; InventoryItem += item;
} }
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "物料名称:" + result[i].mname + '</h2></div>'); lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "物料名称:" + result[i].mname + '</h2></div>');

2
src/main/resources/templates/pages/showInventory/showInventoryForMaterial.html

@ -179,7 +179,7 @@
let InventoryItem = ""; let InventoryItem = "";
for (let j = 0; j < keys.length; j++) { for (let j = 0; j < keys.length; j++) {
let key = keys[j]; let key = keys[j];
let item = '<p>' + "计量单位:" + key + ";库存数量:" + splitInventory[key] + '</p>'; let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>';
InventoryItem += item; InventoryItem += item;
} }
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "所处位置:" + result[i].dname+"-"+result[i].kingdeecode + '</h2></div>'); lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "所处位置:" + result[i].dname+"-"+result[i].kingdeecode + '</h2></div>');

192
src/main/resources/templates/pages/stockTaking/stockTaking_mobile.html

@ -243,188 +243,21 @@
</div> </div>
</form> </form>
<div class="layui-tab"> <div class="layui-tab">
<ul class="layui-tab-title" style="text-align: center">
<li class="layui-this">表格</li>
<li class="layui-this">卡片</li>
</ul>
<div class="layui-tab-content"> <div class="layui-tab-content">
<div class="layui-tab-item layui-show"> <ul class="flow-default" id="LAY_FlowForLocation"></ul>
<table class="layui-hide" lay-filter="currentTableFilterForLocation"
id="currentTableForLocation" <!-- 提交按钮-->
style="margin-top: 123px"></table> <div class="layui-form-item" style="margin-top: 10px;">
<!-- 提交按钮--> <div class="layui-input-block">
<div class="layui-form-item" style="margin-top: 10px;"> <button type="button"
<div class="layui-input-block"> class="layui-btn layui-btn-normal layui-btn-lg"
<button type="button" submitType="Location"
class="layui-btn layui-btn-normal layui-btn-lg" lay-submit
submitType="Location" lay-filter="formStep">
lay-submit &emsp;提交&emsp;
lay-filter="formStep"> </button>
&emsp;提交&emsp;
</button>
</div>
</div> </div>
</div> </div>
<div class="layui-tab-item">
<form class="layui-form" id="locationCard">
<fieldset class="table-search-fieldset">
<legend>盘点明细</legend>
<div class="layui-card-body" id="InventoryDetails"
style="padding-right: 0px">
<hr>
<i class="layui-icon layui-icon-subtraction"
style="display: inline"
onclick="deleteItem(this)"></i>
<div class="layui-form-item">
<label class="layui-form-label"
style="height: 40px;">物料名称:</label>
<div class="layui-input-block" style="margin: 0px;">
<div class="inputdiv">
<input type="text" placeholder="请选择物料"
class="layui-input fairy-tag-input"
style="border-style: none"
id="mnameForLocation"
onblur="selectMaterialByNameForLocation(this)"
lay-verify="required"/>
<i class="layui-icon layui-icon-search"
style="display: inline"
id="selectMaterialForLocation"
onclick="selectMaterialForLocation(this)"></i>
</div>
<input type="text" name="mid"
class="layui-input" id="midForLocation"
style="display: none"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"
style="height: 40px;">物料编码:</label>
<div class="layui-input-block" style="margin: 0px;">
<div class="inputdiv">
<input id="codeForLocation" name="code"
type="text" placeholder="请填写入物料编码"
value=""
onblur="selectCodeForLocation(this)"
class="layui-input"
lay-verify="required"
style="border-style: none">
<img src="/static/images/search.ico"
height="16" width="16"
style="margin-top: 10px"
onclick="scanMaterialCodeForTaking(this)">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料类型:</label>
<div class="layui-input-block">
<input type="text" placeholder="请选择物料类型"
class="layui-input"
id="openSonByMateralType" readonly
lay-verify="required"/>
<input type="text" id="materialTypeId"
name="typeId"
placeholder="请选择物料类型" class="layui-input"
style="display: none"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">材质:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写材质名称"
class="layui-input" readonly
name="texture"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">规格型号:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写规格型号"
class="layui-input" readonly
name="version"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计量单位:</label>
<div class="layui-input-block">
<select id="unit"
onchange="changeSelectValueForUnit(this)"
class="layui-form-select"
name="unit"></select>
</div>
</div>
<div class="layui-form-item" style="display: none"
id="producedDateItem">
<label class="layui-form-label">生产日期:</label>
<div class="layui-input-block">
<!-- <input type="text" name="producedDate" id="producedDate" placeholder="请填写生产日期" onclick="selectDate(this)"-->
<!-- autocomplete="off" class="layui-input">-->
<select name="producedDate" id="producedDate"
onchange="changeSelectValueForProducedDate(this)"
class="layui-form-select">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">库存数量:</label>
<div class="layui-input-block">
<input type="number" class="layui-input"
readonly id="oldInventory"
name="oldInventory"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">盘点数量:</label>
<div class="layui-input-block">
<input type="number" class="layui-input"
onblur="calculate(this)"
name="newInventory"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">盘点结果:</label>
<div class="layui-input-block">
<select name="takingResult" id="result"
class="layui-form-select">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">盈亏数量:</label>
<div class="layui-input-block">
<input type="number" class="layui-input"
readonly
id="Inventory_number"
name="inventory" lay-verify="required"/>
</div>
</div>
<i class="layui-icon layui-icon-addition"
style="display: inline"
onclick="addItem(this)"></i>
</div>
<div class="layui-form-item" style="margin-top: 10px;">
<div class="layui-input-block">
<button type="button"
class="layui-btn layui-btn-normal layui-btn-lg"
lay-submit
lay-filter="formStep3">
&emsp;提交&emsp;
</button>
</div>
</div>
</fieldset>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -462,6 +295,7 @@
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> <script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> <script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="/static/js/stockTaking/stockTakingForMaterial_mobile.js" charset="utf-8"></script> <script src="/static/js/stockTaking/stockTakingForMaterial_mobile.js" charset="utf-8"></script>
<script src="/static/js/stockTaking/stockTakingForLocation_mobile.js" charset="utf-8"></script>
<script> <script>
// 用于存储当前选择的盘点位置 // 用于存储当前选择的盘点位置
let depositoryId; let depositoryId;

2
target/classes/templates/pages/showInventory/showInventoryForLocation.html

@ -175,7 +175,7 @@
} }
for (let j = 0; j < keys.length; j++) { for (let j = 0; j < keys.length; j++) {
let key = keys[j]; let key = keys[j];
let item = '<p>' + "计量单位:" + key + ";库存数量:" + splitInventory[key] + '</p>'; let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>';
InventoryItem += item; InventoryItem += item;
} }
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "物料名称:" + result[i].mname + '</h2></div>'); lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "物料名称:" + result[i].mname + '</h2></div>');

Loading…
Cancel
Save