Commit 27bd98f3 authored by chicheng's avatar chicheng

采购到货、进货单调整、BUG修复

批次号去掉物料
parent a9f46418
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
"请输入库位": "กรุณาใส่ตำแหน่งในคลัง", "请输入库位": "กรุณาใส่ตำแหน่งในคลัง",
"请输入验收数量或验退数量": "กรุณาใส่จำนวนการตรวจรับหรือจำนวนการคืนสินค้า", "请输入验收数量或验退数量": "กรุณาใส่จำนวนการตรวจรับหรือจำนวนการคืนสินค้า",
"计价数量不能大于验收数量": "จำนวนที่คิดราคาไม่สามารถมากกว่าจำนวนการตรวจรับได้", "计价数量不能大于验收数量": "จำนวนที่คิดราคาไม่สามารถมากกว่าจำนวนการตรวจรับได้",
"验收数量、计价数量、验退数量不能小于0": "จำนวนตรวจรับ จำนวนคิดราคา และจำนวนตีคืนต้องไม่น้อยกว่า 0",
"超出到货检验验收数量": "เกินจำนวนการตรวจสอบการจัดส่ง", "超出到货检验验收数量": "เกินจำนวนการตรวจสอบการจัดส่ง",
"修改进货单信息": "แก้ไขข้อมูลใบสั่งซื้อเข้า", "修改进货单信息": "แก้ไขข้อมูลใบสั่งซื้อเข้า",
"进货数量:": "จำนวนที่สั่งซื้อเข้า:", "进货数量:": "จำนวนที่สั่งซื้อเข้า:",
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
"请输入库位": "请输入库位", "请输入库位": "请输入库位",
"请输入验收数量或验退数量": "请输入验收数量或验退数量", "请输入验收数量或验退数量": "请输入验收数量或验退数量",
"计价数量不能大于验收数量": "计价数量不能大于验收数量", "计价数量不能大于验收数量": "计价数量不能大于验收数量",
"验收数量、计价数量、验退数量不能小于0": "验收数量、计价数量、验退数量不能小于0",
"超出到货检验验收数量": "超出到货检验验收数量", "超出到货检验验收数量": "超出到货检验验收数量",
"修改进货单信息": "修改进货单信息", "修改进货单信息": "修改进货单信息",
"进货数量:": "进货数量:", "进货数量:": "进货数量:",
......
...@@ -160,6 +160,7 @@ export default { ...@@ -160,6 +160,7 @@ export default {
udf07: data1.data['udf07'], udf07: data1.data['udf07'],
mb002: data1.data['mb002'], mb002: data1.data['mb002'],
mb029: data1.data['mb029'], mb029: data1.data['mb029'],
mb148: data1.data['mb148'] || '',
batchNo: batchNo, batchNo: batchNo,
productionDate: (() => { productionDate: (() => {
const today = new Date() const today = new Date()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="listItemTitle"> <view class="listItemTitle">
<view class="item" style="border-bottom: 1px solid #d8dbdf;"> <view class="item" style="border-bottom: 1px solid #d8dbdf;">
<view>{{item.purchaseNo}}|{{item.purchaseSerial}}</view> <view>{{item.purchaseNo}}|{{item.purchaseSerial}}</view>
<view>{{item.arrivalQuantity}}{{$t('pcs')}} <view>{{ item.arrivalQuantity }}{{ unitText ? ' ' + unitText : '' }}
<text style="margin-left: 40rpx"><u-icon name="minus" color="#000" size="32" @click="deleGonds(idx)"></u-icon></text> <text style="margin-left: 40rpx"><u-icon name="minus" color="#000" size="32" @click="deleGonds(idx)"></u-icon></text>
</view> </view>
</view> </view>
...@@ -89,7 +89,11 @@ export default { ...@@ -89,7 +89,11 @@ export default {
default: true default: true
} }
}, },
computed:{ computed: {
unitText() {
const u = this.item.mb148;
return u != null && String(u).trim() !== '' ? String(u).trim() : '';
}
}, },
data() { data() {
return { return {
......
...@@ -62,16 +62,18 @@ ...@@ -62,16 +62,18 @@
</u-form-item> </u-form-item>
<u-form-item prop="cd018" :label="$t('验收数量:')"> <u-form-item prop="cd018" :label="$t('验收数量:')">
<input <input
v-model.number="form.cd018" v-model="form.cd018"
type="text" type="digit"
@input="onQtyInput('cd018', $event)"
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item> </u-form-item>
<u-form-item prop="cd019" :label="$t('验退数量:')"> <u-form-item prop="cd019" :label="$t('验退数量:')">
<input <input
v-model.number="form.cd019" v-model="form.cd019"
type="text" type="digit"
@input="onQtyInput('cd019', $event)"
@confirm="submit" @confirm="submit"
> >
</input> </input>
...@@ -106,7 +108,12 @@ import i18n from '../../lang/index' ...@@ -106,7 +108,12 @@ import i18n from '../../lang/index'
let data = JSON.parse(decodeURIComponent(option.info)); let data = JSON.parse(decodeURIComponent(option.info));
this.index = option.index this.index = option.index
this.info = data this.info = data
this.form = data.purcds[this.index] const row = data.purcds[this.index]
this.form = {
...row,
cd018: row.cd018 != null && row.cd018 !== '' ? row.cd018 : row.cd008,
cd019: row.cd019 != null && row.cd019 !== '' ? row.cd019 : 0,
}
} }
}, },
data() { data() {
...@@ -127,16 +134,43 @@ import i18n from '../../lang/index' ...@@ -127,16 +134,43 @@ import i18n from '../../lang/index'
created() { created() {
}, },
methods: { methods: {
parseQty(val) {
const n = Number(val)
return isNaN(n) ? 0 : n
},
onQtyInput(field, e) {
const raw = e && e.detail ? e.detail.value : this.form[field]
this.form[field] = raw
this.syncAcceptReturnQty(field)
},
/** 验收+验退不超过到货数量;验退填满时验收自动为0,支持全部退回 */
syncAcceptReturnQty(changedField) {
const cd008 = this.parseQty(this.form.cd008)
let cd018 = this.parseQty(this.form.cd018)
let cd019 = this.parseQty(this.form.cd019)
if (cd019 > cd008) cd019 = cd008
if (cd018 > cd008) cd018 = cd008
if (cd018 + cd019 > cd008) {
if (changedField === 'cd019') {
cd018 = Math.max(0, cd008 - cd019)
} else {
cd019 = Math.max(0, cd008 - cd018)
}
}
this.form.cd018 = cd018
this.form.cd019 = cd019
},
submit(row) { submit(row) {
if (!this.form.cd018 && this.form.cd018 !== 0) return this.$u.toast(i18n.t('请输入验收数量')) const cd008 = this.parseQty(this.form.cd008)
if (!this.form.cd019 && this.form.cd019 !== 0) return this.$u.toast(i18n.t('请输入验退数量')) const cd018 = this.parseQty(this.form.cd018)
if (this.form['cd019'] || this.form['cd018']) { const cd019 = this.parseQty(this.form.cd019)
const cd019 = this.form['cd019'] || 0 if (cd018 + cd019 <= 0) {
const cd018 = this.form['cd018'] || 0 return this.$u.toast(i18n.t('请输入验收数量或验退数量'))
const cd008 = Number(this.form['cd008']) }
if (cd019 + cd018 > cd008) return this.$u.toast(i18n.t('验收数量+验退数量不能大于收货数量')) if (cd018 + cd019 > cd008) {
return this.$u.toast(i18n.t('验收数量+验退数量不能大于收货数量'))
} }
this.info[this.index] = {...this.info[this.index], ...this.form} this.info.purcds[this.index] = { ...this.info.purcds[this.index], ...this.form, cd018, cd019 }
uni.redirectTo({ uni.redirectTo({
url: '/pages/forcheck/Info?info=' + encodeURIComponent(JSON.stringify(this.info)) url: '/pages/forcheck/Info?info=' + encodeURIComponent(JSON.stringify(this.info))
}); });
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</view> </view>
<view> <view>
<text>{{$t('到货数量')}}</text> <text>{{$t('到货数量')}}</text>
<text><text>{{item.cd008}}</text><text style="margin-left:20rpx">{{item.cd007}}</text></text> <text><text>{{item.cd008}}</text><text style="margin-left:20rpx">{{item.cd015}}</text></text>
</view> </view>
<view> <view>
<text>{{$t('采购单号')}}</text> <text>{{$t('采购单号')}}</text>
...@@ -81,7 +81,10 @@ import i18n from '../../lang/index' ...@@ -81,7 +81,10 @@ import i18n from '../../lang/index'
if (option.info) { if (option.info) {
let data = JSON.parse(decodeURIComponent(option.info)); let data = JSON.parse(decodeURIComponent(option.info));
data.purcds.forEach(element => { data.purcds.forEach(element => {
if(!element['cd018']) { if (element['cd019'] == null || element['cd019'] === '') {
element['cd019'] = 0
}
if (element['cd018'] == null || element['cd018'] === '') {
element['cd018'] = element['cd008'] element['cd018'] = element['cd008']
} }
}); });
......
...@@ -91,24 +91,27 @@ ...@@ -91,24 +91,27 @@
</u-form-item> </u-form-item>
<u-form-item prop="th015" :label="$t('验收数量:')"> <u-form-item prop="th015" :label="$t('验收数量:')">
<input <input
v-model.number="form.th015" v-model="form.th015"
type="text" type="digit"
@input="onQtyInput('th015', $event)"
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item> </u-form-item>
<u-form-item prop="th016" :label="$t('计价数量:')"> <u-form-item prop="th016" :label="$t('计价数量:')">
<input <input
v-model.number="form.th016" v-model="form.th016"
type="text" type="digit"
@input="onQtyInput('th016', $event)"
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item> </u-form-item>
<u-form-item prop="th017" :label="$t('验退数量:')"> <u-form-item prop="th017" :label="$t('验退数量:')">
<input <input
v-model.number="form.th017" v-model="form.th017"
type="text" type="digit"
@input="onQtyInput('th017', $event)"
@confirm="submit" @confirm="submit"
> >
</input> </input>
...@@ -169,6 +172,26 @@ import i18n from '../../lang/index' ...@@ -169,6 +172,26 @@ import i18n from '../../lang/index'
created() { created() {
}, },
methods: { methods: {
parseQty(val) {
const n = Number(val)
return isNaN(n) ? 0 : n
},
onQtyInput(field, e) {
const raw = e && e.detail ? e.detail.value : this.form[field]
let n = this.parseQty(raw)
if (n < 0) n = 0
this.form[field] = n
},
validateQtyNotNegative() {
const th015 = this.parseQty(this.form.th015)
const th016 = this.parseQty(this.form.th016)
const th017 = this.parseQty(this.form.th017)
if (th015 < 0 || th016 < 0 || th017 < 0) {
this.$u.toast(i18n.t('验收数量、计价数量、验退数量不能小于0'))
return false
}
return true
},
addBatch() { addBatch() {
const item = { const item = {
cd004: this.form.cd004, cd004: this.form.cd004,
...@@ -213,17 +236,16 @@ import i18n from '../../lang/index' ...@@ -213,17 +236,16 @@ import i18n from '../../lang/index'
if (!this.form.islot) { if (!this.form.islot) {
if(!this.form.th009) return this.$u.toast(i18n.t('请输入仓库')) if(!this.form.th009) return this.$u.toast(i18n.t('请输入仓库'))
if(!this.form.th072) return this.$u.toast(i18n.t('请输入库位')) if(!this.form.th072) return this.$u.toast(i18n.t('请输入库位'))
if (this.form['th016'] || this.form['th015']) { if (!this.validateQtyNotNegative()) return
const th015 = this.form['th015'] || 0 const th015 = this.parseQty(this.form.th015)
const th016 = this.form['th016'] || 0 const th016 = this.parseQty(this.form.th016)
if (th016 > th015) return this.$u.toast(i18n.t('计价数量不能大于验收数量')) const th017 = this.parseQty(this.form.th017)
} if (th016 > th015) return this.$u.toast(i18n.t('计价数量不能大于验收数量'))
if (this.form['th015'] || this.form['th017']) { const cd018 = this.parseQty(this.form.cd018)
const th015 = this.form['th015'] || 0 if (th015 + th017 > cd018) return this.$u.toast(i18n.t('验收数量+验退数量不能大于进货数量'))
const th017 = this.form['th017'] || 0 this.form.th015 = th015
const cd018 = Number(this.form['cd018']) this.form.th016 = th016
if (th015 + th017 > cd018) return this.$u.toast(i18n.t('验收数量+验退数量不能大于进货数量')) this.form.th017 = th017
}
} else { } else {
} }
let pages = getCurrentPages() let pages = getCurrentPages()
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</view> </view>
<view> <view>
<text>{{$t('进货数量')}}</text> <text>{{$t('进货数量')}}</text>
<text><text>{{item.cd018}}</text><text style="margin-left:20rpx">{{item.cd007}}</text></text> <text><text>{{item.cd018}}</text><text style="margin-left:20rpx">{{item.cd015}}</text></text>
</view> </view>
<view> <view>
<text>{{$t('入库数量')}}</text> <text>{{$t('入库数量')}}</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment