change - 派工SOP附件上传

master
yinq 7 months ago
parent f5c68b2c5d
commit bc04ddac1a

@ -66,4 +66,13 @@ public class MesConstants {
public static final String MES_PRODUCT_PLAN_STATUS_STARTED = "2";//已开始 public static final String MES_PRODUCT_PLAN_STATUS_STARTED = "2";//已开始
public static final String MES_PRODUCT_PLAN_STATUS_FINISH = "3";//已完成 public static final String MES_PRODUCT_PLAN_STATUS_FINISH = "3";//已完成
/** 附件类别1-加工图纸 */
public static final String MES_ATTACH_TYPE_DRAWING = "1";
/** 附件类别2-SOP */
public static final String MES_ATTACH_TYPE_SOP = "2";
/** 附件类别9-其他文件 */
public static final String MES_ATTACH_TYPE_OTHER = "9";
} }

@ -107,12 +107,14 @@ public class MesBaseAttachInfoController extends BaseController
} }
/** /**
* MES * MES
* @param file * @param file
* @return AjaxResult * @param processId
* @param attachType
* @return
*/ */
@PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId){ public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId, String attachType){
if (!file.isEmpty()) if (!file.isEmpty())
{ {
R<SysFile> fileResult = null; R<SysFile> fileResult = null;
@ -126,7 +128,7 @@ public class MesBaseAttachInfoController extends BaseController
MesBaseAttachInfo info = new MesBaseAttachInfo(); MesBaseAttachInfo info = new MesBaseAttachInfo();
info.setAttachCode(UUID.fastUUID().toString()); info.setAttachCode(UUID.fastUUID().toString());
info.setAttachName(name); info.setAttachName(name);
info.setAttachType("1"); info.setAttachType(attachType);
// String fixedString = "/statics"; // String fixedString = "/statics";
// url = url.substring(url.indexOf(fixedString) + fixedString.length()); // url = url.substring(url.indexOf(fixedString) + fixedString.length());
info.setAttachPath(url); info.setAttachPath(url);

@ -4,6 +4,7 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.constant.MesConstants;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService; import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -147,7 +148,18 @@ public class MesProductPlanController extends BaseController
@GetMapping(value = "/drawingList/{planId}") @GetMapping(value = "/drawingList/{planId}")
public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId) public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId)
{ {
return success(mesProductPlanService.getDispatchDrawingList(planId)); return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_DRAWING));
}
/**
* SOPList
* @param planId
* @return
*/
@GetMapping(value = "/SOPAttachList/{planId}")
public AjaxResult getDispatchSOPAttachList(@PathVariable("planId") Long planId)
{
return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_SOP));
} }
/** /**

@ -86,12 +86,14 @@ public interface IMesProductPlanService
*/ */
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList); public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList);
/** /**
* List * List
* @param planId * @param planId
* @param attachType
* @return * @return
*/ */
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId); public List<MesBaseAttachInfo> getDispatchAttachList(Long planId, String attachType);
/** /**
* *

@ -180,23 +180,36 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
} }
/** /**
* List * List
*
* @param planId * @param planId
* @param attachType
* @return * @return
*/ */
@Override @Override
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId) { public List<MesBaseAttachInfo> getDispatchAttachList(Long planId, String attachType) {
MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId); MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId);
if (StringUtils.isEmpty(mesProductPlan.getAttachId())) {
return new ArrayList<>();
}
try { try {
Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(",")) if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)){
.map(String::trim) if (StringUtils.isEmpty(mesProductPlan.getAttachId())) {
.map(Long::parseLong) return new ArrayList<>();
.toArray(Long[]::new); }
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds); Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds);
} else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)) {
if (StringUtils.isEmpty(mesProductPlan.getSopId())) {
return new ArrayList<>();
}
Long[] sopIds = Arrays.stream(mesProductPlan.getSopId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(sopIds);
} else {
return new ArrayList<>();
}
} catch (Exception e) { } catch (Exception e) {
return new ArrayList<>(); return new ArrayList<>();
} }

@ -159,6 +159,7 @@
a.real_begin_time, a.real_begin_time,
a.real_end_time, a.real_end_time,
a.attach_id, a.attach_id,
a.sop_id,
a.plan_status, a.plan_status,
a.is_flag, a.is_flag,
a.remark, a.remark,

@ -88,3 +88,11 @@ export function getDispatchDrawingList(planId) {
method: 'get' method: 'get'
}) })
} }
// 获取生产派工SOP附件List列表
export function getDispatchSOPAttachList(planId) {
return request({
url: '/mes/productplan/SOPAttachList/' + planId,
method: 'get'
})
}

@ -448,6 +448,7 @@ import addSaleOrder from '@//views/mes/productOrder/addSaleOrder.vue';
import {getMaterialVisionList} from "@//api/mes/materialBom"; import {getMaterialVisionList} from "@//api/mes/materialBom";
import {findRouteList} from "@//api/mes/baseRoute"; import {findRouteList} from "@//api/mes/baseRoute";
import addBom from '@//views/mes/materialBom/addBom.vue'; import addBom from '@//views/mes/materialBom/addBom.vue';
import router from "@//router";
export default { export default {
name: "ProductOrder", name: "ProductOrder",
@ -600,6 +601,9 @@ export default {
}; };
}, },
created() { created() {
if (this.$route.query.queryParams != null){
this.queryParams = { ...this.$route.query.queryParams }
}
this.getList(); this.getList();
findRouteList().then(response => { findRouteList().then(response => {
this.routeList = response.data; this.routeList = response.data;
@ -816,7 +820,8 @@ export default {
handleDispatch(row) { handleDispatch(row) {
const productOrderId = row.productOrderId || this.ids[0]; const productOrderId = row.productOrderId || this.ids[0];
const orderCode = row.orderCode; const orderCode = row.orderCode;
const params = {pageNum: this.queryParams.pageNum}; const params = {queryParams: this.queryParams};
this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params); this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
}, },

@ -92,7 +92,7 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="50"> <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
icon="el-icon-search" icon="el-icon-search"
@ -101,6 +101,13 @@
@click="handleDrawing(scope.row)" @click="handleDrawing(scope.row)"
>图纸 >图纸
</el-button> </el-button>
<el-button
icon="el-icon-search"
size="mini"
type="success"
@click="handleSOP(scope.row)"
>SOP
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -174,6 +181,68 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog
:visible.sync="sopViewModel"
title="上传SOP附件"
width="30%"
@before-close="sopViewModel = false">
<el-upload
single
ref="drawingUpload"
list-type="picture-card"
action="uploadImgUrl"
:auto-upload="true"
:limit="limit"
:headers="headers"
:before-upload="handleBeforeUpload"
:http-request="httpRequest"
:on-exceed="handleExceed"
:file-list="fileList"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
v-if="isAssetTypeAnImage(file.name)"
:alt="file.name"
:src="file.url" class="el-upload-list__item-thumbnail"
>
<span v-else>{{ file.name }}</span>
<span class="el-upload-list__item-actions">
<span
v-if="isAssetTypeAnImage(file.name)"
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="isShowTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件
</div>
<el-button type="primary" @click="sopFileUploadSubmit"> </el-button>
<el-button @click="sopViewModel = false"> </el-button>
</span>
</el-dialog>
<el-dialog <el-dialog
:visible.sync="pictureDetailModel" :visible.sync="pictureDetailModel"
title="图纸预览" title="图纸预览"
@ -193,7 +262,7 @@
import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder"; import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder";
import { import {
delProductplan, delProductplan,
getDispatchCode, getDispatchDrawingList, getDispatchCode, getDispatchDrawingList, getDispatchSOPAttachList,
getProductPlan, getProductPlan,
orderAddMesProductPlanList, orderAddMesProductPlanList,
updateProductplan, updateProductplan,
@ -231,6 +300,7 @@ export default {
data() { data() {
return { return {
blueprintModel: false, blueprintModel: false,
sopViewModel: false,
pictureDetailModel: false, pictureDetailModel: false,
// //
dialogImageUrl: '', dialogImageUrl: '',
@ -417,7 +487,7 @@ export default {
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), pageNum: this.$route.query.pageNum}}; const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj);
}, },
/** 查看图纸 */ /** 查看图纸 */
@ -439,6 +509,27 @@ export default {
this.addProductPlanObject = row; this.addProductPlanObject = row;
this.blueprintModel = true; this.blueprintModel = true;
}, },
/** 查看SOP附件 */
handleSOP(row) {
this.fileList = [];
this.uploadList = [];
if (row.planId != null) {
getDispatchSOPAttachList(row.planId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadList.push(e.attachId);
})
})
}
this.addProductPlanObject = row;
this.sopViewModel = true;
},
/** 生产计划添加按钮操作 */ /** 生产计划添加按钮操作 */
handleAddMesProductPlan() { handleAddMesProductPlan() {
let dispatchCode = ""; let dispatchCode = "";
@ -449,7 +540,7 @@ export default {
this.$modal.msgError("工艺路线未维护工位信息!"); this.$modal.msgError("工艺路线未维护工位信息!");
} }
let lastProcessId = null; let lastProcessId = null;
res.data.forEach(e => { res.data.forEach((e, index) => {
let obj = {}; let obj = {};
obj.dispatchCode = dispatchCode; obj.dispatchCode = dispatchCode;
obj.processId = e.processId; obj.processId = e.processId;
@ -471,8 +562,10 @@ export default {
obj.materialBomId = this.form.materialBomId; obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId; obj.productOrderId = this.form.productOrderId;
// ID // ID
if (lastProcessId == null || lastProcessId === obj.processId) { if (lastProcessId == null) {
obj.lastProcessId = 0; obj.lastProcessId = 0;
} else if(lastProcessId === obj.processId){
obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId;
} else { } else {
obj.lastProcessId = lastProcessId; obj.lastProcessId = lastProcessId;
} }
@ -519,6 +612,30 @@ export default {
this.addProductPlanObject = null; this.addProductPlanObject = null;
this.blueprintModel = false; this.blueprintModel = false;
}, },
//SOP
sopFileUploadSubmit() {
// false=true=
if (this.addProductPlanObject.oldRowFlag) {
updateProductplan({
planId: this.addProductPlanObject.planId,
sopId: this.uploadList.join(","),
}).then(res => {
this.$modal.msgSuccess("上传SOP附件成功");
}
)
} else {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
this.mesProductPlanList[i].sopId = this.uploadList.join(",");
}
}
}
this.uploadList = [];
this.addProductPlanObject = null;
this.sopViewModel = false;
},
// //
httpRequest(file) { httpRequest(file) {
// //
@ -526,6 +643,7 @@ export default {
const formData = new FormData(); const formData = new FormData();
formData.append("file", fileData); formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId); formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", "1");
uploadFile(formData).then( uploadFile(formData).then(
(res) => { (res) => {
// //

Loading…
Cancel
Save