生产任务派工单自动带出结束日期
This commit is contained in:
parent
df4bc39ad9
commit
6f82360744
@ -203,7 +203,7 @@ class="!w-260px" v-model="formData.createTime" type="date" value-format="x"
|
|||||||
v-loading="subFormLoading" label-width="0">
|
v-loading="subFormLoading" label-width="0">
|
||||||
<el-table :data="formData.taskDispatchDetails" height="250" >
|
<el-table :data="formData.taskDispatchDetails" height="250" >
|
||||||
|
|
||||||
<el-table-column fixed label="是否外协" align="center" width="100">
|
<el-table-column fixed label="外协" align="center" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-checkbox v-model="row.isOutsourcing" @change="handleOutsourcingChange(row)" :disabled="detailDisabled||row.beginProduce != 0 || row.procedureStatus != 0"/>
|
<el-checkbox v-model="row.isOutsourcing" @change="handleOutsourcingChange(row)" :disabled="detailDisabled||row.beginProduce != 0 || row.procedureStatus != 0"/>
|
||||||
</template>
|
</template>
|
||||||
@ -489,7 +489,7 @@ import {
|
|||||||
} from '@/utils/dict'
|
} from '@/utils/dict'
|
||||||
import {
|
import {
|
||||||
dateFormatter,
|
dateFormatter,
|
||||||
formatDate
|
formatDate, formatDate1
|
||||||
} from "@/utils/formatTime";
|
} from "@/utils/formatTime";
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
@ -1199,11 +1199,11 @@ const queryData = async (id?: number) => {
|
|||||||
formData.value.taskDispatchDetails = await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
|
formData.value.taskDispatchDetails = await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
|
||||||
checkList.value = [];
|
checkList.value = [];
|
||||||
if(formData.value.taskDispatchDetails!=null){
|
if(formData.value.taskDispatchDetails!=null){
|
||||||
formData.value.taskDispatchDetails.forEach(item=>{
|
formData.value.taskDispatchDetails.forEach(item=> {
|
||||||
if ("Y"==item.isOutsourcing){
|
if ("Y" == item.isOutsourcing) {
|
||||||
item.isOutsourcing=true
|
item.isOutsourcing = true
|
||||||
}else{
|
} else {
|
||||||
item.isOutsourcing=false
|
item.isOutsourcing = false
|
||||||
}
|
}
|
||||||
procedureList.value.forEach(items =>{
|
procedureList.value.forEach(items =>{
|
||||||
if(items.id == item.procedureId){
|
if(items.id == item.procedureId){
|
||||||
@ -1278,7 +1278,27 @@ const submitForm = async (operate) => {
|
|||||||
message.error('派工明细不能为空')
|
message.error('派工明细不能为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for(var i = 0 ; i < formData.value.taskDispatchDetails.length ; i++){
|
||||||
|
const d1 = new Date(formData.value.taskDispatchDetails[i].endTime);
|
||||||
|
const d2 = new Date(formData.value.requiredCompletedDate);
|
||||||
|
|
||||||
|
d1.setHours(0, 0, 0, 0);
|
||||||
|
d2.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
if( d1>d2){
|
||||||
|
let name;
|
||||||
|
procedureList.value.forEach(items =>{
|
||||||
|
if (items.id==formData.value.taskDispatchDetails[i].procedureId){
|
||||||
|
name=items.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
await message.confirm('工序('+name+")预计结束日期超过生产计划日期"+formatDate1(d2)+"是否继续 '")
|
||||||
|
}
|
||||||
|
}
|
||||||
var ownerIsNull = false;
|
var ownerIsNull = false;
|
||||||
|
if(operate == 'SUBMIT'){
|
||||||
for(var i = 0 ; i < formData.value.taskDispatchDetails.length ; i++){
|
for(var i = 0 ; i < formData.value.taskDispatchDetails.length ; i++){
|
||||||
if( formData.value.taskDispatchDetails[i].startTime == undefined || formData.value.taskDispatchDetails[i].startTime == null ||formData.value.taskDispatchDetails[i].startTime == ''){
|
if( formData.value.taskDispatchDetails[i].startTime == undefined || formData.value.taskDispatchDetails[i].startTime == null ||formData.value.taskDispatchDetails[i].startTime == ''){
|
||||||
message.error("第"+(i+1)+'行预计开始日期为空,请确认')
|
message.error("第"+(i+1)+'行预计开始日期为空,请确认')
|
||||||
@ -1307,8 +1327,9 @@ const submitForm = async (operate) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ownerIsNull){
|
if(ownerIsNull){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1407,6 +1428,7 @@ const onAddItem = () => {
|
|||||||
if(add){
|
if(add){
|
||||||
row.amount = formData.value.amount
|
row.amount = formData.value.amount
|
||||||
row.dispatchId = formData.value.id
|
row.dispatchId = formData.value.id
|
||||||
|
row.endTime = formData.value.requiredCompletedDate
|
||||||
list.push(row)
|
list.push(row)
|
||||||
row.sort = i;
|
row.sort = i;
|
||||||
i++;
|
i++;
|
||||||
|
@ -71,15 +71,19 @@ const getData = async () => {
|
|||||||
formObj.value = data.list[0]
|
formObj.value = data.list[0]
|
||||||
const endTime= new Date(formObj.value.endTimeStr);
|
const endTime= new Date(formObj.value.endTimeStr);
|
||||||
const startTime = new Date(formObj.value.startTimeStr);
|
const startTime = new Date(formObj.value.startTimeStr);
|
||||||
|
|
||||||
// 计算两个日期之间的毫秒差
|
// 计算两个日期之间的毫秒差
|
||||||
const timeDifferenceInMs = endTime - startTime;
|
const timeDifferenceInMs = endTime - startTime;
|
||||||
|
|
||||||
// 将毫秒差转换为小时
|
// 将毫秒差转换为小时
|
||||||
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
|
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
|
||||||
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
|
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
|
||||||
|
if ("Y"==detailInfo.value.isOutsourcing){
|
||||||
|
|
||||||
|
}else {
|
||||||
workTime.value = roundedTimeDifference;
|
workTime.value = roundedTimeDifference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
historyList.value = data.list
|
historyList.value = data.list
|
||||||
if(historyList.value!=null&&historyList.value.length>0){
|
if(historyList.value!=null&&historyList.value.length>0){
|
||||||
var totalAmount = detailInfo.value.amount;
|
var totalAmount = detailInfo.value.amount;
|
||||||
@ -111,6 +115,7 @@ const getDetailData = async (id) => {
|
|||||||
// 单位枚举
|
// 单位枚举
|
||||||
const lineObj = unitDictData.find((q) => q.value == data.unit) || {}
|
const lineObj = unitDictData.find((q) => q.value == data.unit) || {}
|
||||||
data.unit = lineObj.label
|
data.unit = lineObj.label
|
||||||
|
|
||||||
detailInfo.value = data || {}
|
detailInfo.value = data || {}
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@ -160,6 +165,7 @@ const handleStart = async () => {
|
|||||||
ownerId:userId
|
ownerId:userId
|
||||||
}
|
}
|
||||||
productionTitle.value = '生产中';
|
productionTitle.value = '生产中';
|
||||||
|
console.log(detailInfo.value)
|
||||||
const data = await postOperateAPI(params)
|
const data = await postOperateAPI(params)
|
||||||
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
|
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
@ -173,7 +179,9 @@ const handleStop = async () => {
|
|||||||
id: detailInfo.value?.id,
|
id: detailInfo.value?.id,
|
||||||
active: 'END',
|
active: 'END',
|
||||||
}
|
}
|
||||||
|
console.log(detailInfo.value)
|
||||||
const data = await postOperateAPI(params)
|
const data = await postOperateAPI(params)
|
||||||
|
|
||||||
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
|
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url,
|
url,
|
||||||
@ -283,7 +291,7 @@ const handleStop = async () => {
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="label"><span class="star">*</span>本次报工工时:</view>
|
<view class="label"><span class="star">*</span>本次报工工时:</view>
|
||||||
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
|
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
|
||||||
<view class="unit">小时</view>
|
<view class="unit">{{ detailInfo.isOutsourcing=='Y'?"元":"小时" }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="label"><span class="star">*</span>本次报工数量:</view>
|
<view class="label"><span class="star">*</span>本次报工数量:</view>
|
||||||
|
Loading…
Reference in New Issue
Block a user