You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2169 lines
55 KiB
2169 lines
55 KiB
<template> |
|
<BasicContainer ref="basicContainer" :option="option" :leftClick="leftClick"> |
|
<template #head> |
|
<view class="head"> |
|
<!-- 顶部 --> |
|
<view class="head_top"> |
|
<input type="text" v-model="details.searchCode" placeholder="请输入包条码" class="head_top_search" /> |
|
<view class="button" @click="handleSearch">确认</view> |
|
</view> |
|
|
|
<!-- tabBar选项卡 --> |
|
<view class="tabBar"> |
|
<view :class="{'tabBar-item': true, 'active': tabBarCode === 1}" @click="handleTabBarCode(1)"> |
|
有数据 |
|
</view> |
|
|
|
<!-- 无包条数据 --> |
|
<view :class="{'tabBar-item': true, 'active': tabBarCode === 2}" @click="handleTabBarCode(2)"> |
|
无数据 |
|
</view> |
|
</view> |
|
|
|
<!-- 控件 --> |
|
<view class="control"> |
|
<template v-if="!showControl"> |
|
<view class="button" @click.stop="handleShowControl(1)" v-show="!showControl && tabBarCode === 1">状态修改 |
|
</view> |
|
<!-- 合同号盘点时, 暂不支持新增 --> |
|
<view class="button" @click.stop="handleAddZero" |
|
v-show="!showControl && tabBarCode !== 1 && details.pageType !== 3">添加零担 |
|
</view> |
|
<view class="button" @click.stop="handleAddStock" |
|
v-show="!showControl && tabBarCode !== 1 && details.pageType !== 3">添加物料 |
|
</view> |
|
<view class="button" @click.stop="handleShowControl(2)" v-show="!showControl">批量删除</view> |
|
<view class="button" @click.stop="handleShowControl(3)" |
|
v-show="!showControl && details.pageType !== 2 ">批量上架</view> |
|
<view class="button" @click.stop="handleShowControl(4)" v-show="!showControl && tabBarCode === 1">批量盘点 |
|
</view> |
|
</template> |
|
|
|
<template v-else> |
|
<view class="button" @click.stop="handleCheckAll">全选</view> |
|
<view class="button" @click.stop="handleInvertSelection">反选</view> |
|
<view class="button" @click.stop="handleClose"> |
|
取消 |
|
</view> |
|
<view class="button" @click.stop="handleConFirm"> |
|
确认 |
|
</view> |
|
</template> |
|
</view> |
|
|
|
<view class="checkInfo"> |
|
<view class="checkInfo_item"> |
|
<text>已盘数量/总数:</text> |
|
<text>{{details.scanNum + '/' + (details.orderList.length + details.stockList.length)}}</text> |
|
</view> |
|
|
|
<view class="checkInfo_item"> |
|
<!-- 随机盘点 --> |
|
<template v-if="details.pageType === 1"> |
|
<text>订单号:</text> |
|
<text>{{details.scanNum + '/' + details.totalNum}}</text> |
|
</template> |
|
<!-- 按库位盘点 --> |
|
<template v-else-if="details.pageType === 2"> |
|
<text>库位号:</text> |
|
<text>{{details.pageInfos.positionCode}}</text> |
|
</template> |
|
<!-- 按合同号盘点 --> |
|
<template v-else-if="details.pageType === 3"> |
|
<text>合同号:</text> |
|
<text>{{details.pageInfos.orderCode}}</text> |
|
</template> |
|
<!-- 按托盘盘点 --> |
|
<template v-else-if="details.pageType === 4"> |
|
<text>托盘码:</text> |
|
<text>{{details.pageInfos.trayCode}}</text> |
|
</template> |
|
</view> |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<template #body> |
|
<!-- 主体内容 --> |
|
<view class="main"> |
|
<!-- <scroll-view class="scvmabx" @scrolltolower='()=>{}' scroll-y="true" @touchmove.stop="()=>{}"> --> |
|
<scroll-view class="scvmabx" scroll-y="true"> |
|
<!-- 有数据 --> |
|
<block v-for="item in details.renderList" :key="item"> |
|
<!-- 订制品 --> |
|
<view :class="{ |
|
'main_render': true, |
|
'active': false, |
|
'delete': false, |
|
'edit': false |
|
}"> |
|
<view @click.stop="handleItemChoose(item)" v-show="showControl"> |
|
<!-- 被选中 --> |
|
<image v-show="item.isChoose" src="@/static/ck.png" class="main_render_checkImg" mode=""> |
|
</image> |
|
<!-- 不被选中 --> |
|
<image v-show="!item.isChoose" src="@/static/nock.png" class="main_render_checkImg" mode=""> |
|
</image> |
|
</view> |
|
<view class="main_render_container"> |
|
<!-- 有数据 --> |
|
<template v-if="tabBarCode === 1"> |
|
<view class="main_render_item"> |
|
<view> |
|
包条码: {{item.orderPackageCode || '暂无数据'}} |
|
</view> |
|
<view :style="{color : (item.isManuallyAdd ? '#f00' : '#000')}" |
|
@click="editOrderCode(item)"> |
|
合同号: {{item.orderCode || '暂无数据'}} |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<!-- 零担 --> |
|
<template v-else-if="tabBarCode === 2 && Number(item.questTarget) === 2"> |
|
<view class="main_render_item" :style="{color : (item.isManuallyAdd ? '#f00' : '#000')}" |
|
@click="editZero(item)"> |
|
<view> |
|
运单号: {{item.waybillNumber || '暂无数据'}} |
|
</view> |
|
<view> |
|
合同号: {{item.orderCode || '暂无数据'}} |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<!-- 库存品 --> |
|
<template v-if="tabBarCode === 2 && Number(item.questTarget) === 3" |
|
:style="{color : (item.isManuallyAdd ? '#f00' : '#000')}" @click="editOrderCode(item)"> |
|
<view class="main_render_item"> |
|
<view> |
|
物料编码: {{item.materialCode || '暂无数据'}} |
|
</view> |
|
<view> |
|
合同号: {{item.orderCode || '暂无数据'}} |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<view class="main_render_item"> |
|
<view> |
|
库位: {{item.allocation || '暂无数据'}} |
|
</view> |
|
<template v-if="tabBarCode !== 1"> |
|
<view> |
|
物品名称: {{item.materialName || '暂无数据'}} |
|
</view> |
|
<view> |
|
数量: {{item.quantity || '暂无数据'}} |
|
</view> |
|
</template> |
|
|
|
<template v-else> |
|
<view> |
|
状态: |
|
{{details.stateArr.find(val => val.code === Number(item.cargoName)).title || '暂无数据'}} |
|
</view> |
|
</template> |
|
</view> |
|
|
|
<view class="main_render_item"> |
|
<template v-if="tabBarCode !== 1"> |
|
<view> |
|
状态: |
|
{{details.stateArr.find(val => val.code === Number(item.cargoName)).title || '暂无数据'}} |
|
</view> |
|
</template> |
|
|
|
<view class=""> |
|
类型: <text |
|
class="main_render_item_type">{{details.typeArr.find(val => val.code === Number(item.questTarget)).title}}</text> |
|
</view> |
|
|
|
<view class=""> |
|
盘点状态: |
|
<text :class="{ |
|
'main_render_item_type': true, |
|
'active': Number(item.questStatus) !== 1 |
|
}"> |
|
{{details.checkStatus.find(val => val.code === Number(item.questStatus)).title}} |
|
</text> |
|
</view> |
|
<view class="button_box"> |
|
<view class="button" @click="handleState(item)"> |
|
处理 |
|
</view> |
|
<view class="button" v-if='details.pageType !== 4' @click="handleItemUp(item)"> |
|
上架 |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
</block> |
|
<view class="main_footer"> |
|
|
|
</view> |
|
</scroll-view> |
|
<!-- 提交 --> |
|
<button @click="submitCheck" class="submitButton" type="primary">提交盘点</button> |
|
</view> |
|
</template> |
|
</BasicContainer> |
|
|
|
<!-- 弹出层 -- 上架 --> |
|
<PopUp ref="popUp_Up"> |
|
<view class="popUpTitle"> |
|
请扫描新的库位码,如果该货物已在其它库位,使用该功能会重新绑定库位 |
|
</view> |
|
<!-- <input class="popUpInput" v-model="details.scancode" type="text" placeholder="请扫描货位码" disabled /> --> |
|
<view class="popUpInfo"> |
|
货位信息: {{details.positionInfo.positionCode || '暂无数据'}} |
|
</view> |
|
</PopUp> |
|
|
|
<!-- 弹出层 -- 状态修改 --> |
|
<PopUp ref="popUp_EditState"> |
|
<view class="popUp_EditState_container"> |
|
<block v-for="item in details.stateArr" :key="item"> |
|
<view class="popUp_row"> |
|
<view class="popUp_row_item" @click.stop="handleCheck(item)"> |
|
<!-- 被选中 --> |
|
<image v-show="item.isCheck" src="@/static/check.png" class="popUp_row_checkImg" mode=""></image> |
|
<!-- 不被选中 --> |
|
<image v-show="!item.isCheck" src="@/static/nocheck.png" class="popUp_row_checkImg" mode=""> |
|
</image> |
|
<view class="popUp_row_title">{{item.title}}</view> |
|
</view> |
|
<!-- 输入框 --> |
|
<template v-if="tabBarCode === 2 && item.code !== 10"> |
|
<input class="input" type="number" @blur="inputNum(item)" :disabled="item.disabled" |
|
v-model="item.value" /> |
|
</template> |
|
|
|
<!-- 在库数 --> |
|
<template v-else-if="tabBarCode === 2 && item.code === 10"> |
|
<view class="input"> |
|
{{item.value - details.stateArr[2].value - details.stateArr[4].value - details.stateArr[5].value}} |
|
</view> |
|
</template> |
|
</view> |
|
</block> |
|
</view> |
|
</PopUp> |
|
|
|
<!-- 弹出层 -- 删除 / 盘点 --> |
|
<PopUp ref="popUp_Handle"></PopUp> |
|
|
|
<!-- 弹出层 -- 是否移托 --> |
|
<PopUp ref="popUp_RemoveTary"> |
|
<view class=""> |
|
包条码: {{details.removeTray.orderPackageCode}} |
|
</view> |
|
<view class=""> |
|
该包条绑定托盘: {{details.removeTray.trayCode}} |
|
</view> |
|
<view class=""> |
|
本托盘: {{details.pageInfos.trayCode}} |
|
</view> |
|
</PopUp> |
|
|
|
<!-- 弹出层 -- 新增 --> |
|
<PopUp ref="popUp_Add"> |
|
<view class=""> |
|
包条码: {{details.scancode}} |
|
</view> |
|
<input class="popUpInput" v-model="details.addInfo.orderCode" type="text" placeholder="请输入合同号" /> |
|
<view style=" |
|
display: flex; |
|
margin-top: 20rpx; |
|
"> |
|
<block v-for="item in details.addType" :key="item"> |
|
<view class="popUp_row_item" @click.stop="()=>{details.addType.forEach(val => val.isCheck = !val.isCheck)}"> |
|
<!-- 被选中 --> |
|
<image v-show="item.isCheck" src="@/static/check.png" class="popUp_row_checkImg" mode=""></image> |
|
<!-- 不被选中 --> |
|
<image v-show="!item.isCheck" src="@/static/nocheck.png" class="popUp_row_checkImg" mode=""> |
|
</image> |
|
<view class="popUp_row_title">{{item.title}}</view> |
|
</view> |
|
</block> |
|
</view> |
|
</PopUp> |
|
|
|
<!-- 弹出层 -- 新增库存品 --> |
|
<PopUp ref="popUp_AddStock"> |
|
<view class="popUp_Add_row"> |
|
<view>合同号:</view> |
|
<input class="popUpInput" v-model="details.addInfo.orderCode" type="text" placeholder="请输入合同号" /> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>批次号:</view> |
|
<input class="popUpInput" v-model="details.addInfo.incomingBatch" type="text" placeholder="请输入批次号" /> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>物料名称:</view> |
|
<input class="popUpInput" v-model="details.addInfo.materialName" @blur="handleShowMaterial" type="text" |
|
placeholder="请输入物料编码或物料名称" /> |
|
<template v-if="details.showList.showMaterial"> |
|
<view class="select_content"> |
|
<bolck v-for="val in details.materialNameList" :key="val"> |
|
<template v-if="val"> |
|
<view @click="()=>{ |
|
details.addInfo.materialName = val.materialName |
|
details.addInfo.materialCode = val.materialCode |
|
details.showList.showMaterial = false |
|
}"> |
|
{{val.materialName}} |
|
</view> |
|
</template> |
|
</bolck> |
|
</view> |
|
</template> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>商城:</view> |
|
<input class="popUpInput" v-model="details.addInfo.marketName" @blur="handleShowMarket" type="text" |
|
placeholder="请选择商城" /> |
|
<template v-if="details.showList.showMarket"> |
|
<view :class="{'select_content': true, 'show': details.showMarket}"> |
|
<bolck v-for="val in details.marketNameList" :key="val"> |
|
<template v-if="val"> |
|
<view @click="()=>{ |
|
details.addInfo.marketName = val.clientName |
|
details.addInfo.clientName = val.clientName |
|
details.addInfo.marketId = val.id |
|
details.showList.showMarket = false |
|
}"> |
|
{{val.clientName}} |
|
</view> |
|
</template> |
|
</bolck> |
|
</view> |
|
</template> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>在库数量:</view> |
|
<input class="popUpInput" v-model="details.addInfo.quantity" type="number" placeholder="请输入在库数量" /> |
|
</view> |
|
</PopUp> |
|
|
|
<!-- 弹出层 -- 新增零担 --> |
|
<PopUp ref="popUp_AddZero"> |
|
<view class="popUp_Add_row"> |
|
<view>运单号:</view> |
|
<input class="popUpInput" v-model="details.addInfo.waybillNumber" type="text" placeholder="请输入运单号" /> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>合同号:</view> |
|
<input class="popUpInput" v-model="details.addInfo.orderCode" type="text" placeholder="请输入请输入合同号" /> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>物料名称:</view> |
|
<input class="popUpInput" v-model="details.addInfo.materialName" type="text" placeholder="请输入物料名称" /> |
|
</view> |
|
<view class="popUp_Add_row"> |
|
<view>数量:</view> |
|
<input class="popUpInput" v-model="details.addInfo.quantity" type="number" placeholder="请输入数量" /> |
|
</view> |
|
</PopUp> |
|
|
|
|
|
<!-- #ifdef APP --> |
|
<saomiao2 :ishidestop="scanState !== 0"></saomiao2> |
|
<!-- #endif --> |
|
</template> |
|
|
|
<script setup lang="ts"> |
|
import { |
|
onShow, |
|
onLoad, |
|
onHide |
|
} from '@dcloudio/uni-app' |
|
import { reactive, toRefs, ref, onMounted } from "vue"; |
|
import utils from '@/utils/utils.js'; |
|
import { |
|
getWarehouseTaskgetTaskConInfo, |
|
postWarehouseTaskSelectPackageInfo, |
|
postWarehouseTaskQuestDetailAllocation, |
|
postWarehouseTaskAddDataInfo, |
|
postqueryfindMaterialList, |
|
pgetgetMaterialName, |
|
getWarehouseTaskDeleteQuestChild |
|
} from '@/api/user.js'; |
|
import useSystemSettingsStore from '@/store/useSystemSettingsStore'; |
|
import { storeToRefs } from 'pinia'; |
|
const { scanState } = storeToRefs(useSystemSettingsStore()) |
|
|
|
const option = reactive({ |
|
/** 页面标题 */ |
|
title: '', |
|
/** 页面是否有数据, 默认为有 (暂时没用) */ |
|
haveData: true, |
|
/** 页面数据是否加载完毕, (暂时无用) */ |
|
isEnd: true, |
|
/** 页面刷新 */ |
|
async pullDownRefreshInitPage() { |
|
details.scanNum = 0 |
|
const res = await initPage() |
|
if (details.tabBarCode === 1) details.renderList = details.orderList |
|
else if (details.tabBarCode === 2) details.renderList = details.stockList |
|
return res |
|
}, |
|
async reachBottomInitPage() { |
|
return null |
|
} |
|
}) |
|
|
|
const details = reactive({ |
|
/** 页面级数据 */ |
|
pageInfos: {}, |
|
/** 页面类型 1: 随机盘点; 2: 按库位盘点; 3: 按合同号盘点; 4: 按托盘盘点; */ |
|
pageType: 1, |
|
/** 选项卡页码 */ |
|
tabBarCode: 1, |
|
/** 搜索的码值 */ |
|
searchCode: '', |
|
/** 是否显示控件 */ |
|
showControl: false, |
|
/** 扫描后的值 */ |
|
scancode: '', |
|
/** 页面渲染数组 */ |
|
renderList: [], |
|
/** 有包条数据的数组 -- 定制品 + 部分库存品 */ |
|
orderList: [], |
|
/** 无包条数据的数组 -- 部分库存品 + 零担 */ |
|
stockList: [], |
|
/** 批量处理类型 1: 状态修改; 2: 批量删除; 3: 批量上架; 4: 批量盘点 */ |
|
handleType: 1, |
|
/** 是否扫描 */ |
|
isScan: true, |
|
/** 上架扫描 */ |
|
upScan: false, |
|
/** 有数据新增类型 */ |
|
addType: [ |
|
{ title: '定制品', isCheck: true }, |
|
{ title: '库存品', isCheck: false }, |
|
], |
|
/** 在库状态字典 */ |
|
stateArr: [ |
|
{ |
|
title: '在库', |
|
isCheck: true, |
|
value: 1, |
|
code: 10, |
|
disabled: true, |
|
name: 'stockNum' |
|
}, |
|
{ |
|
title: '破损', |
|
isCheck: false, |
|
value: 0, |
|
code: 20, |
|
disabled: true, |
|
name: 'wornNum' |
|
}, |
|
{ |
|
title: '丢失', |
|
isCheck: false, |
|
value: 0, |
|
code: 30, |
|
disabled: true, |
|
name: 'lossNum' |
|
}, |
|
{ |
|
title: '不可修复', |
|
isCheck: false, |
|
value: 0, |
|
code: 40, |
|
disabled: true, |
|
name: 'noRepairNum' |
|
}, |
|
{ |
|
title: '配送', |
|
isCheck: false, |
|
value: 0, |
|
code: 50, |
|
disabled: true, |
|
name: 'deliveNum' |
|
}, |
|
{ |
|
title: '未入库', |
|
isCheck: false, |
|
value: 0, |
|
code: 60, |
|
disabled: true, |
|
name: 'noReceivedNum' |
|
} |
|
], |
|
/** 盘点状态字典表 */ |
|
checkStatus: [ |
|
{ code: 0, title: '待盘点' }, |
|
{ code: 1, title: '已盘点' }, |
|
{ code: 2, title: '未盘点' }, |
|
{ code: 3, title: '已排除' }, |
|
], |
|
/** 类型字典表 */ |
|
typeArr: [ |
|
{ code: 1, title: '定制品' }, |
|
{ code: 2, title: '零担' }, |
|
{ code: 3, title: '库存品' }, |
|
], |
|
/** 总数 */ |
|
totalNum: 0, |
|
/** 已扫数量 */ |
|
scanNum: 0, |
|
/** 上架时的库位信息 */ |
|
positionInfo: { |
|
/** 库位码 */ |
|
positionCode: '', |
|
/** 库位ID */ |
|
allocationId: '' |
|
}, |
|
/** 新增内容 */ |
|
addInfo: { |
|
/** 合同号 */ |
|
orderCode: '' |
|
}, |
|
/** 商城名称数组 */ |
|
marketNameList: [], |
|
/** 物料名称数组 */ |
|
materialNameList: [{ materialName: 1 }], |
|
/** 是否显示下拉框 */ |
|
showList: { |
|
showMarket: false, |
|
showMaterial: false |
|
}, |
|
/** 是否为全选 */ |
|
isAll: false, |
|
/** 关闭扫描监听 */ |
|
stopScan: false, |
|
/** 被移动的包条数据 */ |
|
removeTray: {} |
|
}) |
|
|
|
// 获取组件实例 |
|
/** 基本组件 */ |
|
const basicContainer = ref(null) |
|
/** 弹出层 -- 上架 */ |
|
const popUp_Up = ref(null) |
|
/** 弹出层 -- 状态修改 */ |
|
const popUp_EditState = ref(null) |
|
/** 弹出层 -- 删除 / 盘点 */ |
|
const popUp_Handle = ref(null) |
|
/** 弹出层 -- 新增 */ |
|
const popUp_Add = ref(null) |
|
/** 弹出层 -- 新增零担 */ |
|
const popUp_AddZero = ref(null) |
|
/** 弹出层 -- 新增库存品 */ |
|
const popUp_AddStock = ref(null) |
|
/** 弹出层 -- 是否移托 */ |
|
const popUp_RemoveTary = ref(null) |
|
|
|
// 页面初始化执行回调 |
|
onLoad((info) => { |
|
console.log('info :>> ', info); |
|
const infos = JSON.parse(info.info) |
|
console.log('object :>> ', JSON.parse(info.info)); |
|
option.title = infos.title |
|
details.pageType = infos.pageType |
|
details.pageInfos = infos |
|
|
|
}) |
|
|
|
onShow(() => { |
|
// #ifdef APP |
|
// 开启监听扫描 |
|
uni.$off('scancodedate') |
|
uni.$on('scancodedate', function (code) { |
|
if (code) { |
|
// 是否接受扫描的值 |
|
if (details.stopScan) return |
|
// 获取扫描的值 |
|
details.scancode = code |
|
|
|
// 是否进行上架扫描 |
|
if (details.upScan) scanUp() |
|
|
|
// 是否匹配数据 |
|
else if (details.isScan) scandata() |
|
|
|
} |
|
}) |
|
// #endif |
|
// 初始化请求页面数据 |
|
// initPage() |
|
const timer = setTimeout(() => { |
|
basicContainer.value.startPullDownRefresh() |
|
// 清除定时器 |
|
clearTimeout(timer) |
|
}, 200) |
|
}) |
|
|
|
/** 请求页面数据 */ |
|
async function initPage() { |
|
try { |
|
const orderRes = initOrder() |
|
const stockRes = initStock() |
|
const _promiseAll = Promise.all([orderRes, stockRes]) |
|
console.log('_promiseAll :>> ', _promiseAll); |
|
return _promiseAll |
|
} catch (e) { |
|
//TODO handle the exception |
|
} |
|
} |
|
|
|
/** 请求页面数据 -- 有数据 */ |
|
async function initOrder() { |
|
try { |
|
const queryData = { |
|
typeState: 1, |
|
type: 2, |
|
questType: details.pageType, |
|
code: details.pageInfos.trayCode, |
|
questId: details.pageInfos.questId, |
|
questNum: details.pageInfos.questNum, |
|
} |
|
if (details.pageType === 2) queryData.code = details.pageInfos.allocationId |
|
else if (details.pageType === 3) queryData.code = details.pageInfos.orderCode |
|
else if (details.pageType === 4) queryData.code = details.pageInfos.trayCode |
|
const res = await getWarehouseTaskgetTaskConInfo(queryData) |
|
const { code, data } = res |
|
if (code !== 200 || !data) return |
|
details.orderList = data.list || [] |
|
details.orderList.forEach(val => { |
|
if (!val.questChildVOList) val.cargoName = 10 |
|
else { |
|
// 盘点过的数据, 排查在库状态 |
|
val.questChildVOList.forEach(item => { |
|
if (item.questNum !== 0) val.cargoName = item.cargoName |
|
}) |
|
} |
|
// 记录所有已盘点的数量 |
|
if (Number(val.questStatus) === 1) { |
|
details.scanNum++ |
|
// 该条在系统中记录已盘点 |
|
val.isTask = true |
|
} |
|
}) |
|
} catch (e) { |
|
//TODO handle the exception |
|
} finally { |
|
return null |
|
} |
|
} |
|
|
|
/** 请求页面数据 -- 无数据 */ |
|
async function initStock() { |
|
try { |
|
const queryData = { |
|
typeState: 2, |
|
type: 1, |
|
questType: details.pageType, |
|
code: details.pageInfos.trayCode, |
|
questId: details.pageInfos.questId, |
|
questNum: details.pageInfos.questNum, |
|
} |
|
if (details.pageType === 2) queryData.code = details.pageInfos.allocationId |
|
else if (details.pageType === 3) queryData.code = details.pageInfos.orderCode |
|
else if (details.pageType === 4) queryData.code = details.pageInfos.trayCode |
|
const res = await getWarehouseTaskgetTaskConInfo(queryData) |
|
const { code, data } = res |
|
if (code !== 200 || !data) return |
|
details.stockList = data.list || [] |
|
// 记录所有已盘点的数量 |
|
details.stockList.forEach(val => { |
|
if (!val.cargoName) val.cargoName = 10 |
|
if (Number(val.questStatus) === 1) { |
|
details.scanNum++ |
|
val.isTask = true |
|
} |
|
}) |
|
} catch (e) { |
|
//TODO handle the exception |
|
} finally { |
|
return null |
|
} |
|
} |
|
|
|
/** 扫描后执行的回调 -- 对比包件码 */ |
|
async function scandata() { |
|
if (details.tabBarCode !== 1) return |
|
|
|
// 是否扫描到已有包条 |
|
let _flag = false |
|
for (let i = 0; i <= details.renderList.length - 1; i++) { |
|
const _item = details.renderList[i] |
|
// 匹配包条码, 包条码一致时更改状态 |
|
if (details.scancode === _item.orderPackageCode) { |
|
if (Number(_item.questStatus) === 1) { |
|
uni.showToast({ |
|
title: '重复扫描', |
|
icon: 'none' |
|
}) |
|
// #ifdef APP |
|
utils.ttsspke('重复扫描') |
|
// #endif |
|
_flag = true |
|
break |
|
} |
|
_item.questStatus = 1 |
|
_flag = true |
|
details.scanNum++ |
|
// #ifdef APP |
|
utils.ttsspke(details.scanNum + '件') |
|
// #endif |
|
// 退出循环 |
|
break |
|
} |
|
} |
|
// 扫到已有包条退出函数 || 合同号盘点时不支持新增 |
|
if (_flag || details.pageType === 3) return |
|
|
|
try { |
|
// uni.showLoading({ |
|
// title: '数据加载中', |
|
// mask: true |
|
// }); |
|
|
|
const queryData = { |
|
code: details.scancode, |
|
questId: details.pageInfos.questId, |
|
questNum: details.pageInfos.questNum |
|
} |
|
|
|
// 查询包条码 |
|
const res = await postWarehouseTaskSelectPackageInfo(queryData) |
|
console.log('res :>> ', res); |
|
const { code, data } = res |
|
console.log('code :>> ', code); |
|
|
|
// 当后台查询出数据时直接添加 |
|
if (code === 200 && data && data.length !== 0) { |
|
data.forEach(val => { |
|
// 托盘盘点 (判断该数据是否已打托) |
|
if (details.pageType === 4 && val.trayCode) { |
|
details.removeTray = val |
|
popUp_RemoveTary.value.setDetails({ |
|
title: '是否移托', |
|
showPopUp: true, |
|
success() { |
|
val.questStatus = 1 |
|
details.scanNum++ |
|
val.isNew = true |
|
if (!val.cargoName) val.cargoName = 10 |
|
|
|
val.trayCode = details.pageInfos.trayCode |
|
val.trayId = details.pageInfos.trayId |
|
val.isChange = true |
|
|
|
details.orderList.push(val) |
|
console.log('val :>> ', val); |
|
popUp_RemoveTary.value.details.showPopUp = false |
|
// #ifdef APP |
|
utils.ttsspke(details.scanNum + '件') |
|
// #endif |
|
} |
|
}) |
|
|
|
return |
|
} |
|
|
|
val.questStatus = 1 |
|
details.scanNum++ |
|
val.isNew = true |
|
val.isChange = true |
|
if (!val.cargoName) val.cargoName = 10 |
|
if (details.pageType === 2) { |
|
val.allocationId = details.pageInfos.allocationId |
|
val.allocation = details.pageInfos.positionCode |
|
} |
|
else if (details.pageType === 3) { |
|
val.orderCode = details.pageInfos.orderCode |
|
val.orderId = details.pageInfos.orderId |
|
} |
|
else if (details.pageType === 4) { |
|
val.trayCode = details.pageInfos.trayCode |
|
val.trayId = details.pageInfos.trayId |
|
} |
|
details.orderList.push(val) |
|
}) |
|
// #ifdef APP |
|
utils.ttsspke(details.scanNum + '件') |
|
// #endif |
|
} else if (code === 3001) { |
|
// #ifdef APP |
|
utils.ttsspke('该包件已盘点') |
|
// #endif |
|
|
|
uni.showToast({ |
|
title: '该包件已盘点', |
|
icon: 'none' |
|
}) |
|
|
|
return |
|
} |
|
else if(code === 5001){ |
|
return |
|
} |
|
else if (code !== 4000) { |
|
details.addInfo.orderCode = '' |
|
details.stopScan = true |
|
// 手动录入新增 |
|
popUp_Add.value.setDetails({ |
|
title: '新增', |
|
showPopUp: true, |
|
success() { |
|
const _order = { |
|
orderPackageCode: details.scancode, |
|
questStatus: 1, |
|
orderCode: details.addInfo.orderCode, |
|
allocation: '', |
|
cargoName: 10, |
|
isChoose: false, |
|
/** 为手动添加 */ |
|
isManuallyAdd: true, |
|
/** 物料类型 */ |
|
questTarget: 1 |
|
} |
|
if (details.pageType === 2) { |
|
_order.allocationId = details.pageInfos.allocationId |
|
_order.allocation = details.pageInfos.positionCode |
|
} |
|
else if (details.pageType === 3) { |
|
_order.orderCode = details.pageInfos.orderCode |
|
_order.orderId = details.pageInfos.orderId |
|
} |
|
else if (details.pageType === 4) { |
|
_order.trayCode = details.pageInfos.trayCode |
|
_order.trayId = details.pageInfos.trayId |
|
} |
|
const _flag = details.addType.find(val => val.isCheck).title |
|
if (_flag === '定制品') _order.questTarget = 1 |
|
else _order.questTarget = 3 |
|
details.orderList.push(_order) |
|
details.scanNum++ |
|
// 清空数据 |
|
details.addInfo = {} |
|
// 关闭弹窗 |
|
popUp_Add.value.details.showPopUp = false |
|
details.stopScan = false |
|
}, |
|
close() { |
|
details.stopScan = false |
|
details.addInfo = {} |
|
popUp_Add.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
} catch (err) { |
|
console.log('err :>> ', err); |
|
//TODO handle the exception |
|
} finally { |
|
// uni.hideLoading() |
|
} |
|
} |
|
|
|
/** 扫描后执行的回调 -- 上架时扫描货位码 */ |
|
async function scanUp() { |
|
try { |
|
uni.showLoading({ |
|
title: '数据加载中', |
|
mask: true |
|
}); |
|
const queryData = { |
|
questId: details.pageInfos.questId, |
|
allocationId: details.scancode |
|
} |
|
const res = await postWarehouseTaskQuestDetailAllocation(queryData) |
|
const { code, data } = res |
|
if (code === 200 && data) details.positionInfo = data |
|
else { |
|
details.positionInfo.positionCode = '' |
|
details.positionInfo.allocationId = '' |
|
} |
|
} catch (e) { |
|
//TODO handle the exception |
|
} finally { |
|
uni.hideLoading() |
|
} |
|
} |
|
|
|
// 改变选项卡激活状态 |
|
function handleTabBarCode(code : number) { |
|
if (details.tabBarCode === code) return |
|
details.tabBarCode = code |
|
details.showControl = false |
|
if (details.tabBarCode === 1) details.renderList = details.orderList |
|
else if (details.tabBarCode === 2) details.renderList = details.stockList |
|
} |
|
|
|
/** 搜索 */ |
|
const handleSearch = () => { |
|
details.scancode = details.searchCode |
|
scandata() |
|
} |
|
|
|
/** 修改合同号 */ |
|
const editOrderCode = (item : any) => { |
|
// 是否为手动添加, 手动添加才能更改 |
|
if (!item.isManuallyAdd) return |
|
details.addInfo.orderCode = item.orderCode |
|
popUp_Add.value.setDetails({ |
|
title: '修改合同号', |
|
showPopUp: true, |
|
success() { |
|
item.orderCode = details.addInfo.orderCode |
|
details.addInfo.orderCode = '' |
|
details.addInfo = {} |
|
popUp_Add.value.details.showPopUp = false |
|
}, |
|
close() { |
|
details.addInfo = {} |
|
popUp_Add.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
|
|
/** 修改零担 */ |
|
const editZero = (item : any) => { |
|
// 是否为手动添加, 手动添加才能更改 |
|
if (!item.isManuallyAdd) return |
|
// 回显数据 |
|
details.addInfo.waybillNumber = item.waybillNumber |
|
details.addInfo.orderCode = item.orderCode |
|
details.addInfo.quantity = item.quantity |
|
details.addInfo.materialName = item.materialName |
|
popUp_AddZero.value.setDetails({ |
|
title: '修改零担信息', |
|
showPopUp: true, |
|
success() { |
|
if (!details.addInfo.orderCode) return uni.showToast({ |
|
title: '请输入合同号', |
|
icon: 'none' |
|
}) |
|
if (!details.addInfo.materialName) return uni.showToast({ |
|
title: '请输入物料名称', |
|
icon: 'none' |
|
}) |
|
const _number = Number(details.addInfo.quantity) |
|
if (_number !== _number || _number <= 0) return uni.showToast({ |
|
title: '数量为大于0的数字', |
|
icon: 'none' |
|
}) |
|
|
|
item.orderCode = details.addInfo.orderCode |
|
item.waybillNumber = details.addInfo.waybillNumber |
|
item.quantity = _number |
|
item.materialName = details.addInfo.materialName |
|
item.stockNum = _number |
|
details.addInfo.orderCode = '' |
|
details.addInfo = {} |
|
popUp_AddZero.value.details.showPopUp = false |
|
}, |
|
close() { |
|
details.addInfo = {} |
|
popUp_AddZero.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
|
|
/** 开启控件区 */ |
|
const handleShowControl = (_type : number) => { |
|
// 按托盘上架只能整托上架 |
|
if (_type === 3 && details.pageType === 4) { |
|
// 清空扫描的值 |
|
details.scancode = '' |
|
// 开启上架扫描 |
|
details.upScan = true |
|
|
|
// 开启弹窗 |
|
popUp_Up.value.setDetails({ |
|
title: '批量上架', |
|
showPopUp: true, |
|
confirmText: '确认上架', |
|
success() { |
|
const { positionCode, allocationId } = details.positionInfo |
|
let content = '' |
|
let _number = 0 |
|
if (positionCode) { |
|
const _arr = [...details.stockList, ...details.orderList] |
|
|
|
for (let i = 0; i <= _arr.length - 1; i++) { |
|
const _item = _arr[i] |
|
if (_item.questStatus === 1) { |
|
// 改变库位信息 |
|
_item.allocationId = allocationId |
|
_item.allocation = positionCode |
|
_item.isChange = true |
|
_number++ |
|
} |
|
// 重置选中状态 |
|
} |
|
if (_number !== 0) content = '上架成功' + _number + '件' |
|
else content = '请先盘点再上架' |
|
} else content = '上架失败, 库位数据有误' |
|
|
|
uni.showToast({ |
|
title: content, |
|
icon: 'none' |
|
}) |
|
// #ifdef APP |
|
utils.ttsspke(content) |
|
// #endif |
|
|
|
// 重置库位信息 |
|
details.positionInfo.allocationId = '' |
|
details.positionInfo.positionCode = '' |
|
|
|
// 关闭弹出层 |
|
popUp_Up.value.details.showPopUp = false |
|
details.upScan = false |
|
}, |
|
close() { |
|
popUp_Up.value.details.showPopUp = false |
|
details.upScan = false |
|
} |
|
}) |
|
return |
|
} |
|
|
|
details.showControl = true |
|
// 更改控件区操控类型 |
|
details.handleType = _type |
|
// #ifdef APP |
|
switch (_type) { |
|
case 1: |
|
utils.ttsspke('状态修改') |
|
break |
|
case 2: |
|
utils.ttsspke('批量删除') |
|
break |
|
case 3: |
|
utils.ttsspke('批量上架') |
|
break |
|
case 4: |
|
utils.ttsspke('批量盘点') |
|
break |
|
} |
|
// #endif |
|
} |
|
|
|
/** 重置处理状态 */ |
|
const initState = (cargoName ?: any) => { |
|
console.log('cargoName :>> ', cargoName); |
|
if (details.tabBarCode === 1) { |
|
if (cargoName) { |
|
// 根据指定值激活状态 |
|
details.stateArr.forEach((val) => { |
|
if (val.code === cargoName) { |
|
val.isCheck = true |
|
val.value = 1 |
|
} else { |
|
val.isCheck = false |
|
val.value = 0 |
|
} |
|
}) |
|
} else { |
|
// 没有传入指定值, 重置处理状态 |
|
details.stateArr.forEach((val, index) => { |
|
if (index === 0) { |
|
val.isCheck = true |
|
val.value = 1 |
|
} else { |
|
val.isCheck = false |
|
val.value = 0 |
|
} |
|
}) |
|
} |
|
} else { |
|
if ( |
|
cargoName.stockNum |
|
|| cargoName.wornNum |
|
|| cargoName.lossNum |
|
|| cargoName.noRepairNum |
|
|| cargoName.deliveNum |
|
|| cargoName.noReceivedNum) { |
|
details.stateArr.forEach((val) => { |
|
const _value = cargoName[val.name] |
|
console.log('val.name :>> ', val.name); |
|
console.log('_value :>> ', _value); |
|
if (_value > 0 && _value) val.value = _value |
|
else val.value = 0 |
|
}) |
|
|
|
} else { |
|
cargoName.questChildVOList.forEach((val, index) => { |
|
details.stateArr[index].isCheck = val.questNum === 0 ? false : true |
|
details.stateArr[index].value = val.questNum |
|
}) |
|
} |
|
|
|
} |
|
} |
|
|
|
/** 取消当前操作 */ |
|
const handleClose = () => { |
|
details.showControl = false |
|
// #ifdef APP |
|
utils.ttsspke('取消当前操作') |
|
// #endif |
|
} |
|
|
|
/** 批量修改状态 */ |
|
const batchEditState = () => { |
|
console.log('修改') |
|
// 重置状态 |
|
initState() |
|
// details.showControl = true |
|
popUp_EditState.value.setDetails({ |
|
title: '状态修改', |
|
confirmText: '确认修改', |
|
showPopUp: true, |
|
success() { |
|
const _value = details.stateArr.find(val => val.isCheck) |
|
|
|
let _number = 0 |
|
|
|
for (let i = 0; i <= details.renderList.length - 1; i++) { |
|
const _item = details.renderList[i] |
|
if (_item.isChoose) { |
|
_item.cargoName = _value.code |
|
_number++ |
|
if (_item.questStatus !== 1) { |
|
// 改变盘点状态 |
|
_item.questStatus = 1 |
|
details.scanNum++ |
|
} |
|
|
|
} |
|
// 重置选中状态 |
|
_item.isChoose = false |
|
} |
|
// #ifdef APP |
|
utils.ttsspke('成功修改' + _number + '件') |
|
// #endif |
|
// 关闭弹窗 |
|
popUp_EditState.value.details.showPopUp = false |
|
// 改变盘点状态 |
|
details.showControl = false |
|
console.log('111 :>> ', 111); |
|
} |
|
}) |
|
} |
|
|
|
/** 批量删除 */ |
|
const batchDelete = () => { |
|
// 开启弹窗 |
|
popUp_Handle.value.setDetails({ |
|
title: '批量删除', |
|
showPopUp: true, |
|
confirmText: '确认删除', |
|
async success() { |
|
const submitData = { questDetailIds: [], questId: details.pageInfos.questId, questNum: details.pageInfos.questNum } |
|
|
|
let _flag = false |
|
|
|
details.renderList.forEach((val, index) => { |
|
if (val.isChoose && val.questDetailId && val.isTask) submitData.questDetailIds.push(val.questDetailId) |
|
if (!val.isTask && (val.isNew || val.isManuallyAdd)) { |
|
// 删除新增但还未提交的数据 |
|
details.renderList.splice(index, 1) |
|
_flag = true |
|
} |
|
}) |
|
|
|
if (submitData.questDetailIds.length === 0 && !_flag) { |
|
popUp_Handle.value.details.showPopUp = false |
|
return uni.showToast({ |
|
title: '无可删除数据', |
|
icon: 'none' |
|
}) |
|
} |
|
|
|
if (submitData.questDetailIds.length !== 0) { |
|
const res = await getWarehouseTaskDeleteQuestChild(submitData) |
|
const { code, msg } = res |
|
if (code === 200 && msg) { |
|
uni.showToast({ |
|
title: msg, |
|
icon: 'none' |
|
}) |
|
|
|
details.renderList.forEach((val) => { |
|
if (val.isChoose && val.questDetailId && val.isTask) { |
|
val.questStatus = 0 |
|
val.isTask = false |
|
} |
|
}) |
|
} |
|
} |
|
|
|
details.scanNum = [...details.orderList, ...details.stockList].reduce((curr, item) => { |
|
if (item.questStatus === 1) return curr + 1 |
|
return curr |
|
}, 0) |
|
popUp_Handle.value.details.showPopUp = false |
|
details.showControl = false |
|
} |
|
}) |
|
} |
|
|
|
/** 显示物料 */ |
|
const handleShowMaterial = async () => { |
|
try { |
|
if (!details.addInfo.materialName) return |
|
const res = await postqueryfindMaterialList({ materialCode: details.addInfo.materialName }) |
|
const { code } = res |
|
if (code !== 200 || !res.data || res.data.length === 0) return uni.showToast({ |
|
title: '暂无数据', |
|
icon: 'none' |
|
}) |
|
details.materialNameList = res.data |
|
details.showList.showMaterial = true |
|
} catch (e) { |
|
//TODO handle the exception |
|
} finally { |
|
uni.hideLoading() |
|
} |
|
} |
|
|
|
/** 显示商城 */ |
|
const handleShowMarket = async () => { |
|
if (!details.addInfo.marketName) return |
|
try { |
|
uni.showLoading({ |
|
title: '数据请求中', |
|
mask: false |
|
}); |
|
const res = await pgetgetMaterialName({ code: details.addInfo.marketName, size: 500 }) |
|
const { code } = res |
|
if (code !== 200 || !res.data || res.data.records.length === 0) return uni.showToast({ |
|
title: '暂无数据', |
|
icon: 'none' |
|
}) |
|
details.marketNameList = res.data.records |
|
details.showList.showMarket = true |
|
} catch (e) { |
|
//TODO handle the exception |
|
} finally { |
|
uni.hideLoading() |
|
} |
|
|
|
} |
|
|
|
/** 批量上架 */ |
|
const batchUp = () => { |
|
// #ifdef APP |
|
utils.ttsspke('请扫描库位码') |
|
// #endif |
|
// 清空扫描的值 |
|
details.scancode = '' |
|
// 开启上架扫描 |
|
details.upScan = true |
|
|
|
// 判断是否全选 |
|
details.isAll = details.renderList.every(val => val.isChoose) |
|
|
|
let title = '批量上架' |
|
|
|
// 开启弹窗 |
|
popUp_Up.value.setDetails({ |
|
title, |
|
showPopUp: true, |
|
confirmText: '确认上架', |
|
success() { |
|
const { positionCode, allocationId } = details.positionInfo |
|
let content = '' |
|
let _number = 0 |
|
if (positionCode) { |
|
for (let i = 0; i <= details.renderList.length - 1; i++) { |
|
const _item = details.renderList[i] |
|
if (_item.isChoose) { |
|
// 改变库位信息 |
|
_item.allocationId = allocationId |
|
_item.allocation = positionCode |
|
_item.isChange = true |
|
|
|
_number++ |
|
|
|
if (_item.questStatus !== 1) { |
|
// 改变盘点状态 |
|
details.renderList[i].questStatus = 1 |
|
|
|
// 改变已盘点数 |
|
details.scanNum++ |
|
} |
|
} |
|
// 重置选中状态 |
|
_item.isChoose = false |
|
} |
|
content = '上架成功' + _number + '件' |
|
} else content = '上架失败, 库位数据有误' |
|
|
|
uni.showToast({ |
|
title: content, |
|
icon: 'none' |
|
}) |
|
// #ifdef APP |
|
utils.ttsspke(content) |
|
// #endif |
|
|
|
// 重置库位信息 |
|
details.positionInfo.allocationId = '' |
|
details.positionInfo.positionCode = '' |
|
|
|
// 关闭弹出层 |
|
popUp_Up.value.details.showPopUp = false |
|
details.showControl = false |
|
details.upScan = false |
|
}, |
|
close() { |
|
popUp_Up.value.details.showPopUp = false |
|
details.upScan = false |
|
} |
|
}) |
|
} |
|
|
|
/** 批量盘点 */ |
|
const batchCheck = () => { |
|
// 开启弹窗 |
|
popUp_Handle.value.setDetails({ |
|
title: '批量盘点', |
|
showPopUp: true, |
|
confirmText: '确认盘点', |
|
success() { |
|
for (let i = 0; i <= details.renderList.length - 1; i++) { |
|
const _item = details.renderList[i] |
|
if (_item.isChoose && _item.questStatus !== 1) { |
|
// 改变盘点状态 |
|
details.renderList[i].questStatus = 1 |
|
|
|
// 改变已盘点数 |
|
details.scanNum++ |
|
} |
|
// 重置选中状态 |
|
_item.isChoose = false |
|
|
|
} |
|
// #ifdef APP |
|
utils.ttsspke(details.scanNum + '件') |
|
// #endif |
|
popUp_Handle.value.details.showPopUp = false |
|
details.showControl = false |
|
} |
|
}) |
|
} |
|
|
|
/** 全选 */ |
|
const handleCheckAll = () => { |
|
if (details.renderList.length === 0) return |
|
for (let i = 0; i < details.renderList.length; i++) { |
|
details.renderList[i].isChoose = true |
|
} |
|
} |
|
|
|
/** 反选 */ |
|
const handleInvertSelection = () => { |
|
if (details.renderList.length === 0) return |
|
for (let i = 0; i < details.renderList.length; i++) { |
|
details.renderList[i].isChoose = !details.renderList[i].isChoose |
|
} |
|
} |
|
|
|
/** 复选框 */ |
|
const handleItemChoose = (_item : any) => { |
|
_item.isChoose = !_item.isChoose |
|
} |
|
|
|
/** 状态修改弹窗内按钮点击 -- 单选 */ |
|
const handleCheck = (_item : any) => { |
|
if (details.tabBarCode === 1) { |
|
// 有数据的情况 |
|
for (let i = 0; i < details.stateArr.length; i++) { |
|
const _value = details.stateArr[i] |
|
_value.value = 0 |
|
_value.isCheck = false |
|
} |
|
_item.isCheck = true |
|
_item.value = 1 |
|
if (_item.title === '破损' || _item.title === '不可修复') details.stateArr[0].value = 1 |
|
} else { |
|
console.log('details.stateArr[0].value :>> ', details.stateArr[0].value); |
|
// 无数据 |
|
if (_item.title === '在库') return |
|
|
|
// 当在库数为0时, 不能选择破损或不可修复 |
|
if (details.stateArr[0].value === 0 && _item.title === '破损' || details.stateArr[0].value === 0 && _item.title === '不可修复') return |
|
|
|
_item.isCheck = !_item.isCheck |
|
_item.disabled = !_item.isCheck |
|
if (_item.disabled && _item.code !== details.stateArr[0].code) _item.value = 0 |
|
} |
|
} |
|
|
|
/** 处理 */ |
|
const handleState = (_item : any) => { |
|
// 重置状态 |
|
if (details.tabBarCode === 1) initState(_item.cargoName) |
|
else initState(_item) |
|
popUp_EditState.value.setDetails({ |
|
title: '状态修改', |
|
confirmText: '确认修改', |
|
showPopUp: true, |
|
success() { |
|
if (tabBarCode.value === 1) { |
|
const _value = details.stateArr.find(val => val.isCheck) |
|
_item.cargoName = _value.code |
|
// 改变盘点状态 |
|
} else { |
|
details.stateArr.forEach(val => { |
|
if (val.isCheck && Number(val.value) !== 0) _item[val.name] = Number(val.value) |
|
}) |
|
} |
|
console.log('_item :>> ', _item); |
|
if (_item.questStatus !== 1) details.scanNum++ |
|
_item.questStatus = 1 |
|
// 改变已盘点数 |
|
// 关闭弹窗 |
|
popUp_EditState.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
|
|
/** 上架 */ |
|
const handleItemUp = (_item : any) => { |
|
// 获取库位码 |
|
details.scancode = _item.allocationId |
|
details.positionInfo.positionCode = _item.positionCode |
|
// 开启上架扫描 |
|
details.upScan = true |
|
popUp_Up.value.setDetails({ |
|
title: '上架', |
|
confirmText: '确认上架', |
|
showPopUp: true, |
|
success() { |
|
let content = '' |
|
const { allocationId, positionCode } = details.positionInfo |
|
|
|
if (positionCode) { |
|
_item.allocationId = allocationId |
|
_item.allocation = positionCode |
|
// 改变已盘点数 |
|
if (_item.questStatue !== 1) details.scanNum++ |
|
// 更改上架状态 |
|
_item.questStatus = 1 |
|
_item.isChange = true |
|
content = '上架成功' |
|
} else content = '上架失败, 库位数据有误' |
|
|
|
uni.showToast({ |
|
title: content, |
|
icon: 'none' |
|
}) |
|
// #ifdef APP |
|
utils.ttsspke(content) |
|
// #endif |
|
|
|
// 重置库位数据 |
|
details.positionInfo.positionCode = '' |
|
details.positionInfo.allocationId = '' |
|
// 关闭上架扫描 |
|
popUp_Up.value.details.showPopUp = false |
|
details.upScan = false |
|
}, |
|
close() { |
|
popUp_Up.value.details.showPopUp = false |
|
details.upScan = false |
|
} |
|
}) |
|
} |
|
|
|
/** 新增零担 */ |
|
const handleAddZero = () => { |
|
popUp_AddZero.value.setDetails({ |
|
title: '新增零担', |
|
showPopUp: true, |
|
success() { |
|
if (!details.addInfo.orderCode) return uni.showToast({ |
|
title: '请输入合同号', |
|
icon: 'none' |
|
}) |
|
if (!details.addInfo.materialName) return uni.showToast({ |
|
title: '请输入物料名称', |
|
icon: 'none' |
|
}) |
|
const _number = Number(details.addInfo.quantity) |
|
if (_number !== _number || _number <= 0) return uni.showToast({ |
|
title: '数量为大于0的数字', |
|
icon: 'none' |
|
}) |
|
const _order = { |
|
questStatus: 1, |
|
orderCode: details.addInfo.orderCode, |
|
waybillNumber: details.addInfo.waybillNumber, |
|
positionCode: '', |
|
quantity: _number, |
|
materialName: details.addInfo.materialName, |
|
cargoName: 10, |
|
stockNum: _number, |
|
isChoose: false, |
|
/** 为手动添加 */ |
|
isManuallyAdd: true, |
|
/** 物料类型 */ |
|
questTarget: 2 |
|
} |
|
if (details.pageType === 2) { |
|
_order.allocationId = details.pageInfos.allocationId |
|
_order.allocation = details.pageInfos.positionCode |
|
} |
|
else if (details.pageType === 3) { |
|
_order.orderCode = details.pageInfos.orderCode |
|
_order.orderId = details.pageInfos.orderId |
|
} |
|
else if (details.pageType === 4) { |
|
_order.trayCode = details.pageInfos.trayCode |
|
_order.trayId = details.pageInfos.trayId |
|
} |
|
details.stockList.push(_order) |
|
details.scanNum++ |
|
// 清空数据 |
|
details.addInfo = {} |
|
// 关闭弹窗 |
|
popUp_AddZero.value.details.showPopUp = false |
|
}, |
|
close() { |
|
details.addInfo = {} |
|
popUp_AddZero.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
|
|
/** 新增库存品 */ |
|
const handleAddStock = () => { |
|
popUp_AddStock.value.setDetails({ |
|
title: '新增库存品', |
|
showPopUp: true, |
|
success() { |
|
if (!details.addInfo.orderCode && !details.addInfo.incomingBatch) return uni.showToast({ |
|
title: '请输入合同号或批次号', |
|
icon: 'none' |
|
}) |
|
// if (!details.addInfo.incomingBatch) return uni.showToast({ |
|
// title: '请输入批次号', |
|
// icon: 'none' |
|
// }) |
|
if (!details.addInfo.clientName) return uni.showToast({ |
|
title: '请输入正确的商场', |
|
icon: 'none' |
|
}) |
|
if (!details.addInfo.materialName) return uni.showToast({ |
|
title: '请输入物料名称', |
|
icon: 'none' |
|
}) |
|
const _number = Number(details.addInfo.quantity) |
|
if (_number !== _number || _number <= 0) return uni.showToast({ |
|
title: '数量为大于0的数字', |
|
icon: 'none' |
|
}) |
|
const _order = { |
|
questStatus: 1, |
|
orderCode: details.addInfo.orderCode, |
|
incomingBatch: details.addInfo.incomingBatch, |
|
positionCode: '', |
|
quantity: _number, |
|
materialName: details.addInfo.materialName, |
|
clientName: details.addInfo.clientName, |
|
cargoName: 10, |
|
stockNum: _number, |
|
isChoose: false, |
|
/** 为手动添加 */ |
|
isManuallyAdd: true, |
|
/** 物料类型 */ |
|
questTarget: 3 |
|
} |
|
if (details.pageType === 2) { |
|
_order.allocationId = details.pageInfos.allocationId |
|
_order.allocation = details.pageInfos.positionCode |
|
} |
|
else if (details.pageType === 3) { |
|
_order.orderCode = details.pageInfos.orderCode |
|
_order.orderId = details.pageInfos.orderId |
|
} |
|
else if (details.pageType === 4) { |
|
_order.trayCode = details.pageInfos.trayCode |
|
_order.trayId = details.pageInfos.trayId |
|
} |
|
details.stockList.push(_order) |
|
details.scanNum++ |
|
// 清空数据 |
|
details.addInfo = {} |
|
// 关闭弹窗 |
|
popUp_AddStock.value.details.showPopUp = false |
|
}, |
|
close() { |
|
details.addInfo = {} |
|
details.materialNameList = [] |
|
details.marketNameList = [] |
|
popUp_AddStock.value.details.showPopUp = false |
|
} |
|
}) |
|
} |
|
|
|
/** 左侧返回按钮 */ |
|
const leftClick = () => { |
|
/* popUp_Handle.value.setDetails({ |
|
title: '有数据未提交, 是否返回', |
|
showPopUp: true, |
|
confirmText: '确认返回 ', |
|
success() { |
|
uni.navigateBack() |
|
} |
|
}) */ |
|
uni.navigateBack() |
|
} |
|
|
|
/** 确认 */ |
|
const handleConFirm = () => { |
|
switch (details.handleType) { |
|
case 1: // 批量修改状态 |
|
batchEditState() |
|
break; |
|
|
|
case 2: // 批量删除 |
|
batchDelete() |
|
break; |
|
|
|
case 3: // 批量上架 |
|
batchUp() |
|
break; |
|
|
|
case 4: // 批量盘点 |
|
batchCheck() |
|
break; |
|
} |
|
} |
|
|
|
/** 输入 */ |
|
const inputNum = (_item) => { |
|
let _maxNum = details.stateArr[0].value - details.stateArr[2].value - details.stateArr[4].value - details.stateArr[5].value |
|
|
|
let _number = Number(_item.value) |
|
if (_number !== _number) return _item.value = 0 |
|
else if (_number <= 0) return _item.value = 0 |
|
else if (_maxNum < 0) _item.value = 0 |
|
else _item.value = _number |
|
} |
|
|
|
/** 提交盘点*/ |
|
const submitCheck = async () => { |
|
try { |
|
if (details.orderList.length === 0 && details.stockList.length === 0) return |
|
// 开启loading动画 |
|
uni.showLoading({ |
|
title: '提交中', |
|
mask: true |
|
}) |
|
// 提交信息 |
|
const submitData = { |
|
questId: details.pageInfos.questId, |
|
questNum: details.pageInfos.questNum, |
|
// 在库的ids数组 |
|
questDetailIds: [], |
|
// 其它类型组成的数组 |
|
questDetailList: [] |
|
} |
|
details.orderList.forEach(val => { |
|
if (Number(val.questStatus) !== 1) return |
|
|
|
// 不是新增的且状态为在库 |
|
if (!val.isManuallyAdd |
|
// && !val.isNew |
|
// && !val.isChange |
|
&& Number(val.cargoName) === 10 |
|
) { |
|
console.log('1 :>> ', 1); |
|
submitData.questDetailIds.push(val.questDetailId) |
|
if (!val.isChange) return |
|
} |
|
|
|
|
|
const _item = { |
|
/** 在库数量 */ |
|
stockNum: 1, |
|
/** 丢失数量 */ |
|
lossNum: 0, |
|
/** 配送数量 */ |
|
deliveNum: 0, |
|
/** 破损数量 */ |
|
wornNum: 0, |
|
/** 不可修复数量 */ |
|
noRepairNum: 0, |
|
/** 未入库数量 */ |
|
noReceivedNum: 0, |
|
id: val.questDetailId, |
|
/** 上架修改后的库位id */ |
|
groundingAllocationId: val.allocationId, |
|
groundingPositionCode: val.allocation, |
|
questId: details.pageInfos.questId, |
|
questNum: details.pageInfos.questNum, |
|
orderCode: val.orderCode, |
|
orderId: val.orderId, |
|
questType: details.pageType, |
|
questTarget: val.questTarget, |
|
isNew: 0 |
|
} |
|
_item.isNew = val.isManuallyAdd ? 1 : 0 |
|
|
|
if (val.isNew || val.isManuallyAdd) { |
|
if (details.pageType === 2) { |
|
_item.allocationId = details.pageInfos.allocationId |
|
_item.positionCode = details.pageInfos.allocation |
|
// 当修改前和修改后的Id一样时, 删除修改后的 |
|
if (_item.groundingAllocationId === _item.allocationId) { |
|
delete _item.groundingAllocationId |
|
delete _item.groundingPositionCode |
|
} |
|
} |
|
else if (details.pageType === 4) { |
|
_item.trayCode = val.trayCode |
|
_item.trayId = val.trayId |
|
} |
|
_item.orderPackageCode = val.orderPackageCode |
|
_item.orderPackageId = val.orderPackageId |
|
} |
|
|
|
// 不改变在库数的 |
|
const _whiteCodeArr = [10, 20, 40] |
|
|
|
if (!_whiteCodeArr.includes(Number(val.cargoName))) _item.stockNum = 0 |
|
const _key = details.stateArr.find(value => value.code === Number(val.cargoName)).name |
|
// 对状态赋值 |
|
_item[_key] = 1 |
|
submitData.questDetailList.push(_item) |
|
|
|
}) |
|
details.stockList.forEach(val => { |
|
if (Number(val.questStatus) !== 1) return |
|
|
|
if (!val.isManuallyAdd |
|
&& !val.isNew |
|
&& val.lossNum === 0 |
|
&& val.deliveNum === 0 |
|
&& val.wornNum === 0 |
|
&& val.noRepairNum === 0 |
|
&& val.noReceivedNum === 0 |
|
&& Number(val.cargoName) === 1 |
|
// && !val.isChange |
|
) { |
|
submitData.questDetailIds.push(val.questDetailId) |
|
if (!val.isChange) return |
|
} |
|
const _item = { |
|
/** 在库数量 */ |
|
stockNum: val.stockNum || 0, |
|
/** 丢失数量 */ |
|
lossNum: val.lossNum || 0, |
|
/** 配送数量 */ |
|
deliveNum: val.deliveNum || 0, |
|
/** 破损数量 */ |
|
wornNum: val.wornNum || 0, |
|
/** 不可修复数量 */ |
|
noRepairNum: val.noRepairNum || 0, |
|
/** 未入库数量 */ |
|
noReceivedNum: val.noReceivedNum || 0, |
|
/** 上架后的库位id */ |
|
groundingAllocationId: val.allocationId, |
|
groundingPositionCode: val.allocation, |
|
id: val.questDetailId, |
|
questId: details.pageInfos.questId, |
|
waybillNumber: val.waybillNumber, |
|
quantity: val.quantity, |
|
materialName: val.materialName, |
|
orderCode: val.orderCode, |
|
orderId: val.orderId, |
|
questType: details.pageType, |
|
questTarget: val.questTarget, |
|
isNew: 0 |
|
} |
|
// 计算在库数 |
|
_item.stockNum = _item.stockNum - _item.lossNum - _item.deliveNum - _item.noReceivedNum |
|
_item.isNew = val.isManuallyAdd ? 1 : 0 |
|
|
|
if (_item.isNew === 1) { |
|
if (details.pageType === 2) { |
|
_item.allocationId = details.pageInfos.allocationId |
|
_item.positionCode = details.pageInfos.allocation |
|
// 当修改前和修改后的Id一样时, 删除修改后的 |
|
if (_item.groundingAllocationId === _item.allocationId) { |
|
delete _item.groundingAllocationId |
|
delete _item.groundingPositionCode |
|
} |
|
} |
|
else if (details.pageType === 4) { |
|
_item.trayCode = val.trayCode |
|
_item.trayId = val.trayId |
|
} |
|
} |
|
|
|
|
|
submitData.questDetailList.push(_item) |
|
|
|
}) |
|
console.log('submitData :>> ', submitData); |
|
const res = await postWarehouseTaskAddDataInfo(submitData) |
|
console.log('res :>> ', res); |
|
const { code } = res |
|
if (code === 200) { |
|
utils.ttsspke('盘点成功') |
|
const timer = setTimeout(() => { |
|
// 提交成功返回上一级页面 |
|
uni.navigateBack() |
|
clearTimeout(timer) |
|
}, 1000) |
|
} |
|
} catch (err) { |
|
console.log('err :>> ', err); |
|
//TODO handle the exception |
|
} finally { |
|
// 关闭Loading动画 |
|
uni.hideLoading() |
|
} |
|
} |
|
|
|
const { |
|
pageType, |
|
showControl, |
|
tabBarCode |
|
} = toRefs(details) |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
$buttonColor: #d3832a; |
|
|
|
// 本页按钮样式 |
|
.button { |
|
font-size: 28upx; |
|
padding: 10upx 20upx; |
|
border: 1upx solid $buttonColor; |
|
background-color: #fff; |
|
color: #d3832a; |
|
border-radius: 5upx; |
|
// zoom: 90%; |
|
} |
|
|
|
.main, |
|
.head { |
|
padding: 10upx; |
|
font-size: 28upx; // 本页字体大小 |
|
} |
|
|
|
.head { |
|
background: #fff; |
|
} |
|
|
|
.head_top { |
|
display: flex; |
|
// align-items: center; |
|
justify-content: space-between; |
|
margin: 10upx 0; |
|
|
|
// 顶部搜索框 |
|
&_search { |
|
flex: 1; |
|
padding-left: 20upx; |
|
margin-right: 20upx; |
|
box-sizing: border-box; |
|
height: 28upx * 2; |
|
border-radius: 28upx; |
|
border: 1upx solid #000; |
|
} |
|
|
|
.button { |
|
background-color: $buttonColor; |
|
color: #fff; |
|
padding: 0 60upx; |
|
display: inline-flex; |
|
align-items: center; |
|
} |
|
} |
|
|
|
// tabBar选项卡 |
|
.tabBar { |
|
display: flex; |
|
justify-content: space-evenly; |
|
margin-bottom: 10upx; |
|
|
|
&-item { |
|
position: relative; |
|
flex: 1; |
|
flex-basis: 0; |
|
padding: 20upx 0; |
|
text-align: center; |
|
|
|
&::after { |
|
content: ''; |
|
position: absolute; |
|
bottom: 0; |
|
left: 50%; |
|
display: block; |
|
width: 0; |
|
box-sizing: border-box; |
|
background: #d3832a; |
|
height: 4upx; |
|
transition: all 0.5s; |
|
} |
|
|
|
&.active::after { |
|
left: 0; |
|
width: 100%; |
|
} |
|
} |
|
} |
|
|
|
// 控件区 |
|
.control { |
|
margin-top: 20upx; |
|
display: flex; |
|
flex-wrap: wrap; |
|
justify-content: space-between; |
|
|
|
.controlList { |
|
display: flex; |
|
|
|
.button { |
|
margin: 0 5upx; |
|
|
|
&:last-child { |
|
margin-right: 0; |
|
} |
|
} |
|
} |
|
} |
|
|
|
// 盘点数据 |
|
.checkInfo { |
|
font-size: 28upx; |
|
zoom: 0.9; |
|
margin: 20upx 0 10upx; |
|
display: flex; |
|
color: #666; |
|
|
|
// checkInfo_item |
|
&_item { |
|
word-break: break-all; |
|
display: inline-flex; |
|
align-items: center; |
|
|
|
>text:first-child { |
|
margin-right: 10upx; |
|
} |
|
} |
|
} |
|
|
|
.scvmabx { |
|
height: 65vh; |
|
|
|
.main_footer { |
|
height: 200upx; |
|
} |
|
} |
|
|
|
// 渲染 |
|
.main_render { |
|
display: flex; |
|
background: #fff; |
|
padding: 10upx; |
|
zoom: 0.85; |
|
overflow: hidden; |
|
position: relative; |
|
margin-bottom: 10upx; |
|
border-radius: 10upx; |
|
|
|
$renderWidth: 80upx; |
|
|
|
// 已盘状态 |
|
&.active { |
|
border: 1upx solid #16d46b; |
|
box-shadow: 0 0 10upx #16d46b; |
|
} |
|
|
|
// 删除状态 |
|
&.delete { |
|
border: 1upx solid #f55; |
|
box-shadow: 0 0 10upx #f55; |
|
} |
|
|
|
// 修改状态 |
|
&.edit { |
|
border: 1upx solid #3c9cff; |
|
box-shadow: 0 0 10upx #3c9cff; |
|
} |
|
|
|
// main_render_checkImg |
|
&_checkImg { |
|
width: 64upx; |
|
height: 64upx; |
|
} |
|
|
|
// main_render_container |
|
&_container { |
|
flex: 1; |
|
} |
|
|
|
// main_render_item |
|
&_item { |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: flex-start; |
|
margin-top: 20upx; |
|
|
|
&:first-child { |
|
margin-top: 0; |
|
} |
|
|
|
&>view { |
|
flex: auto; |
|
word-break: break-all |
|
} |
|
|
|
// main_render_item_type |
|
&_type { |
|
display: inline-block; |
|
background: #3c9cff; |
|
color: #fff; |
|
padding: 5upx 10upx; |
|
border-radius: 5upx; |
|
|
|
&.active { |
|
background: #f55; |
|
} |
|
} |
|
|
|
.button_box { |
|
display: inline-flex; |
|
justify-content: space-evenly; |
|
} |
|
|
|
.button { |
|
zoom: 0.9; |
|
} |
|
} |
|
} |
|
|
|
// 弹出层提示信息 |
|
.popUpTitle { |
|
font-size: 28upx; |
|
color: #666; |
|
zoom: 0.9; |
|
} |
|
|
|
// 弹出层内的输入框 |
|
.popUpInput { |
|
border: 4upx solid #eee; |
|
padding: 10upx; |
|
border-radius: 10upx; |
|
margin-top: 30upx; |
|
} |
|
|
|
// 上架货位信息 |
|
.popUpInfo { |
|
margin-top: 20upx; |
|
font-size: 34upx; |
|
color: #000; |
|
zoom: 0.9; |
|
} |
|
|
|
.popUp_EditState_container { |
|
// height: 40vh; |
|
margin-top: 60upx; |
|
width: 100%; |
|
display: flex; |
|
flex-wrap: wrap; |
|
} |
|
|
|
// 状态处理 |
|
.popUp_row { |
|
width: 50%; |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
font-size: 28upx; |
|
zoom: 0.9; |
|
margin-bottom: 20upx; |
|
|
|
// popUp_row_item |
|
&_item { |
|
width: 50%; |
|
display: flex; |
|
} |
|
|
|
// popUp_row_checkImg |
|
&_checkImg { |
|
width: 40upx; |
|
height: 40upx; |
|
} |
|
|
|
// popUp_row_title |
|
&_title { |
|
flex: 1; |
|
padding-left: 10upx; |
|
} |
|
|
|
.input { |
|
width: 40%; |
|
height: 32upx; |
|
border: 1upx solid #eee; |
|
margin-right: 20upx; |
|
padding: 5upx; |
|
border-radius: 5upx; |
|
} |
|
} |
|
|
|
.popUp_Add_row { |
|
margin-top: 10upx; |
|
display: flex; |
|
justify-content: space-between; |
|
font-size: 28upx; |
|
align-items: center; |
|
position: relative; |
|
|
|
.popUpInput { |
|
width: 70%; |
|
margin-top: 0; |
|
} |
|
|
|
.select_content { |
|
position: absolute; |
|
z-index: 99; |
|
top: 120%; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
background: #fff; |
|
border: 1upx solid #eee; |
|
width: 100%; |
|
overflow: hidden; |
|
|
|
view { |
|
text-align: center; |
|
padding: 20upx 0; |
|
border-bottom: 1upx solid #000; |
|
|
|
&:last-child { |
|
border-bottom: 0; |
|
} |
|
} |
|
} |
|
} |
|
|
|
// 提交按钮 |
|
.submitButton { |
|
position: fixed; |
|
color: #fff; |
|
background-color: $buttonColor; |
|
width: 40%; |
|
bottom: 30upx; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
font-size: 30upx; |
|
} |
|
</style> |