123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <!-- 手动出库 -->
- <template>
- <view class="container-wrap">
- <uni-nav-bar title="手动出库" :status-bar="true" background-color="#3F92F9" color="#FFF">
- <view slot="left">
- <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
- <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
- </view>
- <view slot="right" @tap="$utils.back()">
- <span style="color: #FFFFFF;">返回</span>
- </view>
- </uni-nav-bar>
- <view class="container">
- <view class="title">
- <span>
- <span style="color: red;">*</span>
- 出库信息
- </span>
- </view>
- <view class="text">
- <view class="label">领料人:</view>
- <select-lay :value="operateUser" placeholder="默认当前用户" :options="userList" @selectitem="selectitem" :zindex="2000"></select-lay>
- </view>
- <view class="text">
- <view class="label">仓库:</view>
- <select-lay :zindex="1000" :value="plcStationCode" :options="selectList" @selectitem="storeSelectitem"></select-lay>
- </view>
- <view class="text">
- <view class="label">出库类型:</view>
- <select-lay :value="stockChangeType" :options="typeList" @selectitem="typeSelectitem"></select-lay>
- </view>
- <view class="text" style="align-items: flex-start;">
- <view class="label">备注:</view>
- <u-input v-model="remark" type="textarea" :border="true" />
- </view>
- <view class="text" style="margin: 20rpx 0 30rpx 0;">
- <view class="label">领料时间:</view>
- <view style="line-height: 1;">{{ time }}</view>
- </view>
- <view class="title flex-between">
- <span>
- <span style="color: red;">*</span>
- 出库列表
- </span>
- <a href="#" @click="scan">+扫描添加</a>
- </view>
- <view class="list">
- <view class="item" v-for="(item, index) in scanList" :key="index">
- <view class="row">
- <view class="col">
- <view class="value">{{ item.materialCode }}</view>
- </view>
- <view class="col">
- <view class="value">{{ item.materialName }}</view>
- </view>
- </view>
- <view class="row sub-row">
- <view class="col">
- <view class="label">规格:</view>
- <view class="value">{{ item.spec }}</view>
- </view>
- <view class="col">
- <view class="label">数量:</view>
- <view class="value">{{ item.quantity }}米</view>
- </view>
- </view>
- </view>
- </view>
- <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
- </view>
- </view>
- </template>
- <script>
- import DateFormat from '../../../js_sdk/xfl-DateFormat/DateFormat.js';
- export default {
- data() {
- return {
- timer: null,
- time: new DateFormat(new Date()).toString(),
- show: false,
- operateUser: this.$storage.getStorageSync('userInfo').id,
- userInfo: this.$storage.getStorageSync('userInfo'),
- plcStationCode: '1',
- stockChangeType: '20',
- remark: '',
- isReading: false,
- scanList: [],
- userList: [],
- selectList: [],
- typeList: [
- { label: '出库', value: 20 },
- { label: '盘点删除', value: 21 },
- { label: '补出库', value: 23 },
- ],
- roleKey:null,
- accountNo:null,
- token:this.$storage.getStorageSync('token'),
- };
- },
- methods: {
- /* 选择类型 */
- typeSelectitem(index, item) {
- this.stockChangeType = item.value;
-
- },
- /* 选择领料人 */
- selectitem(index, item) {
- this.operateUser = item.value;
- this.roleKey = item.roleKey
- this.accountNo = item.accountNo
- console.log(this.accountNo)
- },
- /* 选择仓库 */
- storeSelectitem(index, item) {
- this.plcStationCode = item.value;
- uni.setStorage({
- key: 'plcStationCode',
- data: item.value
- })
- },
- cfm(){
- let obj = {
- userId: this.operateUser,
- plcCode: this.plcStationCode * 1,
- //rfidItems:['B00000000000000000030854'],
- rfidItems: this.scanList.map(item => item.rfidCode),
- stockChangeType: this.stockChangeType,
- remark: this.remark,
- device:1,
- }
- console.log(obj)
-
- if((this.roleKey == 'sewing' || this.roleKey == 'crop' || this.roleKey == '001')){
- if(this.stockChangeType == 20){
- this.materialReceiveSubmit(obj)
- return
- }
- }
- if(this.stockChangeType == 23){
- this.materialReceiveSubmit(obj)
- return
- }
-
- uni.request({
- url: 'http://120.79.80.64:8050' + '/cloudApi/stock/out',
- method: 'POST',
- header:{
- 'Content-Type' : 'application/json',
- },
- data: obj,
- success: res => {
- console.log(res)
- if(res.data.code == 200){
- this.$msg.showToast(res.msg || '操作成功!')
- this.timer = setTimeout(() => {
- this.$utils.back()
- }, 2000)
- }
-
- },fail(err) {
- console.log(err);
- }
- });
- // this.$http.HandleMacStockInOut(obj).then(res => {
- // console.log(res)
- // if(res.code === 0) {
-
- // this.$msg.showToast(res.msg || '操作成功!')
- // this.timer = setTimeout(() => {
- // this.$utils.back()
- // }, 2000)
- // }
- // })
- },
- materialReceiveSubmit(obj){
- console.log({
- rfidItems: this.scanList.map(item => item.rfidCode),
- submitUserId:this.userInfo.id,
- submitUserAccount:this.userInfo.account,
- receiveUserAccount: this.accountNo,
- type:(this.stockChangeType == 20) ? 1 : 2,
- userId: this.operateUser,
- plcCode: this.plcStationCode,
- rfidItems: this.scanList.map(item => item.rfidCode),
- stockChangeType: this.stockChangeType,
- remark: this.remark,
- token:this.token
- })
- uni.request({
- url: 'http://120.79.80.64:8050' + '/cloudApi/materialReceiving/submit',
- method: 'POST',
- header:{
- 'Content-Type' : 'application/json',
- },
- data: {
- rfidItems: this.scanList.map(item => item.rfidCode),
- submitUserId:this.userInfo.id,
- submitUserAccount:this.userInfo.account,
- receiveUserAccount: this.accountNo,
- type:(this.stockChangeType == 20) ? 1 : 2,
- userId: this.operateUser,
- plcCode: this.plcStationCode,
- rfidItems: this.scanList.map(item => item.rfidCode),
- stockChangeType: this.stockChangeType,
- remark: this.remark,
- token:this.token
- },
- success: res => {
- console.log(res)
- if(res.data.code == 200){
- this.$msg.showToast(res.msg || '操作成功!')
- this.timer = setTimeout(() => {
- this.$utils.back()
- }, 2000)
- }
-
- },fail(err) {
- console.log(err);
- }
- });
- },
- /* 扫描添加 */
- scan() {
- this.$utils.open('/pages/store-out-manage/store-out/store-out-scan')
- },
- getList () {
- this.$http.GetApplyStockOutTemp().then(res => {
- console.log(res)
- if(res.code === 0) {
- this.scanList = res.result
- }
- })
- },
- /* 添加扫描到的退货数据 */
- pushData(data) {
- console.log(this.scanList)
- let flag = true
- this.scanList.forEach(item => {
- if(item.rfidCode === data.rfidCode) {
- flag = false
- }
- })
- if(flag) {
- this.scanList.push(data)
- } else {
- setTimeout(() => {
- this.$msg.showToast('标签已存在!')
- }, 100)
- }
- },
- /* 获取用户列表 */
- getUserPageList() {
- uni.request({
- url: 'http://120.79.80.64:8050' + '/cloudApi/uUser/list',
- method: 'POST',
- header: {
- 'Content-Type': 'application/json',
- },
- data: {
- deptIdList: ['A012', 'A008', 'A007', 'A017', 'A005'],
- },
- success: res => {
- console.log(res)
- let list = res.data.data.map((item) => {
- return {
- label: item.realname,
- value: item.id,
- name: item.realname,
- }
- })
- this.userList = list
-
- },
- });
-
- },
- /* 手持机获取仓库 */
- getStockHouse() {
- this.$http.GetStockHouse().then(res => {
- if(res.code === 0) {
- this.selectList = res.result.map(item => {
- return {
- label: item.name,
- value: item.plcCode
- }
- })
- }
- })
- }
- },
- onLoad(option) {
- this.getUserPageList()
- this.getStockHouse()
- console.log(this.$storage.getStorageSync('token'),'token')
- uni.$on('scan-list', res => {
- console.log('?????????????')
- console.log(res)
- this.pushData(res)
- })
- uni.getStorage({
- key: 'plcStationCode',
- success: (res) => {
- this.plcStationCode = res.data
- }
- });
- },
- onUnload() {
- clearTimeout(this.timer)
- uni.$off('scan-list')
- }
- }
- </script>
- <style lang="scss" scoped>
- .container-wrap {
- overflow: hidden;
- .container {
- padding: 20rpx;
- height: calc(100vh - var(--status-bar-height) - 44px);
- overflow: auto;
- padding-bottom: 100rpx;
- .text {
- padding: 10rpx 0;
- display: flex;
- align-items: center;
- font-size: 24rpx;
- .label {
- width: 150rpx;
- text-align: right;
- }
- }
- .list {
- margin: 10rpx 0;
- .item {
- padding: 20rpx;
- margin-bottom: 10rpx;
- background-color: #FFFFFF;
- border: 1rpx solid rgba(215, 215, 215, 1);
- border-radius: 10rpx;
- .row {
- &.border {
- border-bottom: 1px solid rgba(215, 215, 215, 1);
- }
- .label {
- width: 80rpx;
- }
- .col {
- &:last-child {
- justify-content: flex-end;
- }
- }
- }
- .sub-row {
- align-items: flex-start;
- .label, .value {
- font-size: 24rpx;
- color: #7F7F7F;
- }
- }
- }
- }
- }
- }
- </style>
|