|
|
@@ -50,8 +50,8 @@
|
|
|
@{{ inventory.type }}
|
|
|
</span>
|
|
|
<span v-if="!listMode">
|
|
|
- <span v-if="inventory.status=='盘点中' ||inventory.status=='待盘点'" class="btn col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
|
|
|
- <span v-if="inventory.status=='复盘中'" class="btn col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
|
|
|
+ <span v-if="inventory.status==='盘点中' ||inventory.status=='待盘点'" class="btn col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
|
|
|
+ <span v-if="inventory.status==='复盘中'" class="btn col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
|
|
|
@@ -92,7 +92,7 @@
|
|
|
</form>
|
|
|
|
|
|
|
|
|
- <table class="table table-sm table-striped table-bordered table-hover text-nowrap d-none d-sm-block mt-2">
|
|
|
+ <table class="table table-sm table-striped table-bordered table-hover text-nowrap d-none d-md-block mt-2">
|
|
|
<tr>
|
|
|
<th>序号</th>
|
|
|
<th>库位</th>
|
|
|
@@ -111,7 +111,14 @@
|
|
|
<th>盘点差异</th>
|
|
|
<th>分配数量</th>
|
|
|
</tr>
|
|
|
- <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked=='是'||listMode" @click="selectedColor(inventoryMission.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
|
|
|
+ <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked==='是'||inventory.status==='复盘中'||listMode" @click="selectedColor(inventoryMission.id)"
|
|
|
+ :style="{'font-weight': inventory.id==selectedStyle?'bold':''}" :class="[
|
|
|
+ inventoryMission.mark==='已复盘有差异'?'td-cool':'',
|
|
|
+ inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
|
|
|
+ inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
|
|
|
+ inventoryMission.mark==='无差异'?'text-muted':'',
|
|
|
+ inventoryMission.mark==='未盘'?'td-yellow':'',
|
|
|
+ ]">
|
|
|
<td>@{{ i+1 }}</td>
|
|
|
<td>@{{ inventoryMission.location }}</td>
|
|
|
<td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
|
|
|
@@ -138,9 +145,16 @@
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
- <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-sm-none" style="background: rgb(255, 255, 255);" >
|
|
|
+ <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-md-none" style="background: rgb(255, 255, 255);" >
|
|
|
<tbody>
|
|
|
- <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked=='是'||listMode">
|
|
|
+ <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked==='是'||inventory.status==='复盘中'||listMode"
|
|
|
+ :class="[
|
|
|
+ inventoryMission.mark==='已复盘有差异'?'td-cool':'',
|
|
|
+ inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
|
|
|
+ inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
|
|
|
+ inventoryMission.mark==='无差异'?'text-muted':'',
|
|
|
+ inventoryMission.mark==='未盘'?'td-yellow':'',
|
|
|
+ ]">
|
|
|
<td style="filter:grayscale(30%); ">
|
|
|
<div class="mt-3">
|
|
|
<div style="transform:scale(0.9)" class="pl-0">
|
|
|
@@ -156,7 +170,7 @@
|
|
|
</select>
|
|
|
</span>
|
|
|
<span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span style="color:#af7651" v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</span></span>
|
|
|
- <div v-if="inventory.status=='复盘中'">
|
|
|
+ <div v-if="inventory.status==='复盘中'">
|
|
|
<span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点数量:</span><span style="color:#af7651">@{{ inventoryMission.verified_amount }}</span></span>
|
|
|
<span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">复盘数量:</span><span style="color:#af7651">@{{ inventoryMission.re_checked_amount }}</span></span>
|
|
|
<span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点差异:</span><span >@{{ inventoryMission.difference_amount }}</span></span>
|
|
|
@@ -183,6 +197,10 @@
|
|
|
selectedStyle:'',
|
|
|
inventoryMissionRecord:{},
|
|
|
listMode:false,
|
|
|
+ 中:'3232lll',
|
|
|
+ },
|
|
|
+ beforeMount: function () {
|
|
|
+ this.重排序并标记全列表类型();
|
|
|
},
|
|
|
mounted: function () {
|
|
|
let _this=this;
|
|
|
@@ -206,7 +224,6 @@
|
|
|
let inputs = $("#form .input");
|
|
|
let idx = inputs.index($(e.target)); // 获取当前焦点输入框所处的位置
|
|
|
let location=document.getElementById('inventoryInput').value;
|
|
|
- console.log(idx)
|
|
|
if (idx == 2) { // 判断是否是最后一个输入框
|
|
|
if (location==''){
|
|
|
document.getElementById('inventoryInput').focus();
|
|
|
@@ -231,7 +248,7 @@
|
|
|
//验证输入盘点产品条码对应是否有商品
|
|
|
searchBarcode(){
|
|
|
let _this=this;
|
|
|
- let barcode=document.getElementById('barcode').value;
|
|
|
+ let barcode=document.getElementById('barcode').value.trim();
|
|
|
let location=document.getElementById('inventoryInput').value;
|
|
|
let inventoryId=_this.inventory.id;
|
|
|
let barcodes=[];
|
|
|
@@ -263,36 +280,38 @@
|
|
|
submitStockInventory(){
|
|
|
let _this=this;
|
|
|
let url='{{url('inventory/stockInventory')}}';
|
|
|
- let location=document.getElementById('inventoryInput').value;
|
|
|
- let barcode=document.getElementById('barcode').value;
|
|
|
- let count=document.getElementById('count').value;
|
|
|
+ let location=document.getElementById('inventoryInput').value.trim();
|
|
|
+ let barcode=document.getElementById('barcode').value.trim();
|
|
|
+ let count=document.getElementById('count').value.trim();
|
|
|
let inventoryId=_this.inventory.id;
|
|
|
axios.post(url,{location:location,barcode:barcode,count:count,inventoryId:inventoryId})
|
|
|
.then(function (response) {
|
|
|
if (!response.data.success){
|
|
|
tempTip.setDuration(2000);
|
|
|
tempTip.show('盘点失败!'+' '+response.data.data);
|
|
|
- }else {
|
|
|
- if (_this.inventory.id==response.data.inventory.id){
|
|
|
- _this.inventory.processed=response.data.inventory.processed;
|
|
|
- _this.inventory.surplus=response.data.inventory.surplus;
|
|
|
- _this.inventory.check_surplus=response.data.inventory.check_surplus;
|
|
|
- }
|
|
|
- _this.inventoryMissions.every(function (inventoryMission,i) {
|
|
|
- if (inventoryMission.id==response.data.inventoryMission.id){
|
|
|
- inventoryMission.checked=response.data.inventoryMission.checked;
|
|
|
- inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
|
|
|
- inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
|
|
|
- inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
|
|
|
- _this.inventoryMissions.splice(i,1)
|
|
|
- _this.inventoryMissions.unshift(inventoryMission);
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- });
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.showSuccess('盘点成功!');
|
|
|
+ return;
|
|
|
}
|
|
|
+ if (_this.inventory.id===response.data.inventory.id){
|
|
|
+ _this.inventory.processed=response.data.inventory.processed;
|
|
|
+ _this.inventory.surplus=response.data.inventory.surplus;
|
|
|
+ _this.inventory.check_surplus=response.data.inventory.check_surplus;
|
|
|
+ }
|
|
|
+ _this.inventoryMissions.every(function (inventoryMission,i) {
|
|
|
+ if (inventoryMission.id===response.data.inventoryMission.id){
|
|
|
+ inventoryMission.checked=response.data.inventoryMission.checked;
|
|
|
+ inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
|
|
|
+ inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
|
|
|
+ inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
|
|
|
+ _this.inventoryMissions.splice(i,1)
|
|
|
+ _this.inventoryMissions.unshift(inventoryMission);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ _this.重排序并标记全列表类型(_this.inventoryMissions);
|
|
|
+ tempTip.setDuration(3000);
|
|
|
+ tempTip.showSuccess('盘点成功!');
|
|
|
+
|
|
|
}).catch(function (err) {
|
|
|
tempTip.setDuration(2000);
|
|
|
tempTip.show('盘点失败!'+'网络错误'+err);
|
|
|
@@ -316,6 +335,95 @@
|
|
|
tempTip.show('结束初盘失败!'+'网络错误'+err);
|
|
|
})
|
|
|
},
|
|
|
+ 重排序并标记全列表类型(){
|
|
|
+ let _this=this;
|
|
|
+ _this.已复盘有差异列=[];
|
|
|
+ _this.未复盘有差异列=[];
|
|
|
+ _this.已复盘无差异列=[];
|
|
|
+ _this.无差异列=[];
|
|
|
+ _this.未盘列=[];
|
|
|
+ _this.inventoryMissions.forEach(function (mission,i){
|
|
|
+ switch(mission.checked){
|
|
|
+ case '已复核':
|
|
|
+ if(mission.difference_amount){_this.已复盘有差异列.push(mission); mission.mark='已复盘有差异';return;}
|
|
|
+ _this.已复盘无差异列.push(mission); mission.mark='已复盘无差异'; return;
|
|
|
+ case '是':
|
|
|
+ if(mission.difference_amount){_this.未复盘有差异列.push(mission); mission.mark='未复盘有差异'; return;}
|
|
|
+ _this.无差异列.push(mission); mission.mark='无差异'; return;
|
|
|
+ case '否':
|
|
|
+ _this.未盘列.push(mission); mission.mark='未盘'; return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ _this.已复盘有差异列=_this.按库位排序_且合并SKU一起(_this.已复盘有差异列);
|
|
|
+ _this.未复盘有差异列=_this.按库位排序_且合并SKU一起(_this.未复盘有差异列);
|
|
|
+ _this.已复盘无差异列=_this.按库位排序_且合并SKU一起(_this.已复盘无差异列);
|
|
|
+ _this.无差异列=_this.按库位排序_且合并SKU一起(_this.无差异列);
|
|
|
+ _this.未盘列=_this.按库位排序_且合并SKU一起(_this.未盘列);
|
|
|
+ function 重推入(目标数组,推入数组){
|
|
|
+ 推入数组.forEach(function (元素){
|
|
|
+ 目标数组.push(元素);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _this.inventoryMissions=[];
|
|
|
+ 重推入(_this.inventoryMissions,_this.已复盘有差异列);
|
|
|
+ 重推入(_this.inventoryMissions,_this.未复盘有差异列);
|
|
|
+ 重推入(_this.inventoryMissions,_this.未盘列);
|
|
|
+ 重推入(_this.inventoryMissions,_this.已复盘无差异列);
|
|
|
+ 重推入(_this.inventoryMissions,_this.无差异列);
|
|
|
+ },
|
|
|
+ 按库位排序_且合并SKU一起(inventoryMissions){
|
|
|
+ let 结果列=[];
|
|
|
+ let 已出现字典列=[];
|
|
|
+ inventoryMissions.sort(function(a,b){
|
|
|
+ if(a.location>b.location)return 1;
|
|
|
+ if(a.location<b.location)return -1;
|
|
|
+ return 0;
|
|
|
+ })
|
|
|
+ function 迭代查重转移(目标列,进度下标){
|
|
|
+ if(!进度下标){
|
|
|
+ 进度下标=0;
|
|
|
+ }
|
|
|
+ for(;进度下标<目标列.length;进度下标++){
|
|
|
+ let 目标=目标列[进度下标];
|
|
|
+ if(已出现字典列[目标.commodity.barcode]===true){
|
|
|
+ 目标列.splice(进度下标,1)
|
|
|
+ let 最后一次重复下标=-1;//为了给相同条码依次排序设定
|
|
|
+ 结果列.some(function(结果,i){
|
|
|
+ if(结果.commodity.barcode===目标.commodity.barcode){
|
|
|
+ 最后一次重复下标=i;
|
|
|
+ if(最后一次重复下标===结果列.length-1){
|
|
|
+ 结果列.splice(最后一次重复下标+1,0,目标);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(最后一次重复下标>-1){
|
|
|
+ 结果列.splice(最后一次重复下标+1,0,目标);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ 迭代查重转移(目标列,进度下标);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ 已出现字典列[目标.commodity.barcode]=true;
|
|
|
+ 结果列.push(目标);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 迭代查重转移(inventoryMissions)
|
|
|
+ return 结果列;
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ // 单条排序并着色(inventoryMission){
|
|
|
+ // let _this=this;
|
|
|
+ // let 所在临时分类列=[];
|
|
|
+ // switch(inventoryMission.mark){
|
|
|
+ // case '已复盘有差异':所在临时分类列=_this.已复盘有差异列;break;
|
|
|
+ // case '已复盘无差异':所在临时分类列=_this.已复盘无差异列;break;
|
|
|
+ // case '未复盘有差异':所在临时分类列=_this.未复盘有差异列;break;
|
|
|
+ // case '无差异':所在临时分类列=_this.无差异列;break;
|
|
|
+ // case '未盘':所在临时分类列=_this.未盘列;break;
|
|
|
+ // }
|
|
|
+ // },
|
|
|
}
|
|
|
});
|
|
|
</script>
|