Merge remote-tracking branch 'origin/main'

This commit is contained in:
z 2025-05-29 10:59:41 +08:00
commit bceffcf10f
10 changed files with 790 additions and 660 deletions

View File

@ -109,7 +109,7 @@ public interface ErrorCodeConstants {
ErrorCode TASK_DISPATCH_TASK_NO_PERMISSION_FOR_OPERATE = new ErrorCode(1_009_005, "任务不满足操作条件");
ErrorCode TASK_DISPATCH_TASK_IS_OVER = new ErrorCode(1_009_007, "报工数量已完成");
ErrorCode TASK_DISPATCH_TASK_REPORT_AMOUNT_EXCESS = new ErrorCode(1_009_006, "无法超额报工");
ErrorCode TASK_REPORT_OTHER_PERSON_NO_SUBMIT = new ErrorCode(1_009_008, "其他人员尚未报工,无法结束生产");
ErrorCode TASK_REPORT_OTHER_PERSON_NO_SUBMIT = new ErrorCode(1_009_020, "其他人员尚未报工,无法结束生产");
/*************质量管理***********/
ErrorCode UNQUALIFIED_NOTIFICATION_NOT_EXISTS = new ErrorCode(1_010_001, "品质异常通知单审核不存在");
ErrorCode QUALITY_FEEDBACK_NOT_EXISTS = new ErrorCode(1_010_002, "客户反馈质量不存在");

View File

@ -1,10 +1,9 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;

View File

@ -138,6 +138,8 @@ public class TaskDispatchDetailDO extends BaseDO {
private String procdureName;
@TableField(exist = false)
private String type;
@TableField(exist = false)
private String ownerName;
/**
* 预计工时
*/

View File

@ -18,6 +18,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatch
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetailowner.TaskDispatchDetailOwnerDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -58,6 +59,12 @@ public interface TaskDispatchDetailMapper extends BaseMapperX<TaskDispatchDetail
}
return dateRange;
}
default List<TaskDispatchDetailDO> selectListByDeitalOwnerId(Long detailOwnerId){
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDetailDO.class)
.select("a.nickname as ownerName").leftJoin(AdminUserDO.class,"a",AdminUserDO::getId,TaskDispatchDetailDO::getOwner).eq(TaskDispatchDetailDO::getDetailOwnerId,detailOwnerId);
return selectList(query);
}
/*public static void main(String[] args) {
// 示例假设传入的时间戳代表 2024 2 11
LocalDate exampleDate = LocalDate.of(2025, 2, 13);
@ -133,7 +140,10 @@ public interface TaskDispatchDetailMapper extends BaseMapperX<TaskDispatchDetail
}
default int updateByOwner(TaskDispatchDetailOwnerDO taskDispatchDetailOwnerDO, Set<String> owner){
UpdateWrapper<TaskDispatchDetailDO> wrapper = new UpdateWrapper();
wrapper.eq("detail_owner_id",taskDispatchDetailOwnerDO.getId()).in("owner",owner);
wrapper.eq("detail_owner_id",taskDispatchDetailOwnerDO.getId());
if (CollUtil.isNotEmpty(owner)){
wrapper.in("owner",owner);
}
if (taskDispatchDetailOwnerDO.getProcedureId() != null) {
wrapper.set("procedure_id", taskDispatchDetailOwnerDO.getProcedureId());
}

View File

@ -568,7 +568,10 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
.ne(TaskReportDO::getAmount, 0);
}});
int historyReportAmount = historyReportList.stream().mapToInt(TaskReportDO::getAmount).sum();
if (!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() <= historyReportAmount){
// if (!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() <= historyReportAmount){
// throw exception(TASK_DISPATCH_TASK_IS_OVER);
// }
if ( taskDispatchDetailDO.getAmount() <= historyReportAmount){
throw exception(TASK_DISPATCH_TASK_IS_OVER);
}
}
@ -587,10 +590,16 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
.ne(TaskReportDO::getAmount, 0);
}});
int historyReportAmount = historyReportList.stream().mapToInt(TaskReportDO::getAmount).sum();
if (!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() <= historyReportAmount){
// if (!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() <= historyReportAmount){
// throw exception(TASK_DISPATCH_TASK_IS_OVER);
// }
// if(!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() < (historyReportAmount + operateReqVO.getAmount())){
// throw exception(TASK_DISPATCH_TASK_REPORT_AMOUNT_EXCESS);
// }
if ( taskDispatchDetailDO.getAmount() <= historyReportAmount){
throw exception(TASK_DISPATCH_TASK_IS_OVER);
}
if(!taskDispatchDO.getDispatchType().equals("ASSEMBLE") && taskDispatchDetailDO.getAmount() < (historyReportAmount + operateReqVO.getAmount())){
if( taskDispatchDetailDO.getAmount() < (historyReportAmount + operateReqVO.getAmount())){
throw exception(TASK_DISPATCH_TASK_REPORT_AMOUNT_EXCESS);
}
}
@ -643,37 +652,48 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.COMPLETED.getCode());
//装配看看是不是多人如果是多人判断一下
boolean allReport = true;
HashMap<Long,TaskDispatchDetailDO> dispatchDetailDOHashMap = new HashMap<>();
String msg = "";
if (taskDispatchDO.getDispatchType().equals("ASSEMBLE")){
List<TaskDispatchDetailDO> taskDispatchDetailDOS = taskDispatchDetailMapper.selectList(new LambdaQueryWrapperX<TaskDispatchDetailDO>().eq(TaskDispatchDetailDO::getDetailOwnerId, taskDispatchDetailDO.getDetailOwnerId()));
List<Long> dispatchDetailId = new ArrayList<>();
List<TaskDispatchDetailDO> taskDispatchDetailDOS = taskDispatchDetailMapper.selectListByDeitalOwnerId(taskDispatchDetailDO.getDetailOwnerId());
for (TaskDispatchDetailDO dispatchDetailDO : taskDispatchDetailDOS) {
if (!dispatchDetailDO.getId().equals(taskDispatchDetailDO.getId()) && !(dispatchDetailDO.getProcedureStatus() == TaskDispatchProcedureStatusEnum.COMPLETED.getCode())){
dispatchDetailId.add(dispatchDetailDO.getId());
dispatchDetailDOHashMap.put(dispatchDetailDO.getId(),dispatchDetailDO);
}
}
boolean allReport = true;
if (CollUtil.isNotEmpty(dispatchDetailId)){
List<HashMap<Long, Long>> hashMaps = taskDispatchDetailMapper.sumAssembleReport(dispatchDetailId);
if (CollUtil.isNotEmpty(dispatchDetailDOHashMap)){
List<HashMap<Long, Long>> hashMaps = taskDispatchDetailMapper.sumAssembleReport(new ArrayList<>(dispatchDetailDOHashMap.keySet()));
HashMap<Long,Long> reportMap = new HashMap<>();
for (HashMap<Long, Long> hashMap : hashMaps) {
reportMap.putAll(hashMap);
reportMap.put(hashMap.get("detailId"),hashMap.get("amount"));
}
for (Long l : dispatchDetailDOHashMap.keySet()) {
if (!reportMap.containsKey(l)){
msg = msg + dispatchDetailDOHashMap.get(l).getOwnerName() + ",";
allReport = false;
}
}
if (!msg.equals("")){
msg = msg.substring(0,msg.length()-1) + "还没有报工,请确认";
}
for (Long l : dispatchDetailId) {
if (!reportMap.containsKey(l)){
allReport = false;
break;
}
}
}
if (!allReport){
throw exception(TASK_REPORT_OTHER_PERSON_NO_SUBMIT);
throw exception(new ErrorCode(1_009_019,msg));
}
if (allReport){
TaskDispatchDetailOwnerDO taskDispatchDetailOwnerDO = taskDispatchDetailOwnerMapper.selectById(taskDispatchDetailDO.getDetailOwnerId());
taskDispatchDetailOwnerDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.COMPLETED.getCode());
taskDispatchDetailOwnerMapper.updateById(taskDispatchDetailOwnerDO);
TaskDispatchDetailOwnerDO ownerDO = new TaskDispatchDetailOwnerDO();
ownerDO.setId(taskDispatchDetailOwnerDO.getId());
ownerDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.COMPLETED.getCode());
taskDispatchDetailMapper.updateByOwner(ownerDO,null);
}
}
//子项目装配是否完成
@ -700,9 +720,13 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
}
}
if (CollUtil.isNotEmpty(productionList)){
if (CollUtil.isNotEmpty(dispatchDetailDOHashMap)){
productionList = productionList.stream().filter((e -> !dispatchDetailDOHashMap.keySet().contains(e.getId()))).collect(Collectors.toList());
}
for (TaskDispatchDetailDO dispatchDetailDO : productionList) {
if (!dispatchDetailDO.getId().equals(taskDispatchDetailDO.getId()) &&
dispatchDetailDO.getProcedureStatus() !=TaskDispatchProcedureStatusEnum.COMPLETED.getCode()){
if (!dispatchDetailDO.getId().equals(taskDispatchDetailDO.getId()) && dispatchDetailDO.getProcedureStatus() !=TaskDispatchProcedureStatusEnum.COMPLETED.getCode()){
//如果其他的有未完成的
isProjectSubAssembleOver = false;
break;
@ -718,9 +742,11 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
bdgzsomthingMapper.updateById(bdgzsomthingDO);
}
}
if (taskDispatchDO.getDispatchType().equals("PRODUCTION") && isBomDetailProductionOver){
pgMasterService.insertPgList(planDO.getId(),planDO.getProjectId(),taskDispatchDO.getBomDetailId());
}else if (taskDispatchDO.getDispatchType().equals("ASSEMBLE") && isProjectSubAssembleOver){
}else if (taskDispatchDO.getDispatchType().equals("ASSEMBLE") && isProjectSubAssembleOver ){
zjPgMasterService.insertZjList(planDO.getId(),planDO.getProjectId(),taskDispatchDO.getProjectSubId());
}
// // TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(taskDispatchDetailDO.getDispatchId());

View File

@ -103,7 +103,7 @@
GROUP BY t.id
</select>
<select id="sumAssembleReport" parameterType="java.util.List">
select t.dispatch_detail_id,count(t.id) from pro_task_report t where t.dispatch_detail_id in
select t.dispatch_detail_id as detailId,count(t.id) as amount from pro_task_report t where t.dispatch_detail_id in
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -314,6 +314,7 @@ v-for="dict in userInit" :key="dict.id"
readonly
:disabled="detailDisabled || row.beginProduce != 0 "
@click.prevent="handleClick(row.owners,$index)"
:title="row.ownerNames"
>
<template #append
><el-button

View File

@ -121,7 +121,7 @@ const getList = async () => {
loading.value = true
//
try {
postList.value = [];
// postList.value = [];
list.value = []
var hasSet = new Set;
const data = await UserApi.getUserPage(queryParams)
@ -150,8 +150,12 @@ const getList = async () => {
beforeOwnerList.value.forEach(item =>{
list.value.forEach(item1 =>{
if(item == item1.id){
var id = multipleSelection.value. some(item2 => item2.id === item)
if(!id){
multipleSelection.value.push(item1);
}
multipleTable.value.toggleRowSelection(item1, true)
}
})
})
@ -161,12 +165,28 @@ const getList = async () => {
total.value = 0
}
hasSet.forEach(item =>{
postList.value.push({
label:item,
value:item
})
})
if(!arrayEmpty(multipleSelection.value)){
let seenIds = new Set();
let uniqueItems = multipleSelection.value.filter(item => {
// id false true
if (seenIds.has(item.id)) {
return false;
} else {
seenIds.add(item.id);
return true;
}
});
multipleSelection.value = uniqueItems
}
// if(arrayEmpty(postList.value)){
// hasSet.forEach(item =>{
// postList.value.push({
// label:item,
// value:item
// })
// })
// }
}else{
list.value = []
total.value = 0
@ -300,6 +320,15 @@ const faindex =ref()
const open = async (owners,index) => {
multipleSelection.value=[]
console.log(owners)
postList.value = []
postList.value.push({
label:'4',
value:'4'
})
postList.value.push({
label:'5',
value:'5'
})
beforeOwnerList.value = owners;
faindex.value=index
dialogVisible.value = true

View File

@ -11,28 +11,30 @@ const dictInfo = userStore?.dictInfo || []
const unitDictData = dictInfo.filter(e => e.dictType == 'heli_material_unit') || []
const userId = userStore.userInfo.userId
const isShowStart = computed(() => {
let flag = true
if (historyList.value.length) {
const obj = historyList.value[0]
if (!obj?.endTime) {
flag = false
}
}
return flag
})
const isShowEnd = computed(() => {
let flag = true
if (historyList.value.length) {
const obj = historyList.value[0]
if (obj?.endTime) {
flag = false
}
} else {
flag = false
}
return flag
})
const isShowStart = ref(false)
const isShowEnd = ref(false)
// const isShowStart = computed(() => {
// let flag = true
// if (historyList.value.length) {
// const obj = historyList.value[0]
// if (!obj?.endTime) {
// flag = false
// }
// }
// return flag
// })
// const isShowEnd = computed(() => {
// let flag = true
// if (historyList.value.length) {
// const obj = historyList.value[0]
// if (obj?.endTime) {
// flag = false
// }
// } else {
// flag = false
// }
// return flag
// })
const amount = ref(null)
const workTime = ref(null)
//
@ -56,28 +58,42 @@ const getData = async () => {
e.endTimeStr = e.endTime && formatDate(e.endTime, 'YYYY-MM-DD HH:mm')
// e.endTimeStr = '2025-01-13 00:00'
})
// if (data.list[0]) {
// formObj.value = data.list[0]
// const time = formObj.value.endTime - formObj.value.startTime //
// console.log(time)
// const leave1 = time % (24 * 3600 * 1000) //
// workTime.value = Math.floor(leave1 / (3600 * 1000))
// }
// if (data.list[0]) {
// // Date
// formObj.value = data.list[0]
// const endTime= new Date(formObj.value.endTimeStr);
// const startTime = new Date(formObj.value.startTimeStr);
if (data.list[0]) {
// Date
formObj.value = data.list[0]
const endTime= new Date(formObj.value.endTimeStr);
const startTime = new Date(formObj.value.startTimeStr);
//
const timeDifferenceInMs = endTime - startTime;
// //
// const timeDifferenceInMs = endTime - startTime;
//
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
if ("Y"==detailInfo.value.isOutsourcing){
// //
// const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
// const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
// workTime.value = roundedTimeDifference;
// }
}else {
workTime.value = roundedTimeDifference;
}
}
historyList.value = data.list
isShowEnd.value = true;
isShowStart.value = true
if (historyList.value.length) {
const obj = historyList.value[0]
console.log('s')
if (!obj?.amount) {
isShowStart.value= false
}
}
if (historyList.value.length) {
const obj = historyList.value[0]
if (obj?.amount) {
isShowEnd.value = false
}
} else {
isShowEnd.value = false
}
if(historyList.value!=null&&historyList.value.length>0){
var totalAmount = detailInfo.value.amount;
var beforeAmount = detailInfo.value.totalReportAmount
@ -89,6 +105,7 @@ const getData = async () => {
}
isLoading.value = false
}
//
@ -107,27 +124,28 @@ const getDetailData = async (id) => {
data.startTime = formatDate(data.startTime, 'YYYY-MM-DD HH:mm');
data.endTime = formatDate(data.endTime, 'YYYY-MM-DD HH:mm'); //
const endTime = new Date(data.endTime);
const startTime = new Date(data.startTime);
// //
const timeDifferenceInMs = endTime - startTime;
// //
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
workTime.value = roundedTimeDifference;
// const endTime = new Date(data.endTime);
// const startTime = new Date(data.startTime);
// // //
// const timeDifferenceInMs = endTime - startTime;
// // //
// const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
// const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
// workTime.value = roundedTimeDifference;
//
const lineObj = unitDictData.find((q) => q.value == data.unit) || {}
data.unit = lineObj.label
detailInfo.value = data || {}
isLoading.value = false
}
const popupShow = ref(false)
onLoad(async (options: any) => {
await getDetailData(options.id)
await getData()
const obj = historyList.value[0]
//
if (obj && obj?.workTime == null && obj.endTime) {
popup.value?.open()
popupShow.value = true
}
})
@ -138,8 +156,12 @@ const handleComplate = async () => {
id: detailInfo.value?.id,
active: 'FINISH',
}
const data = await postOperateAPI(params)
isLoading.value = false
try {
const data = await postOperateAPI(params);
} catch (error) {
} finally {
isLoading.value = false;
}
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
@ -147,6 +169,7 @@ const handleComplate = async () => {
}
//
const handleOk = async (active) => {
console.log(amount.value)
const params = {
id: detailInfo.value?.id,
active: 'SUBMIT',
@ -178,10 +201,11 @@ const handleStop = async () => {
active: 'END',
}
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
})
await getData()
// const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({
// url,
// })
popup.value?.open()
}
</script>
@ -270,20 +294,20 @@ const handleStop = async () => {
<view class="cont">
<view class="item">
<view class="label">开始生产时间</view>
<view class="val">{{ detailInfo.startTime }}</view>
<view class="val">{{ formObj.startTimeStr }}</view>
</view>
<view class="item">
<view class="label">结束生产时间</view>
<view class="val">{{ detailInfo.endTime }}</view>
<view class="val">{{ formObj.endTimeStr }}</view>
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工工时</view>
<uni-easyinput class="val" type="digit" v-model="amount" placeholder="请输入本次报工工时"></uni-easyinput>
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
<view class="unit"></view>
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工数量</view>
<uni-easyinput class="val" type="number" v-model="workTime" placeholder="请输入本次报工数量"></uni-easyinput>
<uni-easyinput class="val" type="number" v-model="amount" placeholder="请输入本次报工数量"></uni-easyinput>
<view class="unit"> {{ detailInfo.unit }}</view>
</view>
</view>

View File

@ -1,50 +1,52 @@
<script setup lang="ts">
import { toRaw, ref, computed } from 'vue'
import { formatDate } from '@/utils/index'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useLoginStore } from '@/stores/modules/login'
import { getTaskRepotPageAPI, getTaskDetailAPI, postOperateAPI,getListWxAPI } from '@/services/productionReport'
const popup = ref<UniHelper.UniPopupInstance>()
const userStore = useLoginStore()
const dictInfo = userStore?.dictInfo || []
const unitDictData = dictInfo.filter(e => e.dictType == 'heli_material_unit') || []
const userId = userStore.userInfo.userId
import { toRaw, ref, computed } from 'vue'
import { formatDate } from '@/utils/index'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useLoginStore } from '@/stores/modules/login'
import { getTaskRepotPageAPI, getTaskDetailAPI, postOperateAPI, getListWxAPI } from '@/services/productionReport'
const popup = ref<UniHelper.UniPopupInstance>()
const userStore = useLoginStore()
const dictInfo = userStore?.dictInfo || []
const unitDictData = dictInfo.filter(e => e.dictType == 'heli_material_unit') || []
const userId = userStore.userInfo.userId
const isShowStart = computed(() => {
let flag = true
if (historyList.value.length) {
const obj = historyList.value[0]
if (!obj?.endTime) {
flag = false
}
}
// //
// if (detailInfo.value.amount == detailInfo.value.totalReportAmount) {
const isShowStart = ref(false)
const isShowEnd = ref(false)
// const isShowStart = computed(() => {
// let flag = true
// if (historyList.value.length) {
// const obj = historyList.value[0]
// if (!obj?.endTime) {
// flag = false
// }
return flag
})
const isShowEnd = computed(() => {
let flag = true
if (historyList.value.length) {
const obj = historyList.value[0]
if (obj?.endTime) {
flag = false
}
} else {
flag = false
}
return flag
})
const amount = ref('')
const workTime = ref('')
//
const detailInfo = ref({})
let isLoading = ref(false)
const historyList = ref([])
const formObj = ref({})
//
const getData = async () => {
// }
// // //
// // if (detailInfo.value.amount == detailInfo.value.totalReportAmount) {
// // flag = false
// // }
// return flag
// })
// const isShowEnd = computed(() => {
// let flag = true
// if (historyList.value.length) {
// const obj = historyList.value[0]
// if (obj?.endTime) {
// flag = false
// }
// } else {
// flag = false
// }
// return flag
// })
const amount = ref('')
const workTime = ref('')
//
const detailInfo = ref({})
let isLoading = ref(false)
const historyList = ref([])
const formObj = ref({})
//
const getData = async () => {
//
isLoading.value = true
const params = {
@ -59,17 +61,10 @@ const getData = async () => {
e.endTimeStr = e.endTime && formatDate(e.endTime, 'YYYY-MM-DD HH:mm')
// e.endTimeStr = '2025-01-13 00:00'
})
// if (data.list[0]) {
// formObj.value = data.list[0]
// const time = formObj.value.endTime - formObj.value.startTime //
// console.log(time)
// const leave1 = time % (24 * 3600 * 1000) //
// workTime.value = Math.floor(leave1 / (3600 * 1000))
// }
if (data.list[0]) {
// Date
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 timeDifferenceInMs = endTime - startTime;
@ -77,36 +72,54 @@ const getData = async () => {
//
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
if ("Y"==detailInfo.value.isOutsourcing){
if ("Y" == detailInfo.value.isOutsourcing) {
}else {
} else {
workTime.value = roundedTimeDifference;
}
}
historyList.value = data.list
if(historyList.value!=null&&historyList.value.length>0){
isShowEnd.value = true;
isShowStart.value = true
if (historyList.value.length) {
const obj = historyList.value[0]
if (!obj?.amount) {
isShowStart.value = false
}
}
if (historyList.value.length) {
const obj = historyList.value[0]
if (obj?.amount) {
isShowEnd.value = false
}
} else {
isShowEnd.value = false
}
console.log(isShowEnd.value);
console.log(isShowStart.value)
if (historyList.value != null && historyList.value.length > 0) {
var totalAmount = detailInfo.value.amount;
var beforeAmount = detailInfo.value.totalReportAmount
if(totalAmount >= beforeAmount){
if (totalAmount >= beforeAmount) {
amount.value = totalAmount - beforeAmount
}else{
} else {
amount.value = 0
}
}
isLoading.value = false
}
const isOverBeforeProcedure = ref(true)
//
const getDetailData = async (id) => {
}
const isOverBeforeProcedure = ref(true)
//
const getDetailData = async (id) => {
//
// isLoading.value = true
const params = {
id,
}
const data = await getTaskDetailAPI(params)
if(data.beforeProcedureStatus == 0){
if (data.beforeProcedureStatus == 0) {
//
isOverBeforeProcedure.value = true;
}
@ -118,33 +131,37 @@ const getDetailData = async (id) => {
detailInfo.value = data || {}
isLoading.value = false
}
onLoad(async (options: any) => {
}
onLoad(async (options : any) => {
await getDetailData(options.id)
await getData()
const obj = historyList.value[0]
//
if (obj && obj?.workTime == null && obj.endTime) {
popup.value?.open()
popupShow.value = true
}
})
})
//
const handleComplate = async () => {
//
const handleComplate = async () => {
isLoading.value = true;
const params = {
id: detailInfo.value?.id,
active: 'FINISH',
}
const data = await postOperateAPI(params)
isLoading.value = false
try {
const data = await postOperateAPI(params);
} catch (error) {
} finally {
isLoading.value = false;
}
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
})
}
//
const handleOk = async (active) => {
}
//
const handleOk = async (active) => {
const params = {
id: detailInfo.value?.id,
active: 'SUBMIT',
@ -156,13 +173,13 @@ const handleOk = async (active) => {
uni.redirectTo({
url,
})
}
//
const handleStart = async () => {
}
//
const handleStart = async () => {
const params = {
id: detailInfo.value.id,
active: 'START',
ownerId:userId
ownerId: userId
}
productionTitle.value = '生产中';
console.log(detailInfo.value)
@ -171,35 +188,39 @@ const handleStart = async () => {
uni.redirectTo({
url,
})
}
const productionTitle = ref('开始生产')
//
const handleStop = async () => {
}
const popupShow = ref(false)
const productionTitle = ref('开始生产')
//
const handleStop = async () => {
const params = {
id: detailInfo.value?.id,
active: 'END',
}
console.log(detailInfo.value)
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
})
await getData()
// const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({
// url,
// })
popup.value?.open()
}
}
</script>
<template>
<view>
<view>
<view v-if="isOverBeforeProcedure==true" class="data-detail">
<template v-if="!isLoading">
<view class="module">
<view class="module-info">
<view class="product-item product-name">项目{{ detailInfo.projectCode }} {{ detailInfo.projectName }}</view>
<image src="/static/images/productionReport-page.png" class="product-img" mode="scaleToFill"></image>
<view class="product-item product-name">项目{{ detailInfo.projectCode }}
{{ detailInfo.projectName }}</view>
<image src="/static/images/productionReport-page.png" class="product-img" mode="scaleToFill">
</image>
<view :class="[detailInfo.procedureStatus == 2 ? 'had' : 'unhad', 'product-status']">{{
detailInfo.procedureStatus == 2 ? '已完成' : '未完成' }}</view>
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }} {{' ' + detailInfo.projectSubName }}
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }}
{{' ' + detailInfo.projectSubName }}
</view>
<view class="product-row">
<view class="row-item">
@ -230,9 +251,11 @@ const handleStop = async () => {
</view>
</view>
<view class="product-item">预计生产日期{{ detailInfo.startTime }} {{ detailInfo.endTime }}</view>
<view class="finish" v-if="isShowStart && detailInfo.procedureStatus !== 2 && detailInfo.totalWorkTime"
@click="handleComplate" >
<image class="complate-img" src="/static/images/productionReport-detail-complate.png" mode="scaleToFill" />
<view class="finish"
v-if="isShowStart && detailInfo.procedureStatus !== 2 && detailInfo.totalWorkTime"
@click="handleComplate">
<image class="complate-img" src="/static/images/productionReport-detail-complate.png"
mode="scaleToFill" />
生产完成
</view>
</view>
@ -259,7 +282,8 @@ const handleStop = async () => {
</view>
</view>
<view class="tip-index">
<image src="/static/images/productionReport-detail-index.png" class="icon-status" mode="scaleToFit">
<image src="/static/images/productionReport-detail-index.png" class="icon-status"
mode="scaleToFit">
</image>
<view class="text">{{historyList.length - index}}</view>
</view>
@ -269,7 +293,7 @@ const handleStop = async () => {
</view>
</view>
<view class="action" v-if="detailInfo.procedureStatus !== 2">
<view class="action-item start" v-if="isShowStart" @click="handleStart">{{productionTitle}}</view>
<view class="action-item start" v-if="isShowStart" @click="handleStart">开始生产</view>
<view class="action-item stop" v-if="isShowEnd" @click="handleStop">结束生产</view>
</view>
</template>
@ -290,12 +314,14 @@ const handleStop = async () => {
</view>
<view class="item">
<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">{{ detailInfo.isOutsourcing=='Y'?"元":"小时" }}</view>
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工数量</view>
<uni-easyinput class="val" type="number" v-model="amount" placeholder="请输入本次报工数量"></uni-easyinput>
<uni-easyinput class="val" type="number" v-model="amount"
placeholder="请输入本次报工数量"></uni-easyinput>
<view class="unit"> {{ detailInfo.unit }}</view>
</view>
</view>
@ -305,12 +331,12 @@ const handleStop = async () => {
<view v-if="isOverBeforeProcedure==false">
<p>上一道工序尚未完工请等待上一道工序完工后进行报工</p>
</view>
</view>
</view>
</template>
<style lang="scss">
//
.data-detail {
//
.data-detail {
border-radius: 10rpx;
padding-bottom: 200rpx;
@ -342,10 +368,12 @@ const handleStop = async () => {
border-raduis: 10rpx;
text-align: center;
padding: 8rpx 12rpx;
&.had {
background: #E8FFEA;
color: #00B42A;
}
&.unhad {
background: #FFF7E8;
color: #FF7D00;
@ -383,6 +411,7 @@ const handleStop = async () => {
}
}
.finish {
position: absolute;
right: 40rpx;
@ -396,6 +425,7 @@ const handleStop = async () => {
display: flex;
align-items: center;
justify-content: center;
.complate-img {
width: 30rpx;
height: 30rpx;
@ -437,10 +467,12 @@ const handleStop = async () => {
.product-item {
margin: 10rpx 0;
.hight-color {
color: #00B42A;
}
}
.product-row {
margin: 20rpx 0;
display: flex;
@ -452,8 +484,10 @@ const handleStop = async () => {
flex: 1;
display: flex;
flex-direction: row;
.label {
margin-bottom: 10rpx;
&.high-color {
color: #00B42A
}
@ -469,15 +503,18 @@ const handleStop = async () => {
}
}
.tip-index {
position: absolute;
top: 0rpx;
right: 0rpx;
.icon-status {
width: 100rpx;
height: 72rpx;
z-index: 1;
}
.text {
color: #fff;
position: absolute;
@ -586,6 +623,7 @@ const handleStop = async () => {
.label {
font-size: 32rpx;
width: 260rpx;
.star {
color: red
}
@ -595,6 +633,7 @@ const handleStop = async () => {
flex: 1;
font-size: 32rpx;
}
.unit {
width: 100rpx;
margin-left: 4rpx;
@ -614,5 +653,5 @@ const handleStop = async () => {
color: #fff;
}
}
}
}
</style>