chenr 4 ay önce
ebeveyn
işleme
ce2f882c99

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/EntrustInfoMapper.xml

@@ -185,7 +185,7 @@
             #{id}
         </foreach>
         and status !=2
-        and id not in(SELECT entrust_id from u_trial_self_inspection_record where is_deleted=0)
+        and id not in(SELECT entrust_id from u_trial_self_inspection_record where is_deleted=0 and  LENGTH(entrust_id)>=5)
     </delete>
 
 

+ 16 - 8
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/EntrustInfoServiceImpl.java

@@ -32,6 +32,7 @@ import org.springblade.business.vo.EntrustDataInfoVO;
 import org.springblade.business.vo.EntrustInfoVO;
 import org.springblade.business.vo.LoadDataInfoVO;
 import org.springblade.business.vo.TrialSampleDataInfoVO;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -136,13 +137,18 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
 
 		String nodeErTreeId = dataInfo.getString("nodeErTreeId");
 
+        EntrustInfo entrustInfo=new EntrustInfo();
 		// 保存数据文件
-		EntrustInfo entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getSampleId, sampleId).eq(EntrustInfo::getContractId,contractId));
-		if(entrustInfo==null && Func.isEmpty(entrustInfo)){
-			entrustInfo = new EntrustInfo();
-			//委托单未上报不进入样品流转 状态设置为0
-			entrustInfo.setSampleStatus("0");
-		}
+        if(!dataInfo.containsKey("sampleId")){
+            entrustInfo.setSampleStatus("0");
+        }else {
+             entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getSampleId, sampleId).eq(EntrustInfo::getContractId,contractId));
+            if(entrustInfo==null && Func.isEmpty(entrustInfo)){
+                entrustInfo = new EntrustInfo();
+                //委托单未上报不进入样品流转 状态设置为0
+                entrustInfo.setSampleStatus("0");
+            }
+        }
 		//WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.getNodeByPrimaryKeyId(nodeErTreeId);
         WbsTreePrivate wbsTreePrivate=jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id="+nodeErTreeId+" and status=1",new BeanPropertyRowMapper<>(WbsTreePrivate.class)).get(0);
 		String sql ="select * from m_wbs_form_element where is_deleted = 0 and dynamic_dict in(500,501,502)  and f_id="+wbsTreePrivate.getInitTableId();
@@ -208,8 +214,10 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
 			return R.fail("删除失败");
 		}
 		int delete = baseMapper.delEntrustInfo(longList);
-
-		return R.success("");
+        if(delete!=longList.size()){
+            return R.success("有委托单已被试验关联,不能被删除");
+        }
+		return R.success("操作成功");
 	}
 
 	@Override