| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562 |
- <template>
- <view class="content-box">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="领料" background-color="#F7F9FA"
- color="#404446" @clickLeft="back"></uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view v-for="(item,index) in List" :key="index" class="card_box">
- <view class="title_box rx-bc">
- <view class="left rx-sc">
- <view class="round">{{index + 1}}</view>
- <view class="code">工单编号:{{item.code}}</view>
- </view>
- <view class="right_box rx-ec">
- <u-button type="success" size="small" class="u-reset-button"
- @click="addPicking(item.workOrderId, item)" text="添加物料"></u-button>
- </view>
- </view>
- <view class="material rx-ss" v-for="(mate, idx) in item.bomList">
- <view class="left rx-ss" @click="mate.checked = ! mate.checked">
- <view class="zdy_check rx-cc" :class="{ check_active : mate.checked }">
- <u-icon size="28" v-if='mate.checked' name='checkbox-mark'></u-icon>
- </view>
- </view>
- <view class="content_table">
- <view class="item">
- <view class="lable rx-cc">物料编码</view>
- <view class="content">
- {{mate.categoryCode}}
- </view>
- </view>
- <view class="item">
- <view class="lable rx-cc">名称</view>
- <view class="content">{{mate.categoryName}}</view>
- </view>
- <view class="item rx-sc">
- <view class="rx ww55 ">
- <view class="lable rx-cc">牌号</view>
- <view class="content ">{{mate.brandNum}}</view>
- </view>
- <view class="rx ww45">
- <view class="lable rx-cc ww80">数量</view>
- <view class="content content_num">
- <input class="uni-input" v-model="mate.demandQuantity" type="digit"></input>
- <view class="unit">{{mate.unit}}</view>
- </view>
- </view>
- </view>
- <view class="item">
- <view class="lable rx-cc">领料仓库</view>
- <view class="content pd4">
- <zxz-uni-data-select :localdata="mate.warehouseList" v-model="mate.warehouseId"
- dataValue='id' format='{name}' dataKey="name" filterable
- :clear='false'></zxz-uni-data-select>
- </view>
- </view>
- </view>
- </view>
- <view>
- <instanceBom :list='item.instanceList2'></instanceBom>
- <modelBom :workOrderId='item.workOrderId' :modelList='item.modelList'
- :modelList2='item.modelList2' :code='item.code' @hendDel='hendDel'>
- </modelBom>
- <boatBom :palletList='item.palletList' :palletList2='item.palletList2' :code='item.code'
- @hendDel='hendDel'>
- </boatBom>
- <packingBom :list='item.packingList2'></packingBom>
-
-
-
- <semiProductBom :list="item.semiProductList2"></semiProductBom>
-
- <view class='flex_btn' v-if='isPick' @click="openDetails">已有领料单</view>
- </view>
- </view>
- </u-list>
- </view>
- <view class="bottom-wrapper">
- <view class="btn_box" @click="save">提交</view>
- </view>
- </view>
- </template>
- <script>
- import instanceBom from './components/instanceBom.vue'
- import modelBom from './components/modelBom.vue'
- import boatBom from './components/boatBom.vue'
- import packingBom from './components/packingBom'
- import semiProductBom from './components/semiProductBom'
- import {
- workorderList
- } from '@/api/pda/workOrder.js'
- import {
- batchSave,
- pickDetails
- } from '@/api/pda/picking.js'
- export default {
- components: {
- instanceBom,
- modelBom,
- boatBom,
- packingBom,
- semiProductBom
- },
- data() {
- return {
- idsList: [],
- List: [],
- classificationList: [], //分类数据
- taskId: null,
- isPick: false,
- }
- },
- onLoad(options) {
- let queryArray = decodeURIComponent(options.arr);
- this.idsList = JSON.parse(queryArray);
- this.taskId = options.taskId
- this.getList()
- if (this.idsList.length == 1) {
- this.getPick()
- }
- },
- onShow() {
- uni.$off("setSelectList");
- uni.$on("setSelectList", (selectList, id) => {
- this.List.forEach(m => {
- if (m.workOrderId == id) {
- let instanceList2 = [] // 投料
- let modelList2 = [] // 模具
- let palletList2 = []
- let packingList2 = [] // 包装
- let semiProductList2 = [] //半成品
-
- console.log(selectList)
- selectList.forEach(f => {
- if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8 && f
- .rootCategoryLevelId != 13 && f.rootCategoryLevelId != 23) {
- f.automatic = 1
- instanceList2 = instanceList2.concat(f)
- } else if (f.rootCategoryLevelId == 5) { // 模具
- f.automatic = 1
- modelList2 = modelList2.concat(f)
- } else if (f.rootCategoryLevelId == 8) { // 舟皿
- f.automatic = 1
- palletList2 = palletList2.concat(f)
- } else if (f.rootCategoryLevelId == 13) {
- f.automatic = 1
- packingList2 = packingList2.concat(f)
- } else if(f.rootCategoryLevelId == 23) {
- f.automatic = 1
- semiProductList2 = semiProductList2.concat(f)
- }
- })
- this.$set(m, 'instanceList2', instanceList2)
- this.$set(m, 'modelList2', modelList2)
- this.$set(m, 'palletList2', palletList2)
- this.$set(m, 'packingList2', packingList2)
- this.$set(m, 'semiProductList2', semiProductList2)
-
-
- }
- })
- });
- },
- methods: {
- scrolltolower() {},
- save() {
- let _arr = []
- _arr = this.List.map(m => {
- if (m.bomList.length > 0) {
- let bomList = m.bomList.filter(f => f.checked)
- m['bomDetailDTOSList'] = [...bomList, ...m.modelList, ...m.palletList]
- }
- m.instanceList = [...m.instanceList2, ...m.modelList2, ...m.palletList2, ...m.packingList2, ...m.semiProductList2]
- return {
- ...m
- }
- })
- batchSave(_arr).then(res => {
- uni.navigateTo({
- url: `/pages/pda/picking/index/index?pickStatus=1`,
- });
- })
- },
- getList() {
- workorderList({
- ids: this.idsList,
- taskId: this.taskId
- }).then(res => {
- this.List = res.map(m => {
- m.workOrderId = m.id
- let modelList = []
- let palletList = []
- let bomList = []
- m.bomDetailDTOS.forEach((f, i) => {
- if (f.rootCategoryLevelId == 5) {
- f.automatic = 2
- modelList = modelList.concat(f)
- }
- if (f.rootCategoryLevelId == 8) {
- f.automatic = 2
- palletList = palletList.concat(f)
- }
- if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
- f.automatic = 2
- bomList = bomList.concat(f)
- }
- })
- m['modelList'] = modelList
- m['palletList'] = palletList
- m['bomList'] = bomList
- m['modelList2'] = []
- m['instanceList2'] = []
- m['palletList2'] = []
- m['packingList2'] = []
- m['semiProductList2'] = []
- delete m.id
- return {
- ...m
- }
- })
- })
- },
- hendDel(type, code, list) {
- if (type == 'modelBom') {
- console.log(list.length)
- if (list.length == 0) {
- }
- this.List.forEach(f => {
- if (f.code == code) {
- if (list.length == 0) {
- f.modelList2 = []
- f.modelList = []
- return false
- }
- f.modelList2 = list.filter(t => t.automatic == 1)
- f.modelList = list.filter(t => t.automatic == 2)
- }
- })
- }
- if (type == 'boatBom') {
- this.List.forEach(f => {
- if (f.code == code) {
- if (list.length == 0) {
- f.palletList2 = []
- f.palletList = []
- return false
- }
- f.palletList2 = list.filter(t => t.automatic == 1)
- f.palletList = list.filter(t => t.automatic == 2)
- }
- })
- }
- this.$forceUpdate()
- },
- addPicking(id, item) {
- const storageKey = Date.now() + "";
- console.log(item)
- let arr = [...item.instanceList2, ...item.modelList2, ...item.palletList2, ...item.packingList2]
- uni.setStorageSync(storageKey, arr);
- uni.navigateTo({
- url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`
- })
- },
- getPick() {
- pickDetails(this.idsList).then(res => {
- if (res && res.length > 0) {
- this.isPick = true
- }
- })
- },
- openDetails() {
- let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`
- uni.navigateTo({
- url
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .content-box {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .list_box {
- flex: 1;
- overflow: hidden;
- padding: 4rpx 0;
- .u-list {
- height: 100% !important;
- }
- .card_box {
- padding: 16rpx 24rpx;
- }
- .title_box {
- .round {
- width: 32rpx;
- height: 32rpx;
- line-height: 32rpx;
- border-radius: 50%;
- background: $theme-color;
- color: #fff;
- text-align: center;
- font-size: 20rpx;
- }
- .code {
- margin-left: 16rpx;
- font-family: PingFang SC;
- font-size: 28rpx;
- font-style: normal;
- font-weight: 400;
- color: $theme-color;
- }
- }
- .right_box {}
- .material {
- margin-top: 10rpx;
- .left {
- width: 40rpx;
- }
- .zdy_check {
- width: 30rpx;
- height: 30rpx;
- border: 2rpx solid #c8c9cc;
- border-radius: 4rpx;
- }
- .check_active {
- background: $theme-color;
- border: 2rpx solid $theme-color;
- /deep/ .u-icon__icon {
- color: #fff !important;
- }
- }
- .content_table {
- width: 652rpx;
- border: 2rpx solid $border-color;
- .item {
- display: flex;
- border-bottom: 2rpx solid $border-color;
- .lable {
- width: 132rpx;
- text-align: center;
- background-color: #F7F9FA;
- font-size: 26rpx;
- border-right: 2rpx solid $border-color;
- flex-shrink: 0;
- }
- .ww80 {
- width: 80rpx;
- }
- .content {
- width: 518rpx;
- min-height: 64rpx;
- font-size: 28rpx;
- line-height: 28rpx;
- font-style: normal;
- font-weight: 400;
- padding: 18rpx 8rpx;
- box-sizing: border-box;
- word-wrap: break-word;
- flex-grow: 1 !important;
- }
- .content_num {
- display: flex;
- align-items: center;
- padding: 0 4rpx;
- /deep/ .uni-input-input {
- border: 2rpx solid #F0F8F2;
- background: #F0F8F2;
- color: $theme-color;
- }
- .unit {
- width: 90rpx;
- text-align: center;
- font-size: 24rpx;
- color: #404446;
- }
- }
- .pd4 {
- padding: 4rpx 8rpx;
- }
- &:last-child {
- border-bottom: none;
- }
- }
- .ww55 {
- width: 55%;
- }
- .ww45 {
- width: 45%;
- }
- }
- }
- }
- .bottom-wrapper {
- .btn_box {
- width: 750rpx;
- height: 88rpx;
- line-height: 88rpx;
- background: $theme-color;
- text-align: center;
- font-size: 36rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- }
- }
- .flex_btn {
- position: fixed;
- right: 0;
- bottom: 160rpx;
- width: 140rpx;
- height: 66rpx;
- line-height: 66rpx;
- border-radius: 22rpx 0 0 22rpx;
- background: $theme-color;
- text-align: center;
- font-size: 22rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- }
- </style>
|