Commit 307119d1 authored by chicheng's avatar chicheng

到货打印添加每箱数量

parent daba48c8
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
"到货数量:": "จำนวนที่จัดส่ง:", "到货数量:": "จำนวนที่จัดส่ง:",
"标签个数:": "จำนวนป้าย:", "标签个数:": "จำนวนป้าย:",
"需要填写标签个数": "จำเป็นต้องกรอกจำนวนป้าย", "需要填写标签个数": "จำเป็นต้องกรอกจำนวนป้าย",
"每箱数量": "จำนวนต่อกล่อง",
"每箱数量:": "จำนวนต่อกล่อง:",
"为空或0则只打1张标签": "ว่างหรือ0 พิมพ์เพียง 1 ป้าย",
"每箱数量为空时填写": "กรอกเมื่อจำนวนต่อกล่องว่าง",
"到货单打印信息": "ข้อมูลการพิมพ์ใบจัดส่ง", "到货单打印信息": "ข้อมูลการพิมพ์ใบจัดส่ง",
"到货单": "ใบจัดส่ง", "到货单": "ใบจัดส่ง",
"供应商": "ผู้จำหน่าย", "供应商": "ผู้จำหน่าย",
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
"到货数量:": "到货数量:", "到货数量:": "到货数量:",
"标签个数:": "标签个数:", "标签个数:": "标签个数:",
"需要填写标签个数": "需要填写标签个数", "需要填写标签个数": "需要填写标签个数",
"每箱数量": "每箱数量",
"每箱数量:": "每箱数量:",
"为空或0则只打1张标签": "为空或0则只打1张标签",
"每箱数量为空时填写": "每箱数量为空时填写",
"到货单打印信息": "到货单打印信息", "到货单打印信息": "到货单打印信息",
"到货单": "到货单", "到货单": "到货单",
"供应商": "供应商", "供应商": "供应商",
......
...@@ -55,8 +55,19 @@ ...@@ -55,8 +55,19 @@
<u-form-item prop="count" :label="$t('标签个数:')"> <u-form-item prop="count" :label="$t('标签个数:')">
<input <input
v-model="form.count" v-model="form.count"
type="text" :disabled="!!effectivePerBox"
type="number"
:placeholder="effectivePerBox ? '' : $t('每箱数量为空时填写')"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="mb073" :label="$t('每箱数量:')">
<input
v-model="form.mb073"
type="number"
:placeholder="$t('为空或0则只打1张标签')"
@input="onMb073Input"
@confirm="submit" @confirm="submit"
> >
</input> </input>
...@@ -91,7 +102,16 @@ import i18n from '../../lang/index' ...@@ -91,7 +102,16 @@ 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, count: this.calcLabelCount(row.cd008, row.mb073) }
}
},
computed: {
effectivePerBox() {
const v = this.form.mb073;
if (v == null || v === '') return 0;
const n = typeof v === 'number' ? v : parseInt(v, 10);
return isNaN(n) ? 0 : n;
} }
}, },
data() { data() {
...@@ -105,15 +125,29 @@ import i18n from '../../lang/index' ...@@ -105,15 +125,29 @@ import i18n from '../../lang/index'
cd011: null, cd011: null,
cd008: null, cd008: null,
count: null, count: null,
mb073: null,
} }
}; };
}, },
created() { created() {
}, },
methods: { methods: {
calcLabelCount(cd008, mb073) {
const qty = Number(cd008) || 0;
const perBox = mb073 != null && mb073 !== '' ? (typeof mb073 === 'number' ? mb073 : parseInt(mb073, 10)) : 0;
if (perBox > 0 && qty > 0) return Math.ceil(qty / perBox);
return 1;
},
onMb073Input() {
this.$nextTick(() => {
this.form.count = this.calcLabelCount(this.form.cd008, this.form.mb073);
});
},
submit(row) { submit(row) {
if(!this.form.count || this.form.count === 0) return this.$u.toast(i18n.t('需要填写标签个数')) const count = this.calcLabelCount(this.form.cd008, this.form.mb073);
this.info[this.index] = {...this.info[this.index], ...this.form} if (count < 1) return this.$u.toast(i18n.t('需要填写标签个数'));
const mb073 = this.form.mb073 !== '' && this.form.mb073 != null ? (typeof this.form.mb073 === 'number' ? this.form.mb073 : parseInt(this.form.mb073, 10)) : null;
this.info.purcds[this.index] = { ...this.info.purcds[this.index], ...this.form, count, mb073 };
uni.redirectTo({ uni.redirectTo({
url: '/pages/abnormal/abnormalRemoveInfo?info=' + encodeURIComponent(JSON.stringify(this.info)) url: '/pages/abnormal/abnormalRemoveInfo?info=' + encodeURIComponent(JSON.stringify(this.info))
}); });
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<view class="cardRight"> <view class="cardRight">
<view class="itemtitle"> <view class="itemtitle">
<text>{{item.cd004}}</text> <text>{{item.cd004}}</text>
<text>{{item.count}}</text> <text>{{effectiveLabelCount(item)}}</text>
</view> </view>
<view> <view>
<text>{{item.cd005}}</text> <text>{{item.cd005}}</text>
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
<text>{{$t('采购单号')}}</text> <text>{{$t('采购单号')}}</text>
<text>{{item.cd011}}</text> <text>{{item.cd011}}</text>
</view> </view>
<view v-if="item.mb073 != null && item.mb073 !== ''">
<text>{{$t('每箱数量')}}</text>
<text>{{item.mb073}}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -79,9 +83,7 @@ import i18n from '../../lang/index' ...@@ -79,9 +83,7 @@ import i18n from '../../lang/index'
let data = JSON.parse(decodeURIComponent(option.info)); let data = JSON.parse(decodeURIComponent(option.info));
if(data.purcds && data.purcds.length) { if(data.purcds && data.purcds.length) {
data.purcds.forEach(element => { data.purcds.forEach(element => {
if (!element['count']) { element['count'] = this.calcLabelCount(element.cd008, element.mb073);
element['count'] = 1
}
}); });
} }
this.chargaArr = data.purcds this.chargaArr = data.purcds
...@@ -98,13 +100,27 @@ import i18n from '../../lang/index' ...@@ -98,13 +100,27 @@ import i18n from '../../lang/index'
created() { created() {
}, },
methods: { methods: {
/** 根据每箱数量计算标签个数:有每箱数量则 ceil(到货数量/每箱数量),否则为 1 */
calcLabelCount(cd008, mb073) {
const qty = Number(cd008) || 0;
const perBox = mb073 != null && mb073 !== '' ? (typeof mb073 === 'number' ? mb073 : parseInt(mb073, 10)) : 0;
if (perBox > 0 && qty > 0) return Math.ceil(qty / perBox);
return 1;
},
effectiveLabelCount(item) {
return this.calcLabelCount(item.cd008, item.mb073);
},
editCard(row, index) { editCard(row, index) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/abnormal/abnormalRemoveEdit?info=' + encodeURIComponent(JSON.stringify(this.info)) + '&index=' + index url: '/pages/abnormal/abnormalRemoveEdit?info=' + encodeURIComponent(JSON.stringify(this.info)) + '&index=' + index
}); });
}, },
submit(){ submit(){
const purcdPrintParamsList = this.chargaArr.map(v => ({cd001: v.cd001, cd002: v.cd002, cd003: v.cd003, count: v.count})) const purcdPrintParamsList = this.chargaArr.map(v => {
const mb073 = v.mb073 != null && v.mb073 !== '' ? (typeof v.mb073 === 'number' ? v.mb073 : parseInt(v.mb073, 10)) : null;
const count = this.calcLabelCount(v.cd008, v.mb073);
return { cd001: v.cd001, cd002: v.cd002, cd003: v.cd003, count, mb073 };
})
this.$u.api.purccprint({ this.$u.api.purccprint({
purcdPrintParamsList: purcdPrintParamsList, purcdPrintParamsList: purcdPrintParamsList,
udf01: this.info.udf01 udf01: this.info.udf01
......
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