1.文件配置类修改:分为linux/win系统

2.派工单按1.14日文档修改
This commit is contained in:
Ledo 2025-01-14 23:24:40 +08:00
parent 28f87258a2
commit 9d1e453c29
21 changed files with 472 additions and 43 deletions

View File

@ -184,7 +184,13 @@ public class TaskDispatchController {
taskDispatchService.operateDetail(operateReqVO); taskDispatchService.operateDetail(operateReqVO);
return success(null); return success(null);
} }
@GetMapping("/task-dispatch-detail/judgeHasOver")
@Operation(summary = "判断是否有已完成的派工任务")
@Parameter(name = "id", description = "派工单id", required = true)
@PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')")
public CommonResult<Boolean> judgeHasOver(@RequestParam("id") Long id) {
return success(taskDispatchService.judgeHasOver(id));
}
@GetMapping("/task-dispatch-detail/pageTotal") @GetMapping("/task-dispatch-detail/pageTotal")
@Operation(summary = "获得派工明细数据") @Operation(summary = "获得派工明细数据")
@PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')") @PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')")

View File

@ -122,5 +122,5 @@ public class TaskDispatchRespVO {
@Schema(description = "要求完成日期") @Schema(description = "要求完成日期")
private LocalDateTime requiredEndDate; private LocalDateTime requiredEndDate;
private Integer projectSubAmount;
} }

View File

@ -136,7 +136,8 @@ public class TaskDispatchDO extends BaseDO {
@TableField(exist = false) @TableField(exist = false)
private String craftContent; private String craftContent;
@TableField(exist = false)
private Integer projectSubAmount;
public boolean canSave(){ public boolean canSave(){
return TaskDispatchStatusEnum.SAVE.getCode() == this.dispatchStatus.intValue(); return TaskDispatchStatusEnum.SAVE.getCode() == this.dispatchStatus.intValue();
} }

View File

@ -65,7 +65,13 @@ public interface TaskDispatchDetailMapper extends BaseMapperX<TaskDispatchDetail
return selectPage(reqVO, query); return selectPage(reqVO, query);
} }
default boolean judgeHasOver(Long id){
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.eq(TaskDispatchDetailDO::getDispatchId,id)
.eq(TaskDispatchDetailDO::getStatus,2);
Long aLong = selectCount(query);
return aLong.compareTo(Long.valueOf(0))>0;
}
default TaskDispatchDetailDO selectGet(TaskDispatchDetailPageReqVO reqVO) { default TaskDispatchDetailDO selectGet(TaskDispatchDetailPageReqVO reqVO) {
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>(); MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDetailDO.class) query.selectAll(TaskDispatchDetailDO.class)
@ -138,7 +144,47 @@ public interface TaskDispatchDetailMapper extends BaseMapperX<TaskDispatchDetail
return selectPage(reqVO, query); return selectPage(reqVO, query);
} }
default PageResult<TaskDispatchDetailDO> selectPageWx(TaskDispatchDetailPageReqVO reqVO , Set<String> postIds) {
// 假设reqVO中包含了页码(page)和每页数量(limit)
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDetailDO.class)
.select("a.code as dispatchCode")
.select("b.code as projectCode", "b.project_name as projectName", "c.name as projectSubName")
.select("d.material_name as materialName")
.select("e.name as procedureName")
.selectSum(TaskReportDO::getAmount, "totalReportAmount")
.selectSum(TaskReportDO::getWorkTime, "totalWorkTime")
.leftJoin(TaskDispatchDO.class, "a", TaskDispatchDO::getId, TaskDispatchDetailDO::getDispatchId)
.leftJoin(ProjectOrderDO.class, "b", ProjectOrderDO::getId, TaskDispatchDO::getProjectId)
.leftJoin(ProjectOrderSubDO.class, "c", ProjectOrderSubDO::getId, TaskDispatchDO::getProjectSubId)
.leftJoin(ProcessBomDetailDO.class, "d", ProcessBomDetailDO::getId, TaskDispatchDO::getBomDetailId)
.leftJoin(ProcedureDO.class, "e", ProcedureDO::getId, TaskDispatchDetailDO::getProcedureId)
.leftJoin(TaskReportDO.class, "f", TaskReportDO::getDispatchDetailId, TaskDispatchDetailDO::getId)
.ne(ProjectOrderDO::getStatus,6)
.groupBy(TaskDispatchDetailDO::getId)
.orderByAsc(TaskDispatchDetailDO::getId)
.disableSubLogicDel();
if (CollUtil.isNotEmpty(postIds)) {
query.and(i -> i
.and(j -> j.in(TaskDispatchDetailDO::getPostId, postIds))
.and(j -> j.isNull(TaskDispatchDetailDO::getOwner))
.or(k-> k.eq(reqVO.getOwner() != null, TaskDispatchDetailDO::getOwner, reqVO.getOwner()))
);
}else{
query.eq(reqVO.getOwner() != null, TaskDispatchDetailDO::getOwner, reqVO.getOwner());
}
query
.in(CollUtil.isNotEmpty(reqVO.getProcedureStatusList()), TaskDispatchDetailDO::getProcedureStatus, reqVO.getProcedureStatusList())
.eq(reqVO.getIsReport() != null, ProcedureDO::getIsReport, reqVO.getIsReport())
.eq(!StringUtils.isEmpty(reqVO.getDispatchType()), TaskDispatchDO::getDispatchType, reqVO.getDispatchType())
.eq(reqVO.getTaskId() != null, TaskDispatchDO::getTaskId, reqVO.getTaskId())
.eq(reqVO.getBomDetailId() != null, TaskDispatchDO::getBomDetailId, reqVO.getBomDetailId())
;
return selectPage(reqVO, query);
}
default List<TaskDispatchDetailDO> selectListByDispatchId(Long dispatchId) { default List<TaskDispatchDetailDO> selectListByDispatchId(Long dispatchId) {
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>(); MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDetailDO.class) query.selectAll(TaskDispatchDetailDO.class)

View File

@ -87,4 +87,5 @@ public interface TaskDispatchService {
void convertAssembleProcedure(TaskDispatchDO taskDispatchDO); void convertAssembleProcedure(TaskDispatchDO taskDispatchDO);
List<HashMap<String,String>> getOwner(Long id,Long type); List<HashMap<String,String>> getOwner(Long id,Long type);
boolean judgeHasOver(Long id);
} }

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.chanko.yunxi.mes.framework.common.exception.ErrorCode;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
@ -140,6 +141,10 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
} }
}); });
}else if (operateTypeEnum == OperateTypeEnum.CANCEL_SUBMIT){ }else if (operateTypeEnum == OperateTypeEnum.CANCEL_SUBMIT){
PlanDO planDO = planMapper.selectById(updateReqVO.getPlanId());
if (planDO.getStatus() == 3){
throw exception(new ErrorCode(1_000_099,"计划已完成,不允许取消提交"));
}
updateReqVO.getTaskDispatchDetails().forEach(taskDispatchDetailDO -> { updateReqVO.getTaskDispatchDetails().forEach(taskDispatchDetailDO -> {
taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.DEFAULT.getCode()); taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.DEFAULT.getCode());
}); });
@ -198,6 +203,7 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
public TaskDispatchDO getTaskDispatch(Long id) { public TaskDispatchDO getTaskDispatch(Long id) {
TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(id); TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(id);
Integer num = projectOrderSubMapper.selectById(taskDispatchDO.getProjectSubId()).getAmount(); Integer num = projectOrderSubMapper.selectById(taskDispatchDO.getProjectSubId()).getAmount();
taskDispatchDO.setProjectSubAmount(num);
taskDispatchDO.setAmount(num*taskDispatchDO.getAmount()); taskDispatchDO.setAmount(num*taskDispatchDO.getAmount());
convertAssembleProcedure(taskDispatchDO); convertAssembleProcedure(taskDispatchDO);
return taskDispatchDO; return taskDispatchDO;
@ -335,7 +341,7 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
for (FpUserDetailDO fpUserDetailDO : fpUserDetailDOS) { for (FpUserDetailDO fpUserDetailDO : fpUserDetailDOS) {
postIds.add(fpUserDetailDO.getPostId()); postIds.add(fpUserDetailDO.getPostId());
} }
PageResult<TaskDispatchDetailDO> taskDispatchDetailDOPageResult = taskDispatchDetailMapper.selectPage(pageReqVO, postIds); PageResult<TaskDispatchDetailDO> taskDispatchDetailDOPageResult = taskDispatchDetailMapper.selectPageWx(pageReqVO, postIds);
List<TaskDispatchDetailDO> list = taskDispatchDetailDOPageResult.getList(); List<TaskDispatchDetailDO> list = taskDispatchDetailDOPageResult.getList();
List<TaskDispatchDetailDO> afterList = new ArrayList<>(); List<TaskDispatchDetailDO> afterList = new ArrayList<>();
if (CollUtil.isNotEmpty(list)){ if (CollUtil.isNotEmpty(list)){
@ -357,13 +363,15 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
.eq(TaskDispatchDetailDO::getDispatchId, taskDispatchDetailDO.getDispatchId()) .eq(TaskDispatchDetailDO::getDispatchId, taskDispatchDetailDO.getDispatchId())
.eq(TaskDispatchDetailDO::getProcedureStatus, 2) .eq(TaskDispatchDetailDO::getProcedureStatus, 2)
); );
if (taskDispatchDetailDO1 == null){ if (taskDispatchDetailDO1 == null){
taskDispatchDetailDO.setBeforeProcedureStatus(1); //查不出来上一道工序已完工就代表它没完成
}else{
taskDispatchDetailDO.setBeforeProcedureStatus(0); taskDispatchDetailDO.setBeforeProcedureStatus(0);
}else{
taskDispatchDetailDO.setBeforeProcedureStatus(1);
} }
}else{ }else{
taskDispatchDetailDO.setBeforeProcedureStatus(0); taskDispatchDetailDO.setBeforeProcedureStatus(1);
} }
return taskDispatchDetailDO; return taskDispatchDetailDO;
} }
@ -424,7 +432,8 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
} }
} }
} }
TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(taskDispatchDetailDO.getDispatchId());
PlanDO planDO = planMapper.selectById(taskDispatchDO.getPlanId());
// 执行 // 执行
switch (operate){ switch (operate){
case START: case START:
@ -437,6 +446,11 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
}else{ }else{
lastReportDO.setOwner(taskDispatchDetailDO.getOwner()); lastReportDO.setOwner(taskDispatchDetailDO.getOwner());
} }
//更新生产计划单
if (planDO.getStatus() != 2 && planDO.getStatus()!=3){
planDO.setStatus(2);
planMapper.updateById(planDO);
}
taskReportMapper.insert(lastReportDO); taskReportMapper.insert(lastReportDO);
break; break;
case END: case END:
@ -455,7 +469,7 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
break; break;
case FINISH: case FINISH:
taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.COMPLETED.getCode()); taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.COMPLETED.getCode());
TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(taskDispatchDetailDO.getDispatchId()); // TaskDispatchDO taskDispatchDO = taskDispatchMapper.selectById(taskDispatchDetailDO.getDispatchId());
List<TaskDispatchDO> taskDispatchDOS = taskDispatchMapper.selectList(TaskDispatchDO::getPlanId, taskDispatchDO.getPlanId()); List<TaskDispatchDO> taskDispatchDOS = taskDispatchMapper.selectList(TaskDispatchDO::getPlanId, taskDispatchDO.getPlanId());
if(CollUtil.isNotEmpty(taskDispatchDOS)){ if(CollUtil.isNotEmpty(taskDispatchDOS)){
List<Long> ids = taskDispatchDOS.stream() List<Long> ids = taskDispatchDOS.stream()
@ -473,9 +487,8 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
} }
} }
if (isOver){ if (isOver){
PlanDO planDO = planMapper.selectById(taskDispatchDO.getTaskId());
planDO.setStatus(3); planDO.setStatus(3);
planMapper.updateBatch(planDO); planMapper.updateById(planDO);
if(taskDispatchDO.getDispatchType().equals("ASSEMBLE")){ if(taskDispatchDO.getDispatchType().equals("ASSEMBLE")){
zjPgMasterService.insertZjList(planDO.getId(),planDO.getProjectId()); zjPgMasterService.insertZjList(planDO.getId(),planDO.getProjectId());
} else if (taskDispatchDO.getDispatchType().equals("PRODUCTION")) { } else if (taskDispatchDO.getDispatchType().equals("PRODUCTION")) {
@ -531,7 +544,10 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
} }
return PageResult.empty(); return PageResult.empty();
} }
@Override
public boolean judgeHasOver(Long id){
return taskDispatchDetailMapper.judgeHasOver(id);
}
private void createTaskDispatchDetailList(Long dispatchId, List<TaskDispatchDetailDO> list) { private void createTaskDispatchDetailList(Long dispatchId, List<TaskDispatchDetailDO> list) {
list.forEach(o -> o.setDispatchId(dispatchId)); list.forEach(o -> o.setDispatchId(dispatchId));
// 分组更新与插入 // 分组更新与插入

View File

@ -32,7 +32,8 @@ public class FileRespVO {
@Schema(description = "文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/mes.jpg") @Schema(description = "文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/mes.jpg")
private String url; private String url;
@Schema(description = "文件预览URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/mes.jpg")
private String previewUrl;
@Schema(description = "文件MIME类型", example = "application/octet-stream") @Schema(description = "文件MIME类型", example = "application/octet-stream")
private String type; private String type;

View File

@ -55,4 +55,6 @@ public class FileConfigDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private FileClientConfig config; private FileClientConfig config;
private String operationSystem;
} }

View File

@ -63,5 +63,8 @@ public class FileDO extends BaseDO {
* 文件大小 * 文件大小
*/ */
private Integer size; private Integer size;
/**
* 预览地址
*/
private String previewUrl;
} }

View File

@ -1,5 +1,6 @@
package com.chanko.yunxi.mes.module.infra.dal.mysql.file; package com.chanko.yunxi.mes.module.infra.dal.mysql.file;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
@ -19,7 +20,14 @@ public interface FileConfigMapper extends BaseMapperX<FileConfigDO> {
} }
default FileConfigDO selectByMaster() { default FileConfigDO selectByMaster() {
return selectOne(FileConfigDO::getMaster, true); String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
return selectOne(new LambdaQueryWrapper<FileConfigDO>().eq(FileConfigDO::getMaster, true)
.eq(FileConfigDO::getOperationSystem, "WIN"));
}else {
return selectOne(new LambdaQueryWrapper<FileConfigDO>().eq(FileConfigDO::getMaster, true)
.eq(FileConfigDO::getOperationSystem, "LINUX"));
}
} }
} }

View File

@ -65,6 +65,7 @@ public class FileServiceImpl implements FileService {
file.setName(name); file.setName(name);
file.setPath(path); file.setPath(path);
file.setUrl(url); file.setUrl(url);
file.setPreviewUrl(url.replace("/admin-api/infra/file/5/get/","/fileview/"));
file.setType(type); file.setType(type);
file.setSize(content.length); file.setSize(content.length);
fileMapper.insert(file); fileMapper.insert(file);

View File

@ -71,4 +71,9 @@ export const getTaskDispatchDetailListByWorkTime = async (params) => {
} }
export const getOwnerList = async(id:number,type:number)=>{ export const getOwnerList = async(id:number,type:number)=>{
return await request.get({url:`/heli/task-dispatch/task-dispatch-detail/getOwner?id=`+id+`&type=`+type}) return await request.get({url:`/heli/task-dispatch/task-dispatch-detail/getOwner?id=`+id+`&type=`+type})
} }
export const judgeHasOver = async(id:number)=>{
return await request.get({url:`/heli/task-dispatch/task-dispatch-detail/judgeHasOver?id=`+id})
}

View File

@ -181,7 +181,7 @@ v-for="dict in getIntDictOptions(DICT_TYPE.HELI_DISPATCH_STATUS)" :key="dict.val
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="数量" prop="amount"> <el-form-item label="数量" prop="amount">
<el-input class="!w-260px" v-model="formData.amount" :disabled="true" /> <el-input class="!w-260px" v-model="formData.projectSubAmount" :disabled="true" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -447,6 +447,20 @@ v-if="formData.dispatchStatus == 2" @click="printHandle(formData.id)" :disabled=
<el-table-column property="maxLongTime" label="每日最大运行时长" width="200" /> <el-table-column property="maxLongTime" label="每日最大运行时长" width="200" />
</el-table> </el-table>
</el-dialog> </el-dialog>
<!-------------取消提交弹框---------------->
<el-dialog v-model="centerDialogVisible" title="Warning" width="30%" center>
<span>
该派工单存在报工完数据是否继续
</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="centerDialogVisible = false">取消</el-button>
<el-button type="primary" @click="sureToCancle()">
确认
</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</el-card> </el-card>
@ -532,6 +546,7 @@ const formData = ref({
id: undefined, id: undefined,
code: undefined, code: undefined,
amount: undefined, amount: undefined,
projectSubAmount:undefined,
dispatchType: undefined, dispatchType: undefined,
taskId: undefined, taskId: undefined,
planId: undefined, planId: undefined,
@ -763,6 +778,7 @@ const resetForm = () => {
id: undefined, id: undefined,
code: undefined, code: undefined,
amount: undefined, amount: undefined,
projectSubAmount:undefined,
dispatchType: undefined, dispatchType: undefined,
taskId: undefined, taskId: undefined,
planId: undefined, planId: undefined,
@ -839,7 +855,12 @@ const queryData = async (id?: number) => {
} }
} }
} }
const centerDialogVisible = ref(false);
const isSureCancle = ref(false)
const sureToCancle = () =>{
isSureCancle.value = true;
submitForm('CANCEL_SUBMIT');
}
const submitForm = async (operate) => { const submitForm = async (operate) => {
formData.value.active = operate formData.value.active = operate
// //
@ -847,6 +868,17 @@ const submitForm = async (operate) => {
// //
formLoading.value = true formLoading.value = true
try { try {
if(operate == 'CANCEL_SUBMIT'){
//
if(!isSureCancle.value){
////
var hasOver = await TaskDispatchApi.judgeHasOver(formData.value.id);
if(hasOver){
centerDialogVisible.value = true;
return;
}
}
}
// //
if (operate == 'SUBMIT') { if (operate == 'SUBMIT') {
if (!formData.value.taskDispatchDetails || formData.value.taskDispatchDetails.length == 0) { if (!formData.value.taskDispatchDetails || formData.value.taskDispatchDetails.length == 0) {
@ -924,7 +956,7 @@ const onAddItem = () => {
procedureStatus: 0, procedureStatus: 0,
dispatchId: undefined, dispatchId: undefined,
} }
row.amount = formData.value.amount row.amount = formData.value.projectSubAmount
row.dispatchId = formData.value.id row.dispatchId = formData.value.id
formData.value.taskDispatchDetails.push(row) formData.value.taskDispatchDetails.push(row)
} }

View File

@ -451,6 +451,21 @@ v-if="formData.dispatchStatus == 2" @click="printHandle(formData.id)" :disabled=
<el-table-column property="maxLongTime" label="每日最大运行时长" width="200" /> <el-table-column property="maxLongTime" label="每日最大运行时长" width="200" />
</el-table> </el-table>
</el-dialog> </el-dialog>
<!-------------取消提交弹框---------------->
<el-dialog v-model="centerDialogVisible" title="Warning" width="30%" center>
<span>
该派工单存在报工完数据是否继续
</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="centerDialogVisible = false">取消</el-button>
<el-button type="primary" @click="sureToCancle()">
确认
</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</el-card> </el-card>
@ -501,7 +516,7 @@ import {
ElButton ElButton
} from 'element-plus'; } from 'element-plus';
import { error } from 'console'; import { error } from 'console';
const centerDialogVisible = ref(false);
const queryParams = { const queryParams = {
pageNo: 1, pageNo: 1,
pageSize: 99, pageSize: 99,
@ -1012,7 +1027,11 @@ const queryData = async (id?: number) => {
} }
} }
} }
const isSureCancle = ref(false)
const sureToCancle = () =>{
isSureCancle.value = true;
submitForm('CANCEL_SUBMIT');
}
const submitForm = async (operate) => { const submitForm = async (operate) => {
formData.value.active = operate formData.value.active = operate
// //
@ -1027,6 +1046,17 @@ const submitForm = async (operate) => {
// return // return
// } // }
// } // }
if(operate == 'CANCEL_SUBMIT'){
//
if(!isSureCancle.value){
////
var hasOver = await TaskDispatchApi.judgeHasOver(formData.value.id);
if(hasOver){
centerDialogVisible.value = true;
return;
}
}
}
if(operate == 'SUBMIT'||operate == 'SAVE'){ if(operate == 'SUBMIT'||operate == 'SAVE'){
if (!formData.value.taskDispatchDetails || formData.value.taskDispatchDetails.length == 0) { if (!formData.value.taskDispatchDetails || formData.value.taskDispatchDetails.length == 0) {
message.error('派工明细不能为空') message.error('派工明细不能为空')

View File

@ -48,6 +48,12 @@
"navigationBarTitleText": "品质异常通知单图片" "navigationBarTitleText": "品质异常通知单图片"
} }
}, },
{
"path": "pages/approveOrder/components/showFileWx",
"style": {
"navigationBarTitleText": "合同文件预览"
}
},
{ {
"path": "pages/productionReport/productionReport-detail", "path": "pages/productionReport/productionReport-detail",
"style": { "style": {

View File

@ -11,6 +11,7 @@ import {
getFileAPI, getFileAPI,
getLogAPI, getLogAPI,
} from '@/services/approveOrder' } from '@/services/approveOrder'
import {Base64} from '@/utils/base64.js';
const popup = ref<UniHelper.UniPopupInstance>() const popup = ref<UniHelper.UniPopupInstance>()
@ -196,17 +197,46 @@ const openReport = (url: any) => {
}, },
}) })
} }
// //
const showFile = ref(false) const showFile = ref(false)
const fileUrl = ref('') const fileUrl = ref('')
const handleDownload = (pdfUrl: any) => { const handleDownload = (pdfUrl: any) => {
//#ifndef MP-WEIXIN //#ifndef MP-WEIXIN
fileUrl.value = 'https://star.hz-hl.com/FileServer/onlinePreview?url='+encodeURIComponent(btoa(unescape(encodeURIComponent(pdfUrl)))) fileUrl.value = 'https://star.hz-hl.com/FileServer/onlinePreview?url='+encodeURIComponent(Base64.encode(pdfUrl))
// #endif window.open(fileUrl.value);
//#ifdef MP-WEIXIN
fileUrl.value = 'https://star.hz-hl.com/FileServer/onlinePreview?url='+encodeURIComponent(wx.arrayBufferToBase64(wx.base64ToArrayBuffer(encodeURIComponent(pdfUrl))))
// #endif // #endif
showFile.value = true; //#ifdef MP-WEIXIN
uni.showLoading({
title: '正在加载中..'
})
uni.downloadFile({
url: pdfUrl,
success: function(res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
console.log('打开文档成功');
uni.hideLoading()
},
});
},
complete: function(r) {
uni.hideLoading()
}
});
// fileUrl.value = 'https://star.hz-hl.com/FileServer/onlinePreview?url='+encodeURIComponent(Base64.encode(pdfUrl));
// uni.navigateTo({
// url: './components/showFileWx?fileUrl=' + encodeURIComponent(fileUrl.value)
// });
// #endif
// showFile.value = true;
// if (pdfUrl) { // if (pdfUrl) {
// switch (uni.getSystemInfoSync().platform) { // switch (uni.getSystemInfoSync().platform) {
// case 'android': // case 'android':
@ -302,7 +332,7 @@ const handleDownload = (pdfUrl: any) => {
<uni-td>{{ item.businessFileType }}</uni-td> <uni-td>{{ item.businessFileType }}</uni-td>
<uni-td>{{ item.createTime }}</uni-td> <uni-td>{{ item.createTime }}</uni-td>
<uni-td> <uni-td>
<view class="button" @click="handleDownload(item.url)" size="mini" type="primary">查看</view> <view class="button" @click="handleDownload(item.previewUrl)" size="mini" type="primary">查看</view>
</uni-td> </uni-td>
</uni-tr> </uni-tr>
</uni-table> </uni-table>
@ -341,7 +371,7 @@ const handleDownload = (pdfUrl: any) => {
<uni-popup-dialog v-if="isShowPop" ref="inputClose" mode="input" title="打回订单" placeholder="请输入打回原因" <uni-popup-dialog v-if="isShowPop" ref="inputClose" mode="input" title="打回订单" placeholder="请输入打回原因"
@confirm="dialogInputConfirm"></uni-popup-dialog> @confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup> </uni-popup>
<web-view v-if="showFile" :src="fileUrl"></web-view> <!-- <web-view v-if="showFile" :src="fileUrl"></web-view> -->
</view> </view>
</template> </template>

View File

@ -0,0 +1,30 @@
<template>
<view>
<web-view :src="showUrl"></web-view>
</view>
</template>
<script>
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref
} from 'vue';
const fileUrl = ref("");
const showUrl = ref("");
onLoad((options) => {
fileUrl.value = options.fileUrl;
if (fileUrl.value) {
try {
showUrl.value = decodeURIComponent(fileUrl.value);
} catch (error) {
console.error('Error parsing picture data:', error);
}
}
})
</script>
<style>
</style>

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, computed, ref } from 'vue' import { onMounted, computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { getListAPI, getDictAPI,getListWxAPI } from '@/services/productionReport' import { getListAPI, getDictAPI,getListWxAPI,getTaskDetailAPI } from '@/services/productionReport'
import { useLoginStore } from '@/stores/modules/login' import { useLoginStore } from '@/stores/modules/login'
import { formatDate } from '@/utils/index' import { formatDate } from '@/utils/index'
@ -17,6 +17,18 @@ const props = defineProps<{
orderState: string orderState: string
}>() }>()
const isOverBeforeProcedure = async(id:number) =>{
const params = {
id,
}
const data = await getTaskDetailAPI(params)
if(data.beforeProcedureStatus == 0){
//
return true;
}else{
return false;
}
}
const statusText = computed(() => { const statusText = computed(() => {
const text = props.orderState == '0,1' ? '处理' : '查看' const text = props.orderState == '0,1' ? '处理' : '查看'
return text return text
@ -73,7 +85,16 @@ onShow(async () => {
await getListData() await getListData()
}) })
const handleDetail = (item) => { const handleDetail = async(item) => {
var isoverBefore= await isOverBeforeProcedure(item.id);
if(isoverBefore == true){
uni.showToast({
title: '上一道工序尚未完成报工!',
icon: 'none',
duration: 2000,
})
return
}
const url = `/pages/assembleReport/assembleReport-detail?id=${item.id}` const url = `/pages/assembleReport/assembleReport-detail?id=${item.id}`
uni.navigateTo({ url }) uni.navigateTo({ url })
} }

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, computed, ref } from 'vue' import { onMounted, computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { getListAPI, getDictAPI,getListWxAPI } from '@/services/productionReport' import { getListAPI, getDictAPI,getListWxAPI,getTaskDetailAPI } from '@/services/productionReport'
import { useLoginStore } from '@/stores/modules/login' import { useLoginStore } from '@/stores/modules/login'
import { formatDate } from '@/utils/index' import { formatDate } from '@/utils/index'
@ -16,7 +16,18 @@ const isTriggered = ref(false)
const props = defineProps<{ const props = defineProps<{
orderState: string orderState: string
}>() }>()
const isOverBeforeProcedure = async(id:number) =>{
const params = {
id,
}
const data = await getTaskDetailAPI(params)
if(data.beforeProcedureStatus == 0){
//
return true;
}else{
return false;
}
}
const statusText = computed(() => { const statusText = computed(() => {
const text = props.orderState == '0,1' ? '处理' : '查看' const text = props.orderState == '0,1' ? '处理' : '查看'
return text return text
@ -73,7 +84,16 @@ onShow(async () => {
await getListData() await getListData()
}) })
const handleDetail = (item) => { const handleDetail = async(item) => {
var isoverBefore= await isOverBeforeProcedure(item.id);
if(isoverBefore == true){
uni.showToast({
title: '上一道工序尚未完成报工!',
icon: 'none',
duration: 2000,
})
return
}
const url = `/pages/productionReport/productionReport-detail?id=${item.id}` const url = `/pages/productionReport/productionReport-detail?id=${item.id}`
uni.navigateTo({ url }) uni.navigateTo({ url })
} }

View File

@ -165,12 +165,12 @@
type: { type: {
rules: [{ required: true, errorMessage: '请选择质检类型' }], rules: [{ required: true, errorMessage: '请选择质检类型' }],
}, },
// projectId: { projectId: {
// rules: [{ required: true, errorMessage: '' }], rules: [{ required: true, errorMessage: '请选择项目名称' }],
// }, },
// projectSubId: { projectSubId: {
// rules: [{ required: true, errorMessage: '' }], rules: [{ required: true, errorMessage: '请选择子项目名称' }],
// }, },
} }
// //
const handleChangeType = (val) => { const handleChangeType = (val) => {
@ -206,8 +206,9 @@
} }
// //
const handleSubmit = async () => { const handleSubmit = async () => {
if(imageDataType1.value&&imageDataType1.value.length>0){ if(!(imageDataType1.value != null &&imageDataType1.value.length>0)){
uni.showToast({ icon: 'none', title: '请上传图片~' }) uni.showToast({ icon: 'none', title: '请上传图片~' })
return
} }
await formRef.value?.validate?.() await formRef.value?.validate?.()
// Blob URLs Blobs FormData // Blob URLs Blobs FormData
@ -321,11 +322,11 @@
<uni-data-select v-model="valiFormData.type" require :localdata="typeDictData" <uni-data-select v-model="valiFormData.type" require :localdata="typeDictData"
@change="handleChangeType"></uni-data-select> @change="handleChangeType"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="项目名称" name="projectId"> <uni-forms-item label="项目名称" required name="projectId">
<uni-data-select v-model="valiFormData.projectId" :localdata="projectData" <uni-data-select v-model="valiFormData.projectId" :localdata="projectData"
@change="handleChangeProject"></uni-data-select> @change="handleChangeProject"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="子项目名称" name="projectSubId"> <uni-forms-item label="子项目名称" required name="projectSubId">
<uni-data-select v-model="valiFormData.projectSubId" :localdata="projectChildData" <uni-data-select v-model="valiFormData.projectSubId" :localdata="projectChildData"
@change="handleChangeProjectChild"></uni-data-select> @change="handleChangeProjectChild"></uni-data-select>
</uni-forms-item> </uni-forms-item>

View File

@ -0,0 +1,169 @@
export let Base64 = {
// 转码表
tables : [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O' ,'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
],
UTF16ToUTF8 : function (str) {
let results = [], len = str.length;
for (let i = 0; i < len; i++) {
let code = str.charCodeAt(i);
if (code > 0x0000 && code <= 0x007F) {
/* 0x0000
U+00000000 U+0000007F 0xxxxxxx
*/
results.push(str.charAt(i));
} else if (code >= 0x0080 && code <= 0x07FF) {
/*
U+00000080 U+000007FF 110xxxxx 10xxxxxx
110xxxxx
*/
let byte1 = 0xC0 | ((code >> 6) & 0x1F);
// 10xxxxxx
let byte2 = 0x80 | (code & 0x3F);
results.push(
String.fromCharCode(byte1),
String.fromCharCode(byte2)
);
} else if (code >= 0x0800 && code <= 0xFFFF) {
/*
U+00000800 U+0000FFFF 1110xxxx 10xxxxxx 10xxxxxx
1110xxxx
*/
let byte1 = 0xE0 | ((code >> 12) & 0x0F);
// 10xxxxxx
let byte2 = 0x80 | ((code >> 6) & 0x3F);
// 10xxxxxx
let byte3 = 0x80 | (code & 0x3F);
results.push(
String.fromCharCode(byte1),
String.fromCharCode(byte2),
String.fromCharCode(byte3)
);
} else if (code >= 0x00010000 && code <= 0x001FFFFF) {
// 四字节
// U+00010000 U+001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
} else if (code >= 0x00200000 && code <= 0x03FFFFFF) {
// 五字节
// U+00200000 U+03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
} else /** if (code >= 0x04000000 && code <= 0x7FFFFFFF)*/ {
// 六字节
// U+04000000 U+7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
}
}
return results.join('');
},
UTF8ToUTF16 : function (str) {
let results = [], len = str.length;
let i = 0;
for (let i = 0; i < len; i++) {
let code = str.charCodeAt(i);
// 第一字节判断
if (((code >> 7) & 0xFF) == 0x0) {
// 一字节
// 0xxxxxxx
results.push(str.charAt(i));
} else if (((code >> 5) & 0xFF) == 0x6) {
// 二字节
// 110xxxxx 10xxxxxx
let code2 = str.charCodeAt(++i);
let byte1 = (code & 0x1F) << 6;
let byte2 = code2 & 0x3F;
let utf16 = byte1 | byte2;
results.push(Sting.fromCharCode(utf16));
} else if (((code >> 4) & 0xFF) == 0xE) {
// 三字节
// 1110xxxx 10xxxxxx 10xxxxxx
let code2 = str.charCodeAt(++i);
let code3 = str.charCodeAt(++i);
let byte1 = (code << 4) | ((code2 >> 2) & 0x0F);
let byte2 = ((code2 & 0x03) << 6) | (code3 & 0x3F);
let utf16 = ((byte1 & 0x00FF) << 8) | byte2
results.push(String.fromCharCode(utf16));
} else if (((code >> 3) & 0xFF) == 0x1E) {
// 四字节
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
} else if (((code >> 2) & 0xFF) == 0x3E) {
// 五字节
// 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
} else /** if (((code >> 1) & 0xFF) == 0x7E)*/ {
// 六字节
// 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
}
}
return results.join('');
},
encode : function (str) {
if (!str) {
return '';
}
let utf8 = this.UTF16ToUTF8(str); // 转成UTF-8
let i = 0; // 遍历索引
let len = utf8.length;
let results = [];
while (i < len) {
let c1 = utf8.charCodeAt(i++) & 0xFF;
results.push(this.tables[c1 >> 2]);
// 补2个=
if (i == len) {
results.push(this.tables[(c1 & 0x3) << 4]);
results.push('==');
break;
}
let c2 = utf8.charCodeAt(i++);
// 补1个=
if (i == len) {
results.push(this.tables[((c1 & 0x3) << 4) | ((c2 >> 4) & 0x0F)]);
results.push(this.tables[(c2 & 0x0F) << 2]);
results.push('=');
break;
}
let c3 = utf8.charCodeAt(i++);
results.push(this.tables[((c1 & 0x3) << 4) | ((c2 >> 4) & 0x0F)]);
results.push(this.tables[((c2 & 0x0F) << 2) | ((c3 & 0xC0) >> 6)]);
results.push(this.tables[c3 & 0x3F]);
}
return results.join('');
},
decode : function (str) {
//判断是否为空
if (!str) {
return '';
}
let len = str.length;
let i = 0;
let results = [];
//循环解出字符数组
while (i < len) {
let code1 = this.tables.indexOf(str.charAt(i++));
let code2 = this.tables.indexOf(str.charAt(i++));
let code3 = this.tables.indexOf(str.charAt(i++));
let code4 = this.tables.indexOf(str.charAt(i++));
let c1 = (code1 << 2) | (code2 >> 4);
results.push(String.fromCharCode(c1));
if (code3 != -1) {
let c2 = ((code2 & 0xF) << 4) | (code3 >> 2);
results.push(String.fromCharCode(c2));
}
if (code4 != -1) {
let c3 = ((code3 & 0x3) << 6) | code4;
results.push(String.fromCharCode(c3));
}
}
return this.UTF8ToUTF16(results.join(''));
}
};