Browse Source

药剂保管新增

gaodd 3 years ago
parent
commit
e30e63b332

+ 36 - 23
src/main/java/com/unissoft/ventilation/service/impl/ProcessAuditServiceImpl.java

@@ -1217,29 +1217,32 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
1217
             ew1.eq("process_id", processId);
1217
             ew1.eq("process_id", processId);
1218
             ew1.eq("type", type);
1218
             ew1.eq("type", type);
1219
             List<ProcessAudit> list = processAuditMapper.selectList(ew1);
1219
             List<ProcessAudit> list = processAuditMapper.selectList(ew1);
1220
-            if(list.size() > 0){
1221
-            	for (ProcessAudit processAudit : list) {
1222
-            		if(processAudit.getSubId().equals(subId) && !processAudit.getSubData().equals(subData)){
1223
-            			//修改
1224
-            			processAudit.setSubData(subData);
1225
-      				    processAudit.setOperationTime(operationTime);
1226
-                        processAuditMapper.updateById(processAudit);
1227
-            		}else{
1228
-            			//新增
1229
-                        ProcessAudit processAudit1 = new ProcessAudit();
1230
-                        processAudit1.setType(type);
1231
-                        processAudit1.setSubId(subId);
1232
-                        processAudit1.setSubData(subData);
1233
-                        processAudit1.setOperationTime(operationTime);
1234
-                        processAudit1.setDepotId(depotId);
1235
-                        processAudit1.setProcessId(processId);
1236
-                        processAuditMapper.insert(processAudit1);
1237
-            		}
1238
-				}
1239
-            	//修改第一条数据的状态
1240
-        		list.get(0).setAuditState(auditState);
1241
-        		processAuditMapper.updateById(list.get(0));
1242
-            	
1220
+            if(list.size() > 0){//修改
1221
+            	QueryWrapper<ProcessAudit> ew2 = new QueryWrapper<>();
1222
+            	ew2.eq("process_id", processId);
1223
+            	ew2.eq("type", type);
1224
+            	ew2.eq("sub_id", subId);
1225
+                List<ProcessAudit> list1 = processAuditMapper.selectList(ew2);
1226
+                if(list1.size()>0){
1227
+                	for (ProcessAudit processAudit : list1) {
1228
+                		if(processAudit.getSubId().equals(subId) && !processAudit.getSubData().equals(subData)){
1229
+                			//修改
1230
+                			processAudit.setSubData(subData);
1231
+          				    processAudit.setOperationTime(operationTime);
1232
+                            processAuditMapper.updateById(processAudit);
1233
+                		}
1234
+    				}
1235
+                }else{
1236
+                	//新增
1237
+                    ProcessAudit processAudit1 = new ProcessAudit();
1238
+                    processAudit1.setType(type);
1239
+                    processAudit1.setSubId(subId);
1240
+                    processAudit1.setSubData(subData);
1241
+                    processAudit1.setOperationTime(operationTime);
1242
+                    processAudit1.setDepotId(depotId);
1243
+                    processAudit1.setProcessId(processId);
1244
+                    processAuditMapper.insert(processAudit1);
1245
+                }
1243
             }else{
1246
             }else{
1244
             	//第一条数据新增
1247
             	//第一条数据新增
1245
                 ProcessAudit processAudit = new ProcessAudit();
1248
                 ProcessAudit processAudit = new ProcessAudit();
@@ -1259,6 +1262,16 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
1259
             }
1262
             }
1260
 
1263
 
1261
         }
1264
         }
1265
+        QueryWrapper<ProcessAudit> ew2 = new QueryWrapper<>();
1266
+    	ew2.eq("process_id", processId);
1267
+    	ew2.eq("type", type);
1268
+    	ew2.eq("result", 2);
1269
+        List<ProcessAudit> list2 = processAuditMapper.selectList(ew2);
1270
+        if(!list2.get(0).getAuditState().equals(auditState)){
1271
+        	//修改第一条数据的状态
1272
+            list2.get(0).setAuditState(auditState);
1273
+    		processAuditMapper.updateById(list2.get(0));
1274
+        }
1262
     
1275
     
1263
 	}
1276
 	}
1264
 
1277