feat(wms): 添加订单号显示并改进日期格式化功能
1. 在发货单组件中增加订单号显示,替换原有电话字段 2. 实现统一的日期格式化工具函数,修复参数冲突问题 3. 发货操作后自动添加待操作记录 4. 优化钢卷操作中的日期处理逻辑
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
function parseDate(date) {
|
||||
// 修复1:参数名和内部变量名冲突,改用tempDate
|
||||
// 修复2:如果传入的date为空/无效,默认使用当前时间
|
||||
const tempDate = date ? new Date(date) : new Date();
|
||||
|
||||
// 获取年、月、日、时、分、秒(补零处理,确保是两位数)
|
||||
const year = tempDate.getFullYear();
|
||||
// 月份从0开始,所以要+1,不足两位补0
|
||||
const month = String(tempDate.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(tempDate.getDate()).padStart(2, '0');
|
||||
const hours = String(tempDate.getHours()).padStart(2, '0');
|
||||
const minutes = String(tempDate.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(tempDate.getSeconds()).padStart(2, '0');
|
||||
|
||||
// 格式化为YYYY-mm-dd HH:mm:ss并返回
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
// 查询钢卷待操作列表
|
||||
export function listPendingAction(query) {
|
||||
return request({
|
||||
@@ -19,19 +37,33 @@ export function getPendingAction(actionId) {
|
||||
|
||||
// 新增钢卷待操作
|
||||
export function addPendingAction(data) {
|
||||
const payload = { ...data }
|
||||
if (payload.processTime) {
|
||||
payload.processTime = parseDate(payload.processTime)
|
||||
}
|
||||
if (payload.completeTime) {
|
||||
payload.completeTime = parseDate(payload.completeTime)
|
||||
}
|
||||
return request({
|
||||
url: '/wms/coilPendingAction',
|
||||
method: 'post',
|
||||
data: data
|
||||
data: payload
|
||||
})
|
||||
}
|
||||
|
||||
// 修改钢卷待操作
|
||||
export function updatePendingAction(data) {
|
||||
const payload = { ...data }
|
||||
if (payload.processTime) {
|
||||
payload.processTime = parseDate(payload.processTime)
|
||||
}
|
||||
if (payload.completeTime) {
|
||||
payload.completeTime = parseDate(payload.completeTime)
|
||||
}
|
||||
return request({
|
||||
url: '/wms/coilPendingAction',
|
||||
method: 'put',
|
||||
data: data
|
||||
data: payload
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,16 @@ export const actionStrategies = {
|
||||
handler: async (coil, action) => {
|
||||
// 更新操作记录状态 actionStatus: 2
|
||||
// 并行执行更新操作记录和更新钢卷状态
|
||||
// 将日期格式化为yyyy-MM-dd HH:mm:ss
|
||||
const completeTime = new Date()
|
||||
function parseDate(date) {
|
||||
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()
|
||||
}
|
||||
await Promise.all([
|
||||
updatePendingAction({
|
||||
...action,
|
||||
actionStatus: 2,
|
||||
completeTime: parseDate(completeTime),
|
||||
}),
|
||||
updateMaterialCoilSimple({
|
||||
...coil,
|
||||
|
||||
@@ -75,7 +75,8 @@
|
||||
@click="handleBatchPrintLabel">批量打印标签</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" v-if="showOrderBy">
|
||||
<el-checkbox v-model="queryParams.orderBy" v-loading="loading" @change="getList" label="orderBy">按实际库区排序</el-checkbox>
|
||||
<el-checkbox v-model="queryParams.orderBy" v-loading="loading" @change="getList"
|
||||
label="orderBy">按实际库区排序</el-checkbox>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@@ -412,6 +413,7 @@ import {
|
||||
returnCoil,
|
||||
} from "@/api/wms/coil";
|
||||
import { listBoundCoil } from "@/api/wms/deliveryWaybillDetail";
|
||||
import { addPendingAction } from "@/api/wms/pendingAction";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
import QRCode from "../../print/components/QRCode.vue";
|
||||
import * as XLSX from 'xlsx'
|
||||
@@ -1046,6 +1048,20 @@ export default {
|
||||
handleExportCoil(row) {
|
||||
exportCoil(row.coilId).then(response => {
|
||||
this.$modal.msgSuccess("发货成功");
|
||||
// 2. 插入一条已完成的待操作记录
|
||||
addPendingAction({
|
||||
coilId: row.coilId,
|
||||
currentCoilNo: row.currentCoilNo,
|
||||
actionType: 402, // 402=发货
|
||||
actionStatus: 2, // 直接标记为完成状态
|
||||
scanTime: new Date(),
|
||||
// scanDevice: ,
|
||||
priority: 0, // 0=普通
|
||||
sourceType: 'scan',
|
||||
warehouseId: row.warehouseId,
|
||||
processTime: new Date(),
|
||||
completeTime: new Date()
|
||||
});
|
||||
this.getList();
|
||||
}).catch(error => {
|
||||
this.$modal.msgError("发货失败");
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principal }}</div>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span class="label">电话:</span>
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principalPhone }}</div>
|
||||
<span class="label">订单号:</span>
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.orderId ? localWaybill.orderCode : localWaybill.principalPhone }}</div>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span class="label">合同号:</span>
|
||||
@@ -239,6 +239,8 @@ export default {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.localWaybill = {
|
||||
orderId: newVal.orderId || '',
|
||||
orderCode: newVal.orderCode || '',
|
||||
consigneeUnit: newVal.consigneeUnit || '',
|
||||
senderUnit: newVal.senderUnit || '',
|
||||
deliveryYear: this.getYearFromDate(newVal.deliveryTime) || '',
|
||||
@@ -499,12 +501,12 @@ export default {
|
||||
[
|
||||
`负责人:${this.localWaybill.principal || ''}`,
|
||||
undefined, undefined,
|
||||
`电话:${this.localWaybill.principalPhone || ''}`,
|
||||
`订单号:${this.localWaybill.orderId ? this.localWaybill.orderCode : this.localWaybill.principalPhone || ''}`,
|
||||
undefined, undefined,
|
||||
`合同号:${this.localWaybill.contractCode || ''}`,
|
||||
undefined, undefined,
|
||||
`车牌:${this.localWaybill.licensePlate || ''}`
|
||||
], // 负责人/电话/合同号/车牌行(r=2)
|
||||
], // 负责人/订单号/合同号/车牌行(r=2)
|
||||
["品名", '切边', '包装', '仓库位置', '结算', '原料厂家', '卷号', '规格', '材质', '重量(t)', '单价', '备注'], // 表格表头(r=3)
|
||||
];
|
||||
|
||||
@@ -558,7 +560,7 @@ export default {
|
||||
{ s: { c: 4, r: headerRow1Idx }, e: { c: 7, r: headerRow1Idx } }, // 日期(E2-H2)
|
||||
{ s: { c: 8, r: headerRow1Idx }, e: { c: 11, r: headerRow1Idx } }, // 发货单位(I2-L2)
|
||||
{ s: { c: 0, r: headerRow2Idx }, e: { c: 2, r: headerRow2Idx } }, // 负责人(A3-C3)
|
||||
{ s: { c: 3, r: headerRow2Idx }, e: { c: 5, r: headerRow2Idx } }, // 电话(D3-F3)
|
||||
{ s: { c: 3, r: headerRow2Idx }, e: { c: 5, r: headerRow2Idx } }, // 订单号(D3-F3)
|
||||
{ s: { c: 6, r: headerRow2Idx }, e: { c: 8, r: headerRow2Idx } }, // 合同号(G3-I3)
|
||||
{ s: { c: 9, r: headerRow2Idx }, e: { c: 11, r: headerRow2Idx } }, // 车牌(J3-L3)
|
||||
{ s: { c: 0, r: remarkRowIdx }, e: { c: 11, r: remarkRowIdx } }, // 备注跨列合并(A*_L*)
|
||||
@@ -747,9 +749,9 @@ export default {
|
||||
date: `${this.localWaybill.deliveryYear || ''}年${this.localWaybill.deliveryMonth || ''}月${this.localWaybill.deliveryDay || ''}日`,
|
||||
sender: `发货单位:${this.localWaybill.senderUnit || ''}`
|
||||
};
|
||||
const header2 = { // 负责人+电话+合同号+车牌
|
||||
const header2 = { // 负责人+订单号+合同号+车牌
|
||||
principal: `负责人:${this.localWaybill.principal || ''}`,
|
||||
phone: `电话:${this.localWaybill.principalPhone || ''}`,
|
||||
phone: `订单号:${this.localWaybill.orderId ? this.localWaybill.orderCode : this.localWaybill.principalPhone || ''}`,
|
||||
contract: `合同号:${this.localWaybill.contractCode || ''}`,
|
||||
license: `车牌:${this.localWaybill.licensePlate || ''}`
|
||||
};
|
||||
@@ -797,7 +799,7 @@ export default {
|
||||
worksheet.getCell(`G${rowIdx}`).value = header2.contract;
|
||||
worksheet.getCell(`J${rowIdx}`).value = header2.license;
|
||||
worksheet.mergeCells(`A${rowIdx}:C${rowIdx}`); // 负责人:A3-C3
|
||||
worksheet.mergeCells(`D${rowIdx}:F${rowIdx}`); // 电话:D3-F3
|
||||
worksheet.mergeCells(`D${rowIdx}:F${rowIdx}`); // 订单号:D3-F3
|
||||
worksheet.mergeCells(`G${rowIdx}:I${rowIdx}`); // 合同号:G3-I3
|
||||
worksheet.mergeCells(`J${rowIdx}:L${rowIdx}`); // 车牌:J3-L3
|
||||
// 3.4 表格表头(第4行)
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principal }}</div>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span class="label">电话:</span>
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principalPhone }}</div>
|
||||
<span class="label">订单号:</span>
|
||||
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.orderId ? localWaybill.orderCode : localWaybill.principalPhone }}</div>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span class="label">合同号:</span>
|
||||
@@ -239,6 +239,8 @@ export default {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.localWaybill = {
|
||||
orderId: newVal.orderId || '',
|
||||
orderCode: newVal.orderCode || '',
|
||||
consigneeUnit: newVal.consigneeUnit || '',
|
||||
senderUnit: newVal.senderUnit || '',
|
||||
deliveryYear: this.getYearFromDate(newVal.deliveryTime) || '',
|
||||
@@ -499,12 +501,12 @@ export default {
|
||||
[
|
||||
`负责人:${this.localWaybill.principal || ''}`,
|
||||
undefined, undefined,
|
||||
`电话:${this.localWaybill.principalPhone || ''}`,
|
||||
`订单号:${this.localWaybill.orderId ? this.localWaybill.orderCode : this.localWaybill.principalPhone || ''}`,
|
||||
undefined, undefined,
|
||||
`合同号:${this.localWaybill.contractCode || ''}`,
|
||||
undefined,
|
||||
`车牌:${this.localWaybill.licensePlate || ''}`
|
||||
], // 负责人/电话/合同号/车牌行(r=2)
|
||||
], // 负责人/订单号/合同号/车牌行(r=2)
|
||||
["品名", '切边', '包装', '仓库位置', '结算', '原料厂家', '卷号', '规格', '材质', '重量(t)', '备注'], // 表格表头(r=3,11列)
|
||||
];
|
||||
|
||||
@@ -557,7 +559,7 @@ export default {
|
||||
{ s: { c: 4, r: headerRow1Idx }, e: { c: 6, r: headerRow1Idx } }, // 日期(4-7)
|
||||
{ s: { c: 8, r: headerRow1Idx }, e: { c: 10, r: headerRow1Idx } }, // 发货单位(8-10,无多余)
|
||||
{ s: { c: 0, r: headerRow2Idx }, e: { c: 2, r: headerRow2Idx } }, // 负责人(0-2)
|
||||
{ s: { c: 3, r: headerRow2Idx }, e: { c: 5, r: headerRow2Idx } }, // 电话(3-5)
|
||||
{ s: { c: 3, r: headerRow2Idx }, e: { c: 5, r: headerRow2Idx } }, // 订单号(3-5)
|
||||
{ s: { c: 6, r: headerRow2Idx }, e: { c: 7, r: headerRow2Idx } }, // 合同号(6-8)
|
||||
{ s: { c: 9, r: headerRow2Idx }, e: { c: 10, r: headerRow2Idx } }, // 车牌(9-10,无多余)
|
||||
{ s: { c: 0, r: remarkRowIdx }, e: { c: 10, r: remarkRowIdx } }, // 备注合并0-10列
|
||||
@@ -738,9 +740,9 @@ export default {
|
||||
date: `${this.localWaybill.deliveryYear || ''}年${this.localWaybill.deliveryMonth || ''}月${this.localWaybill.deliveryDay || ''}日`,
|
||||
sender: `发货单位:${this.localWaybill.senderUnit || ''}`
|
||||
};
|
||||
const header2 = { // 负责人+电话+合同号+车牌
|
||||
const header2 = { // 负责人+订单号+合同号+车牌
|
||||
principal: `负责人:${this.localWaybill.principal || ''}`,
|
||||
phone: `电话:${this.localWaybill.principalPhone || ''}`,
|
||||
phone: `订单号:${this.localWaybill.orderId ? this.localWaybill.orderCode : this.localWaybill.principalPhone || ''}`,
|
||||
contract: `合同号:${this.localWaybill.contractCode || ''}`,
|
||||
license: `车牌:${this.localWaybill.licensePlate || ''}`
|
||||
};
|
||||
@@ -788,7 +790,7 @@ export default {
|
||||
worksheet.getCell(`G${rowIdx}`).value = header2.contract;
|
||||
worksheet.getCell(`J${rowIdx}`).value = header2.license;
|
||||
worksheet.mergeCells(`A${rowIdx}:C${rowIdx}`); // 负责人:A3-C3
|
||||
worksheet.mergeCells(`D${rowIdx}:F${rowIdx}`); // 电话:D3-F3
|
||||
worksheet.mergeCells(`D${rowIdx}:F${rowIdx}`); // 订单号:D3-F3
|
||||
worksheet.mergeCells(`G${rowIdx}:I${rowIdx}`); // 合同号:G3-I3
|
||||
worksheet.mergeCells(`J${rowIdx}:K${rowIdx}`); // 车牌:J3-L3
|
||||
// 3.4 表格表头(第4行)
|
||||
|
||||
Reference in New Issue
Block a user