From 8bf55e1ac0ac6eb6c97a025f0c03b78e208f668e Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期一, 26 八月 2024 17:26:58 +0800
Subject: [PATCH] 复核确认+插队+认领判断是否在库
---
system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java | 8 --
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrderState.java | 3 +
inspect-server/src/main/resources/mapper/InsOrderMapper.xml | 57 +-----------------
inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 5 +
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java | 2
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 52 ++++++++++++-----
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java | 18 +++---
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java | 13 ++++
inspect-server/src/main/resources/mapper/InsProductMapper.xml | 3
9 files changed, 72 insertions(+), 89 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
index 92bc391..87c04e6 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
@@ -7,8 +7,10 @@
import com.yuanchu.mom.dto.InsOrderPlanDTO;
import com.yuanchu.mom.dto.InsProductDto;
import com.yuanchu.mom.pojo.InsOrderFile;
+import com.yuanchu.mom.pojo.InsOrderState;
import com.yuanchu.mom.service.InsOrderFileService;
import com.yuanchu.mom.service.InsOrderPlanService;
+import com.yuanchu.mom.service.InsOrderStateService;
import com.yuanchu.mom.service.InsProductService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
@@ -36,6 +38,7 @@
private InsOrderFileService insOrderFileService;
private InsProductService insProductService;
+ private InsOrderStateService insOrderStateService;
@ValueClassify("妫�楠屼换鍔�")
@ApiOperation(value = "鑾峰彇妫�楠屼换鍔″垪琛�")
@@ -186,4 +189,14 @@
public Result<?> temCycle(Integer sampleId, String inspectionItem, String inspectionItemSubclass) {
return Result.success(insOrderPlanService.temCycle(sampleId, inspectionItem, inspectionItemSubclass));
}
+
+ @ValueClassify("妫�楠屼换鍔�")
+ @ApiOperation(value = "鎻掗槦鎿嶄綔")
+ @PostMapping("/jumpTeam")
+ public Result<?> jumpTeam(Integer orderStateId,Integer sort) {
+ InsOrderState orderState = new InsOrderState();
+ orderState.setId(orderStateId);
+ orderState.setSort(sort);
+ return Result.success(insOrderStateService.updateById(orderState));
+ }
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
index 5e397e9..a16cae9 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
@@ -105,7 +105,7 @@
private Integer isLeave;
/**
- * 1锛氭楠屽鐞� 0锛氬緟瀹℃牳 2锛氶��鍥� 3锛氭挙閿�
+ * 1锛氭楠屽鐞� 0锛氬緟瀹℃牳 2锛氶��鍥� 3锛氭挙閿�4:宸叉楠�
*/
@ApiModelProperty("鐘舵��")
private Integer state;
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrderState.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrderState.java
index 9e653ce..aca65d1 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrderState.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrderState.java
@@ -67,4 +67,7 @@
@ApiModelProperty("澶嶆牳鐞嗙敱")
private String verifyTell;
+
+ @ApiModelProperty("鎻掗槦鎿嶄綔鐨勬帓搴�")
+ private Integer sort;
}
\ No newline at end of file
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 08174d5..f268a67 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
@@ -86,6 +86,8 @@
private ShiftTimeMapper shiftTimeMapper;
@Resource
private PerformanceShiftMapper performanceShiftMapper;
+ @Resource
+ private WarehouseHistoryMapper warehouseHistoryMapper;
@Value("${wordUrl}")
private String wordUrl;
@@ -193,6 +195,25 @@
public boolean claimInsOrderPlan(InsOrderPlanDTO entity) {
if (Objects.isNull(entity)) {
return false;
+ }
+ /*璁ら闇�瑕佸垽鏂鏍峰搧鏄惁鍦ㄥ簱*/
+ //鏌ヨ鏍峰搧id
+ List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, entity.getInsSampleId())).stream().map(InsSample::getId).collect(Collectors.toList());
+ for (Integer samId : sampleIds) {
+ //鍏ュ簱娆℃暟
+ Long inCount = warehouseHistoryMapper.selectCount(Wrappers.<WarehouseHistory>lambdaQuery()
+ .eq(WarehouseHistory::getState, 1)
+ .eq(WarehouseHistory::getInsSampleId, samId));
+ //鍑哄簱娆℃暟
+ Long outCount = warehouseHistoryMapper.selectCount(Wrappers.<WarehouseHistory>lambdaQuery()
+ .eq(WarehouseHistory::getState, 2)
+ .eq(WarehouseHistory::getInsSampleId, samId));
+ if (inCount > 0 && inCount > outCount) {
+ //鍏ュ簱
+ } else {
+ throw new ErrorException("鎵�閫夌殑鏍峰搧搴撳瓨涓嶈冻,璇锋鏌ュ叆搴撳拰鍑哄簱璁板綍!");
+ }
}
Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
Integer userId = map1.get("userId");
@@ -850,7 +871,10 @@
//杩欓噷鐨刬nsSamples鏄鍗曚笅鐨勬墍鏈夋牱鍝佸寘鎷�("/")
List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
for (InsSample insSample : samples) {
- List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, insSample.getId()).eq(InsProduct::getState, 1));
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSample.getId())
+ .eq(InsProduct::getSonLaboratory, laboratory)
+ .eq(InsProduct::getState, 1));
List<Integer> results = insProducts.stream().map(InsProduct::getInsResult).filter(str -> str != null).collect(Collectors.toList());
if (results.contains(0)) {
insSample.setInsResult(0);
@@ -880,7 +904,7 @@
/*type=0 鍐嶆璇曢獙; type=1 缁х画璇曢獙 ; type=2 缁撴潫璇曢獙*/
switch (type) {
case 0:
- /*鍐嶆璇曢獙:绯荤粺鑷姩鍦ㄦ绔欏彴鍐嶆鍒涘缓涓�娆℃楠屼换鍔★紱*/
+ /*鍐嶆璇曢獙:璇ュ崟瀛愰��鍥炲埌妫�楠岀姸鎬�(鎺掑簭鏀规垚褰撳墠鐨勬渶鍚�)锛�*/
//鏇存柊鍘熸潵鐨勬楠屼换鍔�
// 鏌ヨ鏍规嵁 id 鍊掑簭鎺掑垪鐨勭涓�鏉¤褰�
InsOrderState record = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
@@ -895,14 +919,9 @@
.set(InsOrderState::getInsTime, now)
.set(InsOrderState::getInsState, 4)
.set(InsOrderState::getVerifyTell, tell)
- .set(InsOrderState::getVerifyUser, userId));
+ .set(InsOrderState::getVerifyUser, userId)
+ .set(InsOrderState::getCreateTime, LocalDateTime.now()));
}
- //鏂板缓妫�楠屼换鍔�
- /* InsOrderState orderState = new InsOrderState();
- orderState.setInsOrderId(orderId);
- orderState.setLaboratory(laboratory);
- orderState.setInsState(0);
- insOrderStateMapper.insert(orderState);*/
break;
case 1:
//缁х画璇曢獙:鍒欑户缁皢妫�楠屼换鍔¤浆鎺ヨ嚦涓嬩竴绔欑偣锛�
@@ -921,7 +940,9 @@
.in(InsProduct::getInsSampleId, ids)
.eq(InsProduct::getState, 1));
List<Integer> list = new ArrayList<>();
- list.add(4);list.add(5);list.add(6);
+ list.add(4);
+ list.add(5);
+ list.add(6);
List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery()
.eq(InsOrderState::getInsOrderId, orderId)
.in(InsOrderState::getInsState, list));
@@ -1229,10 +1250,12 @@
cells.add(cellRenderData);
} else {
//绗竷鍒�
- if (a.getInsProduct().get(i - 2).getInsResult() == 0) {
- textRenderData.setText("脳");
+ if (ObjectUtils.isEmpty(a.getInsProduct().get(i - 2).getInsResult())) {
+ textRenderData.setText("-");
} else if (a.getInsProduct().get(i - 2).getInsResult() == 1) {
textRenderData.setText("鈭�");
+ } else if (a.getInsProduct().get(i - 2).getInsResult() == 0) {
+ textRenderData.setText("脳");
} else {
textRenderData.setText("-");
}
@@ -1377,7 +1400,6 @@
if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
}
- //Custom custom = customMapper.selectById(user.get("company"));
Custom custom = customMapper.selectById(insOrder.getCompanyId());
if (!resultCh.get().equals("")) {
resultCh.set("渚濇嵁濮旀墭瑕佹眰锛�" + resultCh.get().replaceFirst("銆�", "") + "绛夋墍妫�椤圭洰涓嶇鍚堣姹傦紝鍏朵綑鎵�妫�椤圭洰鍧囩鍚堣姹傘��");
@@ -1672,10 +1694,10 @@
insSampleUser.setState(1);
insSampleUser.setSonLaboratory(laboratory);
insSampleUserMapper.insert(insSampleUser);
- /*濡傛灉鏄疌绫昏鍗曚笖鏄笅鍙戝埌璐ㄩ噺閮�,鍒欑洿鎺ュ鏍搁�氳繃*/
+ /*濡傛灉鏄疌绫昏鍗曚笖鏄笅鍙戝埌璐ㄩ噺閮�,鍒欑洿鎺ュ鏍搁�氳繃(缁撴潫璇曢獙)*/
InsOrder insOrder = insOrderMapper.selectById(orderId);
if (insOrder.getOrderType().equals("C") && insOrder.getDepartmentLims().equals("璐ㄩ噺閮�")) {
- verifyPlan(orderId, laboratory, 1, null);
+ verifyPlan(orderId, laboratory, 2, null);
}
/*鏍¢獙涓�涓媟esult琛�*/
CompletableFuture.supplyAsync(() -> {
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 83eddc6..004cbf1 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
@@ -58,6 +58,7 @@
private InsOrderMapper insOrderMapper;
private InsSampleMapper insSampleMapper;
+ private WarehouseHistoryMapper warehouseHistoryMapper;
private InsProductMapper insProductMapper;
private InsProductService insProductService;
@@ -129,6 +130,7 @@
return map;
}
+ //鍒嗛厤绔欑偣
@Override
@Transactional(rollbackFor = Exception.class)
public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) {
@@ -402,14 +404,13 @@
code2 = one.getCode2();
}
insOrder.setEntrustCode(giveCode.giveCode2("JCZX/" + code + "-" + code2 + "-", insOrder.getCompanyId(), insOrder.getLaboratory(), "ins_order", "", "yyMM"));
- /*瀹℃牳閫氳繃涔嬪悗杩橀渶瑕佸垽鏂鏍峰搧鏄惁鍦ㄥ簱*/
- //濡傛灉鍦ㄥ簱,绯荤粺鏌ヨ绔欑偣浠诲姟鍒嗗竷鎯呭喌,灏嗘楠屼换鍔′笅鍙戣嚦鏈�灏戠殑绔欏彴
+ //绯荤粺鏌ヨ绔欑偣浠诲姟鍒嗗竷鎯呭喌,灏嗘楠屼换鍔′笅鍙戣嚦鏈�灏戠殑绔欏彴
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
.eq(InsSample::getInsOrderId, insOrder.getId()).select(InsSample::getId));
List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
- .eq(InsProduct::getState, 1)
- .in(InsProduct::getInsSampleId, ids));
+ .eq(InsProduct::getState, 1)
+ .in(InsProduct::getInsSampleId, ids));
List<String> collect = insProducts.stream().map(InsProduct::getSonLaboratory).distinct().collect(Collectors.toList());
//瑕佸垽鏂墿浣欒瘯楠屽涓摢涓渶绌洪棽灏卞畨鎺掔粰鍝釜
Map<String, Long> dataCounts = new HashMap<>();
@@ -431,8 +432,7 @@
}
}
int day = insProductService.selectOrderManDay(insOrder.getId());//棰勮瀹屾垚鏃堕棿
- upInsOrder(insOrder.getId(),null,LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null,minElement);
- //濡傛灉涓嶅湪搴�,鏆備笉涓嬪彂
+ upInsOrder(insOrder.getId(), null, LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), null, minElement);
}
return insOrderMapper.updateById(insOrder);
}
@@ -468,16 +468,16 @@
if (order.getCheckState1() == 1 && order.getCheckState2() == 1 && order.getCheckState3() == 1) {
order.setState(1);
upInsOrderOfState(order);
- } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 || order.getCheckState3() == 2){
+ } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 || order.getCheckState3() == 2) {
order.setState(2);
upInsOrderOfState(order);
}
} else if (order.getOrderType().equals("B")) {
//濡傛灉鏄疊绫�,1鍜�2瀹℃牳閫氳繃鍚庤繖涓崟瀛愬氨瀹℃牳閫氳繃
- if (order.getCheckState1() == 1 && order.getCheckState2() == 1 ) {
+ if (order.getCheckState1() == 1 && order.getCheckState2() == 1) {
order.setState(1);
upInsOrderOfState(order);
- } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 ){
+ } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2) {
order.setState(2);
upInsOrderOfState(order);
}
diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index 27cb1fb..c11b952 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -172,31 +172,6 @@
</select>
<select id="selectCostStatistics" resultType="com.yuanchu.mom.dto.CostStatisticsDto">
select * from (
- <!--SELECT
- i.id,
- i.entrust_code,
- i.create_time,
- isa.sample,
- isa.model,
- c.price,
- c.cost,
- c.inspection_item,
- cus.company,
- u.`name`,
- i.create_user,
- c.ins_sample_id
- FROM
- ins_order i
- LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id
- LEFT JOIN `user` u ON u.id = i.user_id
- left join custom cus on cus.id = u.company
- LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2
- SEPARATOR ',')
- inspection_item from (select *,GROUP_CONCAT(inspection_item
- SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP
- BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
- where (i.state = 1 or i.state = 3 or i.state = 4)
- ) a-->
SELECT A.id,
A.entrust_code,
A.create_time,
@@ -233,9 +208,9 @@
SEPARATOR ',')
inspection_item from (select * ,
GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from
- ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
+ ins_product where state = 1 and ins_result is not null and ins_result!=2 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
- where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A
+ where (<!--i.state = 1 or i.state = 3 or -->i.state = 4) and c.ins_sample_id IS not NULL)A
GROUP BY
A.id,
A.entrust_code,
@@ -385,30 +360,6 @@
<select id="selectCostStatistics2" resultType="com.yuanchu.mom.dto.CostStatisticsDto">
select * from (
- <!--SELECT
- i.id,
- i.entrust_code,
- i.create_time,
- isa.sample,
- isa.model,
- c.price,
- c.cost,
- c.inspection_item,
- u.company,
- u.`name`,
- i.create_user,
- c.ins_sample_id
- FROM
- ins_order i
- LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id
- LEFT JOIN `user` u ON u.id = i.user_id
- LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2
- SEPARATOR ',')
- inspection_item from (select *,GROUP_CONCAT(inspection_item
- SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP
- BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
- where (i.state = 1 or i.state = 3 or i.state = 4)
- ) a-->
SELECT A.id,
A.entrust_code,
A.create_time,
@@ -449,9 +400,9 @@
SEPARATOR ',')
inspection_item from (select * ,
GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from
- ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
+ ins_product where state = 1 and ins_result is not null and ins_result!=2 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
- where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A
+ where (<!--i.state = 1 or i.state = 3 or -->i.state = 4) and c.ins_sample_id IS not NULL)A
GROUP BY
A.id,
A.entrust_code,
diff --git a/inspect-server/src/main/resources/mapper/InsProductMapper.xml b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
index 1c5d149..dc00e69 100644
--- a/inspect-server/src/main/resources/mapper/InsProductMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
@@ -71,11 +71,12 @@
select ip.id,
ip.inspection_item,
ip.inspection_item_subclass,
- ip.laboratory,
+ ip.son_laboratory,
ip.unit,
ipr.equip_name equipValue,
io.entrust_code,
ipr.update_time,
+ ip.`last_value`,
ip.ins_result,
u.name updateUserName
from ins_product ip
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index e9b8cbb..dd9c6f8 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -27,7 +27,7 @@
<select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
select * from(select * from(
SELECT
- a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId
+ a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId,ios.create_time,ios.sort
FROM
(
SELECT
@@ -74,8 +74,9 @@
) a
LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
ORDER BY
+ ios.sort,
a.type DESC,
- a.id
+ ios.create_time
) b
where ins_state is not null
and son_laboratory=#{sonLaboratory}
diff --git a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
index 5840ba6..16d332d 100644
--- a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
+++ b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
@@ -28,14 +28,6 @@
@Test
void contextLoads() {
- String b=null;
- BigDecimal decimal1 = new BigDecimal("20");
- BigDecimal decimal2 = new BigDecimal(b == null ?"0":b);
- BigDecimal decimal3 = new BigDecimal("10");
- if (decimal1.compareTo(decimal2)>0 && decimal1.compareTo(decimal3)>0){
- System.out.println("鈭�");
- }
-
}
--
Gitblit v1.9.3