Commit 800e9a6e authored by chicheng's avatar chicheng

批次相关调整

parent 6024e992
<template> <template>
<view class="NavBar"> <view class="NavBar">
<!-- <u-navbar <!-- <u-navbar
:title="title" :title="title"
:autoBack="true" :autoBack="true"
> >
</u-navbar> --> </u-navbar> -->
<uni-nav-bar shadow :left-icon="left" :right-icon="right" :title="title" color="#fff" :border='border' @clickLeft="handleBack" @clickRight="$emit(`clickRight`)" backgroundColor="#6200ee"/> <uni-nav-bar shadow :left-icon="left" :title="title" color="#fff" :border='border' @clickLeft="handleBack" backgroundColor="#6200ee" :left-width="0" :right-width="160">
</view> <template slot="right">
</template> <view class="nav-right-icons">
<view v-if="extraRight" class="nav-right-icon" @click="$emit('clickExtraRight')">
<script> <uni-icons :type="extraRight" size="28" color="#fff" />
export default { </view>
name:"NavBar", <view v-if="right" class="nav-right-icon" style="margin-left:12rpx" @click="$emit('clickRight')">
data() { <uni-icons :type="right" size="28" color="#fff" />
return { </view>
</view>
}; </template>
}, </uni-nav-bar>
props: { </view>
title: { </template>
type: String,
default: '' <script>
}, export default {
left: { name:"NavBar",
type: String, data() {
default: 'left' return {
},
right: { };
type: String, },
default: '' props: {
}, title: {
border: { type: String,
type: Boolean, default: ''
default: false },
}, left: {
}, type: String,
methods:{ default: 'left'
handleBack() { },
uni.navigateBack(); right: {
}, type: String,
}, default: ''
} },
</script> extraRight: {
type: String,
<style lang="scss"> default: ''
.NavBar { },
::v-deep .uni-navbar__header { border: {
height:60px !important; type: Boolean,
} default: false
::v-deep .uni-navbar__header-container-inner { },
justify-content: flex-start; },
} methods:{
::v-deep .uni-nav-bar-text { handleBack() {
font-size: 20px; uni.navigateBack();
} },
::v-deep .uni-navbar__header-btns-left { },
display: none; }
} </script>
::v-deep .uniui-checkbox{
font-size: 47px !important; <style lang="scss">
} .NavBar {
::v-deep .uniui-person{ ::v-deep .uni-navbar__header {
font-size: 47px !important; height:60px !important;
} }
} ::v-deep .uni-navbar__header-container-inner {
justify-content: flex-start;
</style> }
\ No newline at end of file ::v-deep .uni-nav-bar-text {
font-size: 20px;
}
::v-deep .uni-navbar__header-btns-left {
display: none;
}
.nav-right-icons {
display: flex;
flex-direction: row;
align-items: center;
}
.nav-right-icon {
padding: 8rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>
...@@ -230,5 +230,14 @@ ...@@ -230,5 +230,14 @@
"立即升级": "อัปเกรดทันที", "立即升级": "อัปเกรดทันที",
"领用套数": "จํานวนชุดที่จะใช้", "领用套数": "จํานวนชุดที่จะใช้",
"采购发票": "ใบแจ้งหนี้การจัดซื้อ", "采购发票": "ใบแจ้งหนี้การจัดซื้อ",
"请按顺序先进先出": "กรุณาตรวจสอบตามลำดับการสิ้นสุดก่อน" "请按顺序先进先出": "กรุณาตรวจสอบตามลำดับการสิ้นสุดก่อน",
"扫码到货": "สแกนรับสินค้า",
"请扫描条码": "กรุณาสแกนบาร์โค้ด",
"继续扫码": "สแกนต่อ",
"编辑明细": "แก้ไขรายละเอียด",
"扫码结果": "ผลการสแกน",
"pcs": "pcs",
"图号": "หมายเลขแบบ",
"生产日期": "วันที่ผลิต",
"有效日期": "วันหมดอายุ"
} }
...@@ -181,53 +181,62 @@ ...@@ -181,53 +181,62 @@
"库存数:": "库存数:", "库存数:": "库存数:",
"采购到货": "采购到货", "采购到货": "采购到货",
"到货仓": "到货仓", "到货仓": "到货仓",
"请选择到货仓": "请选择到货仓", "请选择到货仓": "请选择到货仓",
"确认成功": "确认成功", "确认成功": "确认成功",
"到货确认": "到货确认", "到货确认": "到货确认",
"确认": "确认", "确认": "确认",
"提交成功": "提交成功", "提交成功": "提交成功",
"提交失败": "提交失败", "提交失败": "提交失败",
"请勿重复提交": "请勿重复提交", "请勿重复提交": "请勿重复提交",
"提交数据不能为空": "提交数据不能为空", "提交数据不能为空": "提交数据不能为空",
"库存盘点": "库存盘点", "库存盘点": "库存盘点",
"盘点作业": "盘点作业", "盘点作业": "盘点作业",
"盘点明细": "盘点明细", "盘点明细": "盘点明细",
"盘点产品号不能为空": "盘点产品号不能为空", "盘点产品号不能为空": "盘点产品号不能为空",
"当前已经存在盘点产品": "当前已经存在盘点产品", "当前已经存在盘点产品": "当前已经存在盘点产品",
"该产品不存在": "该产品不存在", "该产品不存在": "该产品不存在",
"请输入盘点产品号": "请输入盘点产品号", "请输入盘点产品号": "请输入盘点产品号",
"库房/储位": "库房/储位", "库房/储位": "库房/储位",
"库存数": "库存数", "库存数": "库存数",
"盘点数": "盘点数", "盘点数": "盘点数",
"请输入盘点数": "请输入盘点数", "请输入盘点数": "请输入盘点数",
"盘点数量不能大于库存数量": "盘点数量不能大于库存数量", "盘点数量不能大于库存数量": "盘点数量不能大于库存数量",
"新增库存": "新增库存", "新增库存": "新增库存",
"新增数": "新增数", "新增数": "新增数",
"请输入新增数": "请输入新增数", "请输入新增数": "请输入新增数",
"选择仓库": "选择仓库", "选择仓库": "选择仓库",
"选择储位": "选择储位", "选择储位": "选择储位",
"调拨数不能为空": "调拨数不能为空", "调拨数不能为空": "调拨数不能为空",
"调入库存不能为空": "调入库存不能为空", "调入库存不能为空": "调入库存不能为空",
"调入储位不能为空": "调入储位不能为空", "调入储位不能为空": "调入储位不能为空",
"该数据已存在": "该数据已存在", "该数据已存在": "该数据已存在",
"请输入储位": "请输入储位", "请输入储位": "请输入储位",
"库存调拨": "库存调拨", "库存调拨": "库存调拨",
"至少需要录入一批调拨数据": "至少需要录入一批调拨数据", "至少需要录入一批调拨数据": "至少需要录入一批调拨数据",
"请输入调拨产品号": "请输入调拨产品号", "请输入调拨产品号": "请输入调拨产品号",
"调拨明细": "调拨明细", "调拨明细": "调拨明细",
"当前储位": "当前储位", "当前储位": "当前储位",
"调入储位": "调入储位", "调入储位": "调入储位",
"调拨确认": "调拨确认", "调拨确认": "调拨确认",
"该调拨产品号数据已存在": "该调拨产品号数据已存在", "该调拨产品号数据已存在": "该调拨产品号数据已存在",
"调拨总数不能大于库存数": "调拨总数不能大于库存数", "调拨总数不能大于库存数": "调拨总数不能大于库存数",
"调拨数": "调拨数", "调拨数": "调拨数",
"请输入调拨数": "请输入调拨数", "请输入调拨数": "请输入调拨数",
"调入仓库": "调入仓库", "调入仓库": "调入仓库",
"调拨数不能大于库存数": "调拨数不能大于库存数", "调拨数不能大于库存数": "调拨数不能大于库存数",
"检测到有新版本!": "检测到有新版本!", "检测到有新版本!": "检测到有新版本!",
"请升级app到最新版本!": "请升级app到最新版本!", "请升级app到最新版本!": "请升级app到最新版本!",
"暂不升级": "暂不升级", "暂不升级": "暂不升级",
"立即升级": "立即升级", "立即升级": "立即升级",
"领用套数": "领用套数", "领用套数": "领用套数",
"采购发票": "采购发票" "采购发票": "采购发票",
} "扫码到货": "扫码到货",
\ No newline at end of file "请扫描条码": "请扫描条码",
"继续扫码": "继续扫码",
"编辑明细": "编辑明细",
"扫码结果": "扫码结果",
"pcs": "pcs",
"图号": "图号",
"生产日期": "生产日期",
"有效日期": "有效日期"
}
...@@ -51,7 +51,9 @@ ...@@ -51,7 +51,9 @@
<scanningList <scanningList
:item="item" :item="item"
:idx="index" :idx="index"
:editable="false"
@deleGonds="deleGonds" @deleGonds="deleGonds"
@updateItem="updateItem"
/> />
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
...@@ -153,8 +155,21 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -153,8 +155,21 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
newGoodsList.forEach(newItem => { newGoodsList.forEach(newItem => {
const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel); const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel);
if (existingIndex > -1) { if (existingIndex > -1) {
// 如果已存在,直接替换数量(因为scanning页面已经处理了累加逻辑) // 保持原有到货数量合并逻辑
this.goodsList[existingIndex].arrivalQuantity = Number(newItem.arrivalQuantity); this.goodsList[existingIndex].arrivalQuantity = Number(newItem.arrivalQuantity);
// 同步日期与批号(若提供)
if (Object.prototype.hasOwnProperty.call(newItem, 'productionDate')) {
this.goodsList[existingIndex].productionDate = newItem.productionDate;
}
if (Object.prototype.hasOwnProperty.call(newItem, 'effectiveDate')) {
this.goodsList[existingIndex].effectiveDate = newItem.effectiveDate;
}
if (Object.prototype.hasOwnProperty.call(newItem, 'batchNo')) {
this.goodsList[existingIndex].batchNo = newItem.batchNo;
}
if (Object.prototype.hasOwnProperty.call(newItem, 'mb022')) {
this.goodsList[existingIndex].mb022 = newItem.mb022;
}
} else { } else {
// 如果不存在,添加新项 // 如果不存在,添加新项
this.goodsList.push(newItem); this.goodsList.push(newItem);
...@@ -172,6 +187,12 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -172,6 +187,12 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
deleGonds(idx) { deleGonds(idx) {
this.goodsList.splice(idx, 1); this.goodsList.splice(idx, 1);
}, },
updateItem(payload) {
const { idx, key, value } = payload || {}
if (typeof idx === 'number' && key) {
this.$set(this.goodsList, idx, { ...this.goodsList[idx], [key]: value })
}
},
goSubmit(){ goSubmit(){
if (!this.goodsList.length) return; if (!this.goodsList.length) return;
if(!this.daohuoForm.warehouse) return this.$u.toast(i18n.t('请选择到货仓')); if(!this.daohuoForm.warehouse) return this.$u.toast(i18n.t('请选择到货仓'));
...@@ -179,7 +200,17 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -179,7 +200,17 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
this.$u.api.confirmArrival({ this.$u.api.confirmArrival({
warehouse: this.daohuoForm.warehouse, warehouse: this.daohuoForm.warehouse,
invoiceNo: this.daohuoForm.invoiceNo, invoiceNo: this.daohuoForm.invoiceNo,
details: this.goodsList.map(v => ({arrivalQuantity: v.arrivalQuantity, materialNo: v.materialNo, purchaseNo: v.purchaseNo, purchaseSerial: v.purchaseSerial, purchaseType: v.purchaseType, supplierNo: v.supplierNo})) details: this.goodsList.map(v => ({
arrivalQuantity: v.arrivalQuantity,
materialNo: v.materialNo,
purchaseNo: v.purchaseNo,
purchaseSerial: v.purchaseSerial,
purchaseType: v.purchaseType,
supplierNo: v.supplierNo,
productionDate: v.productionDate,
effectiveDate: v.effectiveDate,
batchNo: v.batchNo
}))
}) })
.then(res => { .then(res => {
this.loading = false; this.loading = false;
...@@ -264,4 +295,4 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -264,4 +295,4 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
margin-top: 20rpx; margin-top: 20rpx;
} }
</style> </style>
\ No newline at end of file
...@@ -6,15 +6,24 @@ ...@@ -6,15 +6,24 @@
<view style="padding: 0 10px;"> <view style="padding: 0 10px;">
<view class="scan-input-container"> <view class="scan-input-container">
<input <input
style="width: 100%; height: 60px; border: 1px solid #ddd; border-radius: 8px; padding: 0 15px; font-size: 16px;" style="flex: 1; height: 60px; border: 1px solid #ddd; border-radius: 8px; padding: 0 15px; font-size: 16px;"
type="text" type="text"
v-model="input" v-model="input"
:focus="isFocus" :focus="isFocus"
:disabled="isEditMode"
@focus="focus" @focus="focus"
@blur="blur" @blur="blur"
@confirm="inputCC" @confirm="inputCC"
:placeholder="$t('请扫描条码')" :placeholder="$t('请扫描条码')"
/> />
<u-button
type="default"
size="mini"
@click="toggleEditMode"
class="mode-toggle-btn"
>
{{ isEditMode ? $t('继续扫码') : $t('编辑明细') }}
</u-button>
</view> </view>
<view v-if="goodsList.length > 0" class="scan-result-title">{{$t('扫码结果')}}</view> <view v-if="goodsList.length > 0" class="scan-result-title">{{$t('扫码结果')}}</view>
...@@ -25,7 +34,9 @@ ...@@ -25,7 +34,9 @@
<scanningList <scanningList
:item="item" :item="item"
:idx="index" :idx="index"
:editable="isEditMode"
@deleGonds="deleGonds" @deleGonds="deleGonds"
@updateItem="updateItem"
/> />
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
...@@ -52,6 +63,8 @@ export default { ...@@ -52,6 +63,8 @@ export default {
return { return {
goodsList: [], goodsList: [],
isFocus: false, isFocus: false,
isEditMode: false,
isEditingDetails: false,
input: '', input: '',
btnArr: [ btnArr: [
{ {
...@@ -78,6 +91,7 @@ export default { ...@@ -78,6 +91,7 @@ export default {
}, },
methods: { methods: {
focus(){ focus(){
if (this.isEditMode || this.isEditingDetails) return;
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(()=>{ setTimeout(()=>{
uni.hideKeyboard(); uni.hideKeyboard();
...@@ -88,7 +102,9 @@ export default { ...@@ -88,7 +102,9 @@ export default {
this.isFocus = false; this.isFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(()=>{ setTimeout(()=>{
this.isFocus = true; if (!this.isEditMode && !this.isEditingDetails) {
this.isFocus = true;
}
},500); },500);
}); });
}, },
...@@ -108,7 +124,8 @@ export default { ...@@ -108,7 +124,8 @@ export default {
"materialNo": arr[4], "materialNo": arr[4],
"purchaseNo": arr[2], "purchaseNo": arr[2],
"purchaseSerial": arr[3], "purchaseSerial": arr[3],
"purchaseType": arr[1] "purchaseType": arr[1],
"supplierNo": arr[0]
}) })
if (!data.success) return this.input = '' if (!data.success) return this.input = ''
const index = this.goodsList.findIndex(v => v.joinlabel === arr.slice(0, 5).join('-')) const index = this.goodsList.findIndex(v => v.joinlabel === arr.slice(0, 5).join('-'))
...@@ -130,20 +147,8 @@ export default { ...@@ -130,20 +147,8 @@ export default {
mb001: arr[4] mb001: arr[4]
}) })
// 根据mb022属性判断批次管理 // 直接使用后端返回的默认批次号
let batchNo = '' const batchNo = (data && data.data && data.data.defBatchNo) ? data.data.defBatchNo : ''
if (data.data && data.data.invmb.mb022 === 'Y') {
// 批次管理:生成批号:品号+客户+日期yyyyMMdd
const today = new Date()
const dateStr = today.getFullYear().toString() +
(today.getMonth() + 1).toString().padStart(2, '0') +
today.getDate().toString().padStart(2, '0')
const customer = arr[0] // 使用供应商号作为客户,如果没有则使用默认值
batchNo = arr[4] + customer + dateStr
} else {
// 非批次管理:使用默认批次号
batchNo = data.data && data.data.defBatchNo ? data.data.defBatchNo : ''
}
this.goodsList.push({ this.goodsList.push({
supplierNo: arr[0], supplierNo: arr[0],
...@@ -156,6 +161,23 @@ export default { ...@@ -156,6 +161,23 @@ export default {
mb002: data1.data['mb002'], mb002: data1.data['mb002'],
mb029: data1.data['mb029'], mb029: data1.data['mb029'],
batchNo: batchNo, batchNo: batchNo,
productionDate: (() => {
const today = new Date()
const yy = today.getFullYear()
const mm = String(today.getMonth() + 1).padStart(2, '0')
const dd = String(today.getDate()).padStart(2, '0')
return `${yy}${mm}${dd}`
})(),
effectiveDate: (() => {
const shelf = Number(data1.data['udf07']) || 0
if (!shelf) return ''
const today = new Date()
today.setDate(today.getDate() + shelf)
const yy = today.getFullYear()
const mm = String(today.getMonth() + 1).padStart(2, '0')
const dd = String(today.getDate()).padStart(2, '0')
return `${yy}${mm}${dd}`
})(),
joinlabel: arr.slice(0, 5).join('-') joinlabel: arr.slice(0, 5).join('-')
}) })
} }
...@@ -174,6 +196,30 @@ export default { ...@@ -174,6 +196,30 @@ export default {
} }
} }
}, },
updateItem(payload) {
const { idx, key, value } = payload || {}
if (typeof idx === 'number' && key) {
this.$set(this.goodsList, idx, { ...this.goodsList[idx], [key]: value })
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage && prevPage.$vm) {
prevPage.$vm.updateGoodsList(this.goodsList);
}
}
},
toggleEditMode() {
this.isEditMode = !this.isEditMode
if (this.isEditMode) {
this.isFocus = false
uni.hideKeyboard()
} else {
this.$nextTick(() => {
setTimeout(() => {
this.isFocus = true
}, 300)
})
}
},
deleGonds(idx) { deleGonds(idx) {
this.goodsList.splice(idx, 1); this.goodsList.splice(idx, 1);
// 删除后也同步到主页面 // 删除后也同步到主页面
...@@ -194,6 +240,15 @@ export default { ...@@ -194,6 +240,15 @@ export default {
.scan-input-container { .scan-input-container {
margin: 20rpx 0; margin: 20rpx 0;
display: flex;
align-items: center;
}
.mode-toggle-btn {
margin-left: 12rpx;
height: 60px;
line-height: 60px;
white-space: nowrap;
} }
.scan-result-title { .scan-result-title {
...@@ -229,4 +284,4 @@ page { ...@@ -229,4 +284,4 @@ page {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
\ No newline at end of file
...@@ -3,22 +3,67 @@ ...@@ -3,22 +3,67 @@
<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}}pcs <view>{{item.arrivalQuantity}}{{$t('pcs')}}
<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>
<view class="item"> <view class="item">
<view>品号:{{item.materialNo}}</view> <view>{{$t('品号:')}}{{item.materialNo}}</view>
</view> </view>
<view class="item">品名:{{ item.mb002 }}</view> <view class="item">{{$t('品名:')}}{{ item.mb002 }}</view>
<view class="item">图号:{{ item.mb029 }}</view> <view class="item">{{$t('图号')}}{{ item.mb029 }}</view>
<view class="item">批号:{{ item.batchNo }}</view> <view class="item">
<view>{{$t('批号:')}}</view>
<view style="flex: 1; text-align: left;">
<view v-if="!editable">{{ item.batchNo || '-' }}</view>
<input
v-else
type="text"
:value="item.batchNo"
@input="onBatchNoInput"
@focus="onEditStart"
@blur="onEditEnd"
style="width: 420rpx; display: inline-block; text-align: right; border: 1px solid #ddd; border-radius: 6px; padding: 0 10px; height: 60rpx; font-size: 28rpx;"
:placeholder="$t('请输入批号')"
/>
</view>
</view>
<view class="item">
<view>{{$t('生产日期')}}</view>
<view style="flex: 1; text-align: left;">
<view v-if="!editable">{{ formatNoDash(item.productionDate) || '-' }}</view>
<uni-datetime-picker
v-else
type="date"
:border="false"
:clearIcon="true"
:value="formatWithDash(item.productionDate)"
@change="onProdDateChange"
/>
</view>
</view>
<view class="item">
<view>{{$t('有效日期')}}</view>
<view style="flex: 1; text-align: left;">
<view v-if="!editable">{{ formatNoDash(item.effectiveDate) || '-' }}</view>
<uni-datetime-picker
v-else
type="date"
:border="false"
:clearIcon="true"
:value="formatWithDash(item.effectiveDate)"
:start="formatWithDash(item.productionDate) || ''"
@change="onEffDateChange"
/>
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import i18n from '../../lang/index'
import StickyNavBar from '@/components/StickyNavBar/index.vue'; import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue'; import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue'; import BottomBtn from '@/components/BottomBtn/index.vue';
...@@ -38,7 +83,11 @@ export default { ...@@ -38,7 +83,11 @@ export default {
idx: { idx: {
type: Number, type: Number,
default: 0 default: 0
} },
editable: {
type: Boolean,
default: true
}
}, },
computed:{ computed:{
}, },
...@@ -52,7 +101,55 @@ export default { ...@@ -52,7 +101,55 @@ export default {
methods: { methods: {
deleGonds(idx) { deleGonds(idx) {
this.$emit('deleGonds',idx) this.$emit('deleGonds',idx)
} },
onProdDateChange(val) {
const prodDash = typeof val === 'string' ? val : (val && val.detail ? val.detail.value : val)
const prodNoDash = this.formatNoDash(prodDash)
this.$emit('updateItem', { idx: this.idx, key: 'productionDate', value: prodNoDash })
const shelf = Number(this.item.udf07) || 0
if (shelf > 0 && prodNoDash) {
const eDateDash = this.addDays(this.formatWithDash(prodNoDash), shelf)
this.$emit('updateItem', { idx: this.idx, key: 'effectiveDate', value: this.formatNoDash(eDateDash) })
}
},
onEffDateChange(val) {
const effDash = typeof val === 'string' ? val : (val && val.detail ? val.detail.value : val)
const prodDash = this.formatWithDash(this.item.productionDate)
if (this.item.productionDate && effDash && effDash < prodDash) {
this.$emit('updateItem', { idx: this.idx, key: 'effectiveDate', value: this.item.productionDate })
} else {
this.$emit('updateItem', { idx: this.idx, key: 'effectiveDate', value: this.formatNoDash(effDash) })
}
},
addDays(yyyyMMdd, days) {
const [y, m, d] = yyyyMMdd.split('-').map(n => Number(n))
const dt = new Date(y, (m || 1) - 1, d || 1)
dt.setDate(dt.getDate() + days)
const yy = dt.getFullYear()
const mm = String(dt.getMonth() + 1).padStart(2, '0')
const dd = String(dt.getDate()).padStart(2, '0')
return `${yy}-${mm}-${dd}`
},
onBatchNoInput(e) {
const val = typeof e === 'string' ? e : (e && e.detail ? e.detail.value : '')
this.$emit('updateItem', { idx: this.idx, key: 'batchNo', value: val })
},
onEditStart() {
this.$emit('editing', true)
},
onEditEnd() {
this.$emit('editing', false)
},
formatNoDash(val) {
return val ? String(val).replace(/-/g, '') : ''
},
formatWithDash(val) {
if (!val) return ''
const s = String(val)
if (s.includes('-')) return s
if (s.length === 8) return `${s.slice(0,4)}-${s.slice(4,6)}-${s.slice(6)}`
return s
}
} }
}; };
</script> </script>
......
...@@ -59,14 +59,14 @@ import i18n from '../../lang/index' ...@@ -59,14 +59,14 @@ import i18n from '../../lang/index'
export default { export default {
data() { data() {
return { return {
form: { form: {
boxCode: null, boxCode: null,
workOrderType: null, workOrderType: '5101',
workOrderNo: null, workOrderNo: null,
quantity: null, quantity: null,
}, },
queryDetails: [], // 保存查询到的明细数据 queryDetails: [], // 保存查询到的明细数据
loading: false loading: false
}; };
}, },
methods: { methods: {
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
<u-form-item prop="batchNo" :label="$t('批号:')"> <u-form-item prop="batchNo" :label="$t('批号:')">
<input <input
v-model.number="form.batchNo" v-model.number="form.batchNo"
disabled
type="text" type="text"
@confirm="submit" @confirm="submit"
> >
...@@ -180,7 +179,7 @@ import i18n from '../../lang/index' ...@@ -180,7 +179,7 @@ import i18n from '../../lang/index'
form: { form: {
tg010: '01', tg010: '01',
tg001: '5801', tg001: '5801',
tg014: '5101', tg014: '510',
tg015: null, tg015: null,
// tc006: null, // tc006: null,
// tb005: null, // tb005: null,
...@@ -227,19 +226,13 @@ import i18n from '../../lang/index' ...@@ -227,19 +226,13 @@ import i18n from '../../lang/index'
this.$u.api.getMocta(params).then(res => { this.$u.api.getMocta(params).then(res => {
if (res.success && res.data) { if (res.success && res.data) {
const moctaData = res.data const moctaData = res.data
// 生成批次号:品号(ta006)+工厂编号(ta019)+日期yyyyMMdd this.form.batchNo = moctaData.batchNo
const today = new Date()
const dateStr = today.getFullYear().toString() +
(today.getMonth() + 1).toString().padStart(2, '0') +
today.getDate().toString().padStart(2, '0')
this.form.batchNo = (moctaData.ta006 || '').trim() + (moctaData.ta019 || '').trim() + dateStr
} else { } else {
this.form.batchNo="" this.form.batchNo=""
this.$u.toast(i18n.t('未找到工单信息')) this.$u.toast(i18n.t('未找到工单信息'))
} }
}).catch(err => { }).catch(err => {
this.form.batchNo="" this.form.batchNo=""
this.$u.toast(i18n.t('查询工单失败')) this.$u.toast(i18n.t('查询工单失败'))
}) })
}, },
...@@ -277,7 +270,7 @@ import i18n from '../../lang/index' ...@@ -277,7 +270,7 @@ import i18n from '../../lang/index'
this.form = { this.form = {
tg010: '01', tg010: '01',
tg001: '5801', tg001: '5801',
tg014: '5101', tg014: '510',
tg015: null, tg015: null,
// tc006: null, // tc006: null,
// tb005: null, // tb005: null,
...@@ -318,7 +311,7 @@ import i18n from '../../lang/index' ...@@ -318,7 +311,7 @@ import i18n from '../../lang/index'
border: none !important; border: none !important;
} }
} }
</style> </style>
\ No newline at end of file
This diff is collapsed.
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<view class="itemtitle"> <view class="itemtitle">
<text>{{item.tb006}}</text> <text>{{item.tb006}}</text>
<view> <view>
<text style="color: #006400">{{item.quantity}}</text> <text style="color: #006400">{{calcTotalQuantity(item)}}</text>
</view> </view>
</view> </view>
<view> <view>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</view> </view>
<view> <view>
<text>{{$t('领料数量')}}</text> <text>{{$t('领料数量')}}</text>
<text>{{item.quantity}}</text> <text>{{calcTotalQuantity(item)}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -134,6 +134,14 @@ import i18n from '../../lang/index' ...@@ -134,6 +134,14 @@ import i18n from '../../lang/index'
this.chargaArr = data.moctes this.chargaArr = data.moctes
this.info = data this.info = data
} }
uni.$on('moctcForCreateUpdate', (data) => {
if(this.info && data.ta001 === this.info.ta001 && data.ta002 === this.info.ta002) {
this.getValue(data)
}
})
},
onUnload() {
uni.$off('moctcForCreateUpdate')
}, },
data() { data() {
return { return {
...@@ -150,6 +158,13 @@ import i18n from '../../lang/index' ...@@ -150,6 +158,13 @@ import i18n from '../../lang/index'
created() { created() {
}, },
methods: { methods: {
calcTotalQuantity(item) {
const base = Number(item.quantity) || 0
const batchSum = this.chargaArr
.filter(v => v.batch && v.tb003 === item.tb003)
.reduce((pre, cur) => pre + (Number(cur.quantity) || 0), 0)
return Math.round((base + batchSum) * 1000000) / 1000000
},
filterCK(e){ filterCK(e){
console.log('e', e.detail.value) console.log('e', e.detail.value)
if(!e.detail.value) { if(!e.detail.value) {
...@@ -292,4 +307,4 @@ import i18n from '../../lang/index' ...@@ -292,4 +307,4 @@ import i18n from '../../lang/index'
} }
</style> </style>
\ No newline at end of file
...@@ -16,12 +16,19 @@ ...@@ -16,12 +16,19 @@
:placeholder="$t('请输入调拨数')" @change="handleChangeNum" /> :placeholder="$t('请输入调拨数')" @change="handleChangeNum" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item :label="`${$t('调入仓库')}:`"> <uni-forms-item :label="`${$t('调入仓库')}:`">
<zxz-uni-data-select filterable v-model="info.allocateWarehouse" dataKey="text" dataValue="value" <zxz-uni-data-select
:localdata="warehouseRange" @change="handleChange" /> filterable
v-model="info.allocateWarehouse"
dataKey="text"
dataValue="value"
:localdata="warehouseRange"
@change="handleChange"
@inputChange="handleWarehouseInput"
/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item :label="`${$t('调入储位')}:`"> <uni-forms-item :label="`${$t('调入储位')}:`">
<zxz-uni-data-select filterable v-model="info.allocateLocation" dataKey="text" dataValue="value" <zxz-uni-data-select filterable v-model="info.allocateLocation" dataKey="text" dataValue="value"
:localdata="storageRange" /> :localdata="storageRange" />
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
...@@ -74,7 +81,7 @@ ...@@ -74,7 +81,7 @@
return { return {
...item, ...item,
value: item.mc001, value: item.mc001,
text: item.mc002, text: `${item.mc001}|${item.mc002}`,
} }
}) })
}) })
...@@ -108,6 +115,13 @@ ...@@ -108,6 +115,13 @@
handleChange() { handleChange() {
this.getStorageList(); this.getStorageList();
}, },
handleWarehouseInput(val) {
const code = String(val || '').trim();
if (!code) return;
const match = this.warehouseRange.find(w => w.value === code);
this.info.allocateWarehouse = match ? match.value : code;
this.getStorageList();
},
} }
} }
</script> </script>
...@@ -150,4 +164,4 @@ ...@@ -150,4 +164,4 @@
} }
} }
} }
</style> </style>
\ No newline at end of file
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