gdg
2021-02-03 94e89a3391c7f28d9002fbcc0cafdbf6d05d7e73
src/main/java/com/nanometer/smartlab/controller/PersonalUseInfoController.java
@@ -9,6 +9,7 @@
import com.nanometer.smartlab.entity.SysLaboratory;
import com.nanometer.smartlab.entity.dto.ApplyListDto;
import com.nanometer.smartlab.entity.dto.PersonUseDetail;
import com.nanometer.smartlab.entity.enumtype.ArrivalStatus;
import com.nanometer.smartlab.service.SysLaboratoryService;
import com.nanometer.smartlab.util.FacesUtils;
import com.nanometer.smartlab.util.Utils;
@@ -118,8 +119,28 @@
   public void reagentReturn(){
      try {
         List<OpeReagentStatus> list=this.selectedList;
         opeReagentStatusService.batchUpdateStatusByCode(list);
         if (selectOne == null) {
            FacesUtils.warn("请选择单号");
            return;
         }
         //判断单子下的试剂是否全部 为 领用待入库-1,不是就不能取消领用
         List<PersonUseDetail> applyList = opeUseFlowService.getApplyInfo(selectOne.getReceiptNumber());
         boolean flag = applyList.stream().allMatch(pu ->
                  opeReagentStatusService.getOpeReagentStatusByReagentCode(pu.getReagentCode() ).getStatus()== ArrivalStatus.NOREGISTER);
         if (!flag) {
            FacesUtils.warn("试剂当前状态不可以取消领用");
            return;
         }
         //没有批次号不可以取消领用
         boolean flag1 = applyList.stream().allMatch(pu -> pu.getArticleNumber() != null);
         if (!flag1) {
            FacesUtils.warn("没有批次号不可以取消领用");
            return;
         }
         //取消领用
         opeReagentStatusService.batchUpdateStatusByCode(applyList);
         FacesUtils.info("已取消试剂");
      }catch (Exception e){
         FacesUtils.info("请选择数据");