From 1c683ded6a17523c47d7e1d853736562007d26bc Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期一, 03 六月 2024 09:07:34 +0800
Subject: [PATCH] 完成光纤配置进行检验操作
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java | 3 +
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java | 2
inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 53 +++++++++++++++++
inspect-server/src/main/resources/static/report-template.docx | 0
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java | 6 +-
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 54 ++++++++++++++---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java | 12 ++-
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java | 4 +
inspect-server/src/main/resources/mapper/InsProductMapper.xml | 10 +++
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java | 2
10 files changed, 128 insertions(+), 18 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
index 6623aef..00e43b5 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
@@ -42,7 +42,7 @@
//鑾峰彇妫�楠屼笅鍗曟暟鎹�
@ValueClassify("妫�楠屼笅鍗�")
- @ApiOperation(value = "鏌ヨ妫�楠屼笅鍗曟暟鎹�")
+ @ApiOperation(value = "鏌ヨ妫�楠屽崟鍒楄〃")
@PostMapping("/selectInsOrderParameter")
public Result selectInsOrderParameter(@RequestBody Map<String, Object> data) throws Exception {
Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
@@ -51,7 +51,7 @@
}
@ValueClassify("妫�楠屼笅鍗�")
- @ApiOperation(value = "鏄惁鍏ㄩ儴鏌ヨ")
+ @ApiOperation(value = "鏄惁鏌ョ湅鎵�鏈夋楠屽崟")
@PostMapping("/selectAllInsOrder")
public Result selectAllInsOrder(){
return Result.success();
@@ -154,7 +154,7 @@
insOrderService.updateStatus(id);
return Result.success();
}
- @ValueClassify("妫�楠屼笅鍗�")
+
@PutMapping("/updateInspected")
@ValueAuth
public Result<?> updateInspected(Integer id){
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java
index c482b6a..3728566 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java
@@ -23,6 +23,8 @@
List<ProductResultDto2> getProductAndResult(Integer sampleId);
int updateInspected(@Param("id") Integer id);
+
+ List<InsProduct> selectFiberInsProduct(List<Integer> ids);
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java
index 7bff8d3..62edb36 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java
@@ -26,6 +26,8 @@
List<SampleProductDto> selectSampleProductListByOrderId(Integer id);
+ List<SampleProductDto> selectSampleProductListByOrderId2(Integer id);
+
List<SampleProductDto> getInsOrderAndSample(Integer id, String laboratory);
String getSampleEn(String sample);
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java
index e4c8304..f0e1292 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java
@@ -30,6 +30,8 @@
*/
private String inspectionItem;
+ private String inspectionItemEn;
+
/**
* 妫�楠岄」鍒嗙被
*/
@@ -40,6 +42,8 @@
*/
private String inspectionItemSubclass;
+ private String inspectionItemSubclassEn;
+
/**
* 宸ュ巶
*/
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index e08c4cc..fe95792 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -101,6 +101,9 @@
@Resource
private UserMapper userMapper;
+ @Resource
+ private CustomMapper customMapper;
+
@Value("${file.path}")
private String imgUrl;
@@ -342,9 +345,8 @@
Integer num = (type == 1 ? 5 : 4);
LocalDateTime now = LocalDateTime.now();
insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, now).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell).set(InsOrderState::getVerifyUser, getLook.selectPowerByMethodAndUserId(null).get("userId")));
- List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery().eq(InsOrderState::getInsOrderId, orderId));
- long count = insOrderStates.stream().filter(a -> a.getInsState() == 5).count();
- if (count == insOrderStates.size() && num == 5) {
+ Long count = insOrderStateMapper.selectCount(Wrappers.<InsOrderState>lambdaQuery().eq(InsOrderState::getInsOrderId, orderId).ne(InsOrderState::getInsState, 5));
+ if (count == 0 && num == 5) {
/*鏍峰搧涓嬬殑椤圭洰鍙鏈変竴涓」鐩笉鍚堟牸鍒欐楠岀粨鏋滀负0,鍚﹀垯涓�1*/
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
for (InsSample insSample : insSamples) {
@@ -359,7 +361,7 @@
}
InsOrder insOrder = insOrderMapper.selectById(orderId);
Map<String, String> user = insProductMapper.selectUserById(insOrder.getUserId());
- List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId);
+ List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId2(orderId);
InsReport insReport = new InsReport();
insReport.setCode(insOrder.getEntrustCode());
insReport.setInsOrderId(orderId);
@@ -371,13 +373,16 @@
Set<String> models = new HashSet<>();
AtomicReference<Integer> productSize = new AtomicReference<>(0);
String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
+ AtomicReference<String> resultCh = new AtomicReference<>("");
+ AtomicReference<String> resultEn = new AtomicReference<>("");
samples.forEach(a -> {
+ Long productCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, a.getId()));
+ productSize.set(productSize.get()+Integer.parseInt(productCount+""));
models.add(a.getModel());
standardMethod.add(baseMapper.getStandardMethodCode(a.getStandardMethodListId()));
Set<String> templateSet = new HashSet<>();
getTemplateThing(set, map2, a);
for (InsProduct b : a.getInsProduct()) {
- productSize.set(productSize.get() + 1);
if (b.getInsProductResult() != null) {
List<JSONObject> jsonObjects = JSON.parseArray(b.getInsProductResult().getEquipValue(), JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
@@ -508,6 +513,8 @@
textRenderData.setText("鈭�");
break;
case 0:
+ resultCh.set(resultCh.get() + "銆�" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ?"":" "+p.getInspectionItemSubclass()));
+ resultEn.set(resultEn.get() + "銆�" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "")||Objects.equals(p.getInspectionItemSubclassEn(), null)) ?"":" "+p.getInspectionItemSubclassEn()));
textRenderData.setText("脳");
break;
default:
@@ -544,6 +551,8 @@
textRenderData.setText("鉁�");
break;
case 0:
+ resultCh.set(resultCh.get() + "銆�" + p.getInspectionItem() + (p.getInspectionItemSubclass().equals("")?"":" "+p.getInspectionItemSubclass()));
+ resultEn.set(resultEn.get() + "銆�" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "")||Objects.equals(p.getInspectionItemSubclassEn(), null)) ?"":" "+p.getInspectionItemSubclassEn()));
textRenderData.setText("鉁�");
break;
default:
@@ -577,9 +586,21 @@
}
TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
rowRenderData = Rows.of(text2).rowAtleastHeight(1).center().create();
- rows.add(rowRenderData);
+ if(rowRenderData.getCells().size()!=0){
+ rows.add(rowRenderData);
+ }
TableRenderData tableRenderData = new TableRenderData();
tableRenderData.setRows(rows);
+ int countSize = tableRenderData.getRows().get(0).getCells().size();
+ for (RowRenderData row : tableRenderData.getRows()) {
+ /*for (CellRenderData cell : row.getCells()) {
+ System.out.print(cell.getParagraphs().get(0).getContents());
+ }
+ System.out.println("");*/
+ if(row.getCells().size()!=countSize){
+ throw new ErrorException("姣忚鍗曞厓鏍间笉鐩哥瓑");
+ }
+ }
TableStyle tableStyle = new TableStyle();
tableStyle.setColWidths(new int[]{650, 1600, 2000, 750, 2800, 1100, 1100});
tableStyle.setWidth("10000");
@@ -653,14 +674,20 @@
} catch (Exception e) {
throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
}
- if (signatureUrl == null || "".equals(signatureUrl)) {
- throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
+ Custom custom = customMapper.selectById(user.get("company"));
+ if(!resultCh.get().equals("")){
+ resultCh.set("渚濇嵁濮旀墭瑕佹眰锛�"+resultCh.get().replaceFirst("銆�", "")+"绛夋墍妫�椤圭洰涓嶇鍚堣姹傦紝鍏朵綑鎵�妫�椤圭洰鍧囩鍚堣姹傘��");
+ resultEn.set("According to commissioned requirements,"+resultEn.get().replaceFirst("銆�", "")+" these inspected items do not meet the requirements, all other inspected items meet the requirements.");
+ }else{
+ resultCh.set("渚濇嵁濮旀墭瑕佹眰锛屾墍妫�椤圭洰鍧囩鍚堣姹傘��");
+ resultEn.set("According to commissioned requirements, all the tested items meet the requirements.");
}
XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render(
new HashMap<String, Object>() {{
put("order", insOrder);
put("report", insReport);
put("user", user);
+ put("custom", custom);
put("sampleSize", samples.size());
put("tables", tables);
put("tableSize", tables.size() + 1);
@@ -685,6 +712,8 @@
put("seal2", null);
put("formTypeCh", formType);
put("formTypeEn", insOrder.getFormType());
+ put("resultCh", resultCh.get());
+ put("resultEn", resultEn.get());
}});
try {
String name = insReport.getCode().replace("/", "") + ".docx";
@@ -791,13 +820,16 @@
public int submitPlan(Integer orderId, String laboratory, Integer verifyUser) {
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
- List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult));
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult).isNull(InsProduct::getInsFiberId).isNull(InsProduct::getInsFibersId));
+ insProducts.addAll(insProductMapper.selectFiberInsProduct(ids));
if (insProducts.size() > 0) {
String str = "";
+ int count = 0;
for (InsProduct product : insProducts) {
- str += product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "锛�";
+ count++;
+ str += "<br/>"+count + "锛�" +product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>";
}
- throw new ErrorException("浠ヤ笅鏄湭妫�楠岀殑椤圭洰锛�" + str);
+ throw new ErrorException("<strong>瀛樺湪寰呮楠岀殑椤圭洰锛�</strong><br/>" + str);
}
insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 3).set(InsOrderState::getVerifyUser, verifyUser));
Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
index a3de060..6c98fa7 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
@@ -80,7 +80,11 @@
sampleOrderDto.setCreateUser(map1.get("userId"));
}else {
//缁勭粐
- sampleOrderDto.setCompany(customMapper.selectById(user.getCompany()).getCompany());
+ try {
+ sampleOrderDto.setCompany(customMapper.selectById(user.getCompany()).getCompany());
+ }catch (NullPointerException e){
+ throw new ErrorException("鎵句笉鍒版墍灞炲崟浣�");
+ }
}
}
Map<String, Object> map = new HashMap<>();
@@ -99,7 +103,7 @@
insOrderMapper.updateById(insOrder);
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
- List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getState, 1).select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory));
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getState, 1).isNull(InsProduct::getInsFibersId).isNull(InsProduct::getInsFiberId).select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory));
for (InsProduct insProduct : insProducts) {
InsOrderState insOrderState = new InsOrderState();
insOrderState.setInsOrderId(orderId);
@@ -125,7 +129,7 @@
@Transactional(rollbackFor = Exception.class)
public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder) {
insOrder.setState(0);
- String code = insOrderMapper.getLaboratoryCode(insOrder.getLaboratory());
+ String code = customMapper.selectById(insOrder.getCompanyId()).getCode2();
insOrder.setEntrustCode(giveCode.giveCode("JCZX-" + code + "-", "ins_order", "-", "yyyyMMdd"));
insOrderMapper.insert(insOrder);
list.forEach(a -> {
@@ -140,7 +144,7 @@
}
if (ObjectUtil.isNotEmpty(a.getBushing())) {
for (BushingDto bushingDto : a.getBushing()) {
- bushingDto.setInsSampleId(a.getInsOrderId());
+ bushingDto.setInsSampleId(a.getId());
insBushingMapper.insert(bushingDto);
if(bushingDto.getFiber().size()!=0){
for (FiberDto fiberDto : bushingDto.getFiber()) {
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
index f368487..7f81c56 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -56,6 +56,9 @@
String[] models = insSample.getModel().split("-(?=[^-]*$)");//鎷嗗垎鏈�鍚庝竴涓��-銆�
List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0]));
if (list.size() == 0) {
+ if(Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null){
+ return null;
+ }
String[] split = insSample.getFactory().split(" - ");
list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
.eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId())
diff --git a/inspect-server/src/main/resources/mapper/InsProductMapper.xml b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
index e3b2e1e..792a419 100644
--- a/inspect-server/src/main/resources/mapper/InsProductMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
@@ -87,4 +87,14 @@
where ip.ins_sample_id = #{sampleId}
and ip.ins_result is not null
</select>
+ <select id="selectFiberInsProduct" resultType="com.yuanchu.mom.pojo.InsProduct">
+ select * from ins_product
+ where state = 1
+ and (ins_fibers_id is not null or ins_fiber_id is not null)
+ and ins_result is null
+ and ins_sample_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </select>
</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index d16f7f1..50ed614 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -113,8 +113,10 @@
select isa.*,
ip.id ip_id,
inspection_item,
+ inspection_item_en,
inspection_item_classify,
inspection_item_subclass,
+ inspection_item_subclass_en,
ip.factory ip_factory,
ip.laboratory ip_laboratory,
ip.sample_type ip_sample_type,
@@ -160,8 +162,10 @@
select isa.*,
ip.id ip_id,
inspection_item,
+ inspection_item_en,
inspection_item_classify,
inspection_item_subclass,
+ inspection_item_subclass_en,
ip.factory ip_factory,
ip.laboratory ip_laboratory,
ip.sample_type ip_sample_type,
@@ -211,6 +215,53 @@
select name_en from `center-lims`.product
where name = #{sample}
</select>
+ <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
+ select isa.*,
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_classify,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ip.method_s
+ from ins_sample isa
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_order_id = #{id}
+ and state = 1
+ </select>
<resultMap id="sampleDto" type="com.yuanchu.mom.dto.SampleProductDto">
<id property="id" column="id" jdbcType="INTEGER"/>
@@ -239,8 +290,10 @@
<resultMap id="product" type="com.yuanchu.mom.pojo.InsProduct">
<id property="id" column="ip_id" jdbcType="INTEGER"/>
<result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
+ <result property="inspectionItemEn" column="inspection_item_en" jdbcType="VARCHAR"/>
<result property="inspectionItemClassify" column="inspection_item_classify" jdbcType="VARCHAR"/>
<result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/>
+ <result property="inspectionItemSubclassEn" column="inspection_item_subclass_en" jdbcType="VARCHAR"/>
<result property="factory" column="ip_factory" jdbcType="VARCHAR"/>
<result property="laboratory" column="ip_laboratory" jdbcType="VARCHAR"/>
<result property="sampleType" column="ip_sample_type" jdbcType="VARCHAR"/>
diff --git a/inspect-server/src/main/resources/static/report-template.docx b/inspect-server/src/main/resources/static/report-template.docx
index 307ed5d..4e71a2e 100644
--- a/inspect-server/src/main/resources/static/report-template.docx
+++ b/inspect-server/src/main/resources/static/report-template.docx
Binary files differ
--
Gitblit v1.9.3