李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
/*
 *    Copyright (c) 2018-2025, ztt All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: ztt
 */
 
package com.chinaztt.mes.technology.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaztt.mes.quality.dto.TestStandardDTO;
import com.chinaztt.mes.quality.entity.TestStandard;
import com.chinaztt.mes.technology.dto.DocTestStandardDTO;
import com.chinaztt.mes.technology.dto.DocumentDTO;
import com.chinaztt.mes.technology.dto.DocumentMaterialCostDTO;
import com.chinaztt.mes.technology.dto.JoinDocumentTestStandardDTO;
import com.chinaztt.mes.technology.entity.Document;
import com.chinaztt.mes.technology.entity.DocumentSamplingRule;
import com.chinaztt.mes.technology.entity.DocumentStandardParam;
import com.chinaztt.mes.technology.entity.JoinDocumentBomRouting;
import com.chinaztt.mes.technology.excel.DocumentTestStandardData;
import com.chinaztt.mes.technology.state.document.constant.DocumentStates;
import com.chinaztt.ztt.common.core.util.R;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
/**
 * 工艺文件
 *
 * @author zhangxy
 * @date 2021-05-07 09:45:58
 */
public interface DocumentService extends IService<Document> {
 
 
    /**
     * 查询DTO
     *
     * @param documentId
     * @return
     */
    DocumentDTO getDtoById(Long documentId);
 
    /**
     * 计算材料用量
     *
     * @param documentId
     * @return
     */
    R<Map<Long, Collection<DocumentMaterialCostDTO>>> calcMaterialCost(Long documentId);
 
 
    /**
     * 保存文件与BOM关系
     *
     * @param join
     * @return
     */
    R<Boolean> saveBom(JoinDocumentBomRouting join);
 
    /**
     * 保存检测标准
     *
     * @param joins
     * @return
     */
    R<Boolean> saveTestStandard(List<JoinDocumentTestStandardDTO> joins);
 
    /**
     * 删除检测标准
     *
     * @param join
     * @return
     */
    R<Boolean> deleteTestStandard(JoinDocumentTestStandardDTO join);
 
    /**
     * 删除文件与BOM关系
     *
     * @param join
     * @return
     */
    R deleteBom(JoinDocumentBomRouting join);
 
 
    /**
     * 导出
     *
     * @param documentId
     * @param response
     */
    void exportMaterialCost(Long documentId, HttpServletResponse response);
 
    /**
     * 工艺路线判断是否有子节点
     *
     * @param id
     * @return
     */
    R<Integer> routingChildCheck(Long id);
 
    /**
     * 根据OA流程ID更新工艺文件状态
     *
     * @param workflowId
     * @param state
     */
    void updateStateByOa(String workflowId, DocumentStates state);
 
    /**
     * 上传结构图文件
     *
     * @param file
     * @param documentId
     * @return
     */
    R uploadJgt(List<MultipartFile> file, Long documentId);
 
    /**
     * 上传流程图文件
     *
     * @param file
     * @param documentId
     * @param lctRemark
     * @return
     */
    R uploadLct(MultipartFile file, Long documentId, String lctRemark);
 
 
    /**
     * 删除结构图
     *
     * @param jgtId
     * @return
     */
    R removeJgt(Long jgtId);
 
    /**
     * 删除流程图
     *
     * @param documentId
     * @return
     */
    R removeLct(Long documentId);
 
 
    /**
     * 获取文件
     *
     * @param fileName
     * @param response
     */
    void getFile(String fileName, HttpServletResponse response);
 
    /**
     * 复制工艺文件
     *
     * @param documentList
     * @return
     */
    R copyDocument(List<Document> documentList);
 
    /**
     * 新增工艺文件
     *
     * @param document
     * @return
     */
    R fullSave(Document document);
 
    /**
     * 修改工艺文件
     *
     * @param document
     * @return
     */
    R fullUpdate(Document document);
 
    /**
     * 通过id查询工艺文件(oa页面展示)
     *
     * @param id
     * @return
     */
    DocumentDTO getDocumentById(Long id);
 
    /**
     * 根据ID去更改状态
     *
     * @param id
     * @param state
     * @return
     */
//    R updateStateById(Long id, DocumentStates state);
 
    /**
     * 修改工艺文件状态
     *
     * @param ids
     * @param state
     * @return
     */
    boolean updateStateByIds(List<Long> ids, DocumentStates state);
 
    /**
     * 通过id查询工艺文件绑定的检测规则
     *
     * @param ew
     * @param id
     * @param page
     * @return
     */
    IPage<List<TestStandard>> getTestStand(Page page, QueryWrapper<TestStandardDTO> ew, Long id);
 
    /**
     * 数据同步到ifs
     *
     * @param id
     * @return
     */
    R ifsSync(Long id);
 
    /**
     * 工艺文件-工艺路线-工序-检测标准主从表新增
     *
     * @param docBomId           工艺文件与BOM关系表id
     * @param routingOperationId 工艺工序id
     * @param testStandardId     检测标准id
     * @return
     */
    boolean addDocTestStandard(Long docBomId, Long routingOperationId, Long testStandardId);
 
    /**
     * 工艺文件-工艺路线-工序-检测标准主表删除
     *
     * @param id 记录id
     * @return
     */
    boolean delDocTestStandardById(Long id);
 
    /**
     * 根据工艺文件-工艺路线-查询检测标准
     *
     * @param docBomId           工艺文件与BOM关系表id
     * @param routingOperationId 工艺工序id
     * @return
     */
    R qryDocTestStandard(Long docBomId, Long routingOperationId);
 
    /**
     * 根据工艺文件-工艺路线-工序-检测标准-根据检测参数id删除记录
     *
     * @param id 检测参数id
     * @return
     */
    R delDocTestStandardDetailById(Long id);
 
    /**
     * 根据工艺文件-工艺路线-工序-检测标准-检测参数明细更新
     *
     * @param documentStandardParamList
     * @return
     */
    R updDocTestStandardDetails(List<DocumentStandardParam> documentStandardParamList);
 
    /**
     * 根据工艺文件-工艺路线-工序-检测标准id查询检测参数明细
     *
     * @param standardId 检测标准id
     * @return
     */
    R qryDocTestStandardDetailsByStandardId(Long standardId);
 
    /**
     * 根据ids 删除
     *
     * @param ids
     * @return
     */
    boolean batchDel(List<Long> ids);
 
    /**
     * 更改检测标准绑定为true
     *
     * @param docBomId
     * @return
     */
    Document changeTestStandard(Long docBomId);
 
 
    /**
     * 更新工艺文件更新人和更新时间
     *
     * @param document
     * @return document
     */
    Document doUpdateRealUser(Document document);
 
    Boolean addDocSamplingRule(Long docBomId, Long routingOperationId, Long samplingRuleId, DocumentSamplingRule documentSamplingRule, String applyType);
 
    void export(HttpServletResponse response) throws IOException;
 
    void importExcel(List<DocumentTestStandardData> list);
 
    List<DocumentSamplingRule> qryDocSamplingRule(Long docBomId, Long routingOperationId);
}