From b7e08df5a07b3fa832a46ecc31983e16f2bccc8c Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 24 七月 2023 14:56:01 +0800
Subject: [PATCH] # 出库作业,和库存明细管理 排序
---
src/main/webapp/static/js/pakStore/stockAdjust.js | 157 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 124 insertions(+), 33 deletions(-)
diff --git a/src/main/webapp/static/js/pakStore/stockAdjust.js b/src/main/webapp/static/js/pakStore/stockAdjust.js
index d227469..e81a6e6 100644
--- a/src/main/webapp/static/js/pakStore/stockAdjust.js
+++ b/src/main/webapp/static/js/pakStore/stockAdjust.js
@@ -2,6 +2,29 @@
var initAnfmeVal = "-";
var matCodeData = [];
var currLocNo;
+function getCol() {
+ arrRemove(detlCols, "field", "str3");
+ arrRemove(detlCols, "field", "str4")
+ arrRemove(detlCols, "field", "str5$")
+ arrRemove(detlCols, "field", "str6")
+ var cols = [
+ {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'},
+ {field: 'supplier', title: '鎵瑰彿', align: 'center', width: 120},
+ {field: 'source', title: '鏉ユ簮', align: 'center', edit:'text', width: 120},
+ {field: 'vendor', title: '渚涘簲鍟�', align: 'center', edit:'text', width: 120}
+ ,{field: 'str3', align: 'center',title: '瀹㈡埛鍚嶇О'}
+ ,{field: 'str4', align: 'center',title: '椤圭洰淇℃伅'}
+ ,{field: 'str5$', align: 'center',title: '绫诲埆'}
+ // {field: 'allqty', title: '鎬绘暟閲�', align: 'center'},
+ // {field: 'allweight', title: '鎬婚噸閲�', align: 'center'}
+ // ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
+ ];
+ arrRemove(detlCols, "field", "anfme")
+ cols.push.apply(cols, detlCols);
+ cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120})
+ return cols;
+}
+
layui.use(['table','laydate', 'form'], function() {
var table = layui.table;
var $ = layui.jquery;
@@ -16,21 +39,7 @@
limit: 500,
cellMinWidth: 50,
toolbar: '#toolbar',
- cols: [[
- {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'}
- ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
- ,{field: 'matnr', align: 'center',title: '鐗╂枡'}
- ,{field: 'lgnum', align: 'center',title: '浠撳簱鍙�'}
- ,{field: 'tbnum', align: 'center',title: '杞偍璇锋眰缂栧彿'}
- // ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
- ,{field: 'zmatid', align: 'center',title: '鐗╂枡鏍囩ID'}
- ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
- ,{field: 'werks', align: 'center',title: '宸ュ巶'}
- ,{field: 'altme', align: 'center',title: '鍗曚綅'}
- ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
- ,{field: 'bname', align: 'center',title: '鐢ㄦ埛ID'}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80}
- ]],
+ cols: [getCol()],
done: function (res, curr, count) {
limit();
}
@@ -38,7 +47,34 @@
// 椤甸潰淇敼
table.on('edit(chooseData)', function (obj) {
- updateMatCodeData(obj.data.matnr, Number(obj.value));
+ if(obj.field === 'count'){
+ updateMatCodeData(obj.data.matNo,obj.data.supplier, Number(obj.value));
+ }
+
+ if (obj.field === 'supplier'){
+ for (var i=0;i<matCodeData.length;i++){
+ if (matCodeData[i]["matNo"] === obj.data.matNo && matCodeData[i]["count"] === obj.data.count && matCodeData[i]["qty"] === obj.data.qty){
+ matCodeData[i]["supplier"] = obj.data.supplier;
+ }
+ }
+ }
+ if (obj.field === 'source'){
+ for (var i=0;i<matCodeData.length;i++){
+ if (matCodeData[i]["matNo"] === obj.data.matNo && matCodeData[i]["supplier"] === obj.data.supplier){
+ matCodeData[i]["source"] = obj.data.source;
+ }
+ }
+ }
+ if (obj.field === 'vendor'){
+ for (var i=0;i<matCodeData.length;i++){
+ if (matCodeData[i]["matNo"] === obj.data.matNo && matCodeData[i]["supplier"] === obj.data.supplier){
+ matCodeData[i]["vendor"] = obj.data.vendor;
+ }
+ }
+ }
+ tableIns.reload({data: matCodeData,done:function (res) {
+ limit();
+ }});
});
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -51,10 +87,12 @@
return;
}
if (matCodeData.length === 0) {
- layer.msg("璇峰厛娣诲姞鐗╂枡");
+ layer.msg("璇峰厛娣诲姞浜у搧");
return;
}
+ // debugger
for (var i=0;i<matCodeData.length;i++){
+
if (isNaN(matCodeData[i].count)) {
layer.msg("璇疯緭鍏ユ暟瀛�");
return;
@@ -70,7 +108,8 @@
headers: {'token': localStorage.getItem('token')},
data: JSON.stringify({
locNo: currLocNo,
- list: matCodeData
+ list: matCodeData,
+ zpallet:zpa
}),
contentType:'application/json;charset=UTF-8',
method: 'POST',
@@ -93,15 +132,45 @@
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(chooseData)', function(obj){
+
var data = obj.data;
switch (obj.event) {
case 'remove':
for (var i = matCodeData.length - 1; i >= 0; i--) {
- if (matCodeData[i].matnr === data.matnr) {
+ if (matCodeData[i].matNo === data.matNo && matCodeData[i].supplier === data.supplier) {
matCodeData.splice(i, 1);
}
}
tableIns.reload({data: matCodeData,done:function (res) {limit();}});
+ break;
+ case 'supplier':
+ var supplierLayer = layer.open({
+ type: 2,
+ title: '鎵瑰彿',
+ maxmin: true,
+ area: ['400px', '215px'],
+ shadeClose: false,
+ content: 'matSupplier.html',
+ btn: ['淇濆瓨', '鍙栨秷'],
+ style: 'text-algin: center',
+ yes: function(index, layero){
+ var supplier = layer.getChildFrame('body', index).find("#supplier")[0].value;
+ matCodeData.map(function (item) {
+ if (item.matNo === data.matNo && item.supplier === data.supplier) {
+ item.supplier = supplier;
+ }
+ });
+ layer.close(index);
+ // // 閲嶇疆琛ㄦ牸鏁版嵁
+ tableIns.reload({data: matCodeData,done:function (res) {
+ limit();
+ }});
+ },
+ success: function(layero, index){
+ var iframeWin = window[layero.find('iframe')[0]['name']];//寰楀埌iframe椤电殑绐楀彛瀵硅薄
+ iframeWin.setMatSupplier(data.supplier);
+ }
+ });
break;
}
});
@@ -123,7 +192,7 @@
});
function init(locNo) {
- http.post(baseUrl + "/locDetl/list/auth", {locNo: locNo,limit: 1000}, function (res) {
+ http.post(baseUrl + "/locDetl/list/sts", {locNo: locNo,limit: 1000}, function (res) {
matCodeData = [];
let data = res.data.records;
for (var i = 0; i<data.length; i++) {
@@ -157,7 +226,7 @@
let data = res.data;
if (data != null) {
$(".retrieve").show();
- $("#locMsg").html(locNo + " ,搴撲綅鐘舵�侊細" + data.locType$);
+ $("#locMsg").html(locNo + " ,搴撲綅鐘舵�侊細" + data.locSts$);
$('.not-retrieve').hide();
currLocNo = locNo;
} else {
@@ -177,13 +246,13 @@
}
}
- function updateMatCodeData(matnr, count) {
+ function updateMatCodeData(matNo, supplier, count) {
if (isNaN(count)) {
layer.msg("璇疯緭鍏ユ暟瀛�");
} else {
if (count >= 0) {
for (var i=0;i<matCodeData.length;i++){
- if (matCodeData[i]["matnr"] === matnr){
+ if (matCodeData[i]["matNo"] === matNo && matCodeData[i]["supplier"] === supplier){
matCodeData[i]["count"] = count;
}
}
@@ -197,7 +266,7 @@
}
})
-// 鎻愬彇鐗╂枡
+// 鎻愬彇浜у搧
var matCodeLayerIdx;
function getMat() {
if (isEmpty(currLocNo)) {
@@ -207,7 +276,7 @@
}
matCodeLayerIdx = layer.open({
type: 2,
- title: '鎻愬彇鐗╂枡',
+ title: '鎻愬彇浜у搧',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -224,19 +293,41 @@
el.css("border-color", "#b8b8b8");
}, 1000);
}
+var zpa=0
+
// 娣诲姞琛ㄦ牸鏁版嵁
function addTableData(data) {
let applyData = [];
for (var i=0;i<data.length;i++){
- applyData.push({
- count: initCountVal,
- anfme: initAnfmeVal,
- removeBtn: true,
- matnr: data[i].matNo,
- maktx: data[i].matName,
- altme: data[i].str1,
- })
+ let pass = false;
+ for (var j=0;j<matCodeData.length;j++){
+ zpa=matCodeData[0].zpallet
+ if (data[i].matNo === matCodeData[j].matNo && data[i].supplier === matCodeData[j].supplier) {
+ // console.log(data[i].supplier + '@@' +matCodeData[j].supplier)
+ pass = true;
+ break;
+ }
+ }
+
+ if (!pass) {
+ applyData.push({
+ count: initCountVal,
+ anfme: initAnfmeVal,
+ removeBtn: true,
+ matNo: data[i].matNo,
+ matName: data[i].matName,
+ specs: data[i].specs,
+ color: data[i].color,
+ size: data[i].size,
+ unit: data[i].unit,
+ zpallet:zpa,
+ supplier:'',
+ qtyBox:data[i].str6,
+ weight:data[i].weight,
+ qty:0
+ })
+ }
}
matCodeData.push.apply(matCodeData,applyData);
tableIns.reload({data: matCodeData});
--
Gitblit v1.9.1