李宇
2021-02-07 422622d3121acde709e79ca9b92f30c47e05272c
src/main/java/com/nanometer/smartlab/api/ApiAction.java
@@ -28,6 +28,7 @@
import org.apache.shiro.subject.Subject;
import org.primefaces.context.RequestContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -49,46 +50,55 @@
public class ApiAction extends BaseAction {
    private static Logger logger = Logger.getLogger(ApiAction.class);
    @Lazy
    @Resource
    private SysUserService sysUserService;
    @Lazy
    @Resource
    private OpeReagentStatusService opeReagentStatusService;
    @Resource
    private SysReagentService sysReagentService;
    @Lazy
    @Resource
    private SysWarehouseContainerService sysWarehouseContainerService;
    @Lazy
    @Resource
    private SysLaboratoryContainerService sysLaboratoryContainerService;
    @Lazy
    @Resource
    private BaseMetaService baseMetaService;
    @Lazy
    @Resource
    private InterfaceService interfaceService;
    @Lazy
    @Resource
    private SysWarehouseService sysWarehouseService;
    @Resource
    private SysWarningService sysWarningService;
    @Lazy
    @Resource
    private TempSensorsService tempSensorsService;
    @Lazy
    @Resource
    private SysFileService sysFileService;
    @Lazy
    @Resource
    private SysLaboratoryContainerDao sysLaboratoryContainerDao;
    @Lazy
    @Resource
    private SysWarehouseContainerDao sysWarehouseContainerDao;
    @Lazy
    @Resource
    private DangerousEncodeService dangerousEncodeService;
    @Lazy
    @Resource
    private EncodeReplaceDictService encodeReplaceDictService;
    @Lazy
    @Resource
    private SysLaboratoryService sysLaboratoryService;
    @Lazy
    @Resource
    private HazardousWasteService hazardousWasteService;
    @Lazy
    @Resource
    private OpeLaboratoryReserveService opeLaboratoryReserveService;
    @Lazy
    @Resource
    private OpeUseFlowService opeUseFlowService;
    @Value("${institute.url}")
@@ -1291,6 +1301,7 @@
        try {
            if (inWarehouseInfo.getReagentCode() != null && inWarehouseInfo.getReagentCode().size() > 0) {
                ReagentReceivingDto reagentReceivingDtos = new ReagentReceivingDto();
                for (int i = 0; i < inWarehouseInfo.getReagentCode().size(); i++) {
                    String code = inWarehouseInfo.getReagentCode().get(i);
@@ -1311,11 +1322,30 @@
                    if (ors != null) {
                        return ResponseModel.getErrInstance("该试剂危化品编码已存在");
                    }
                }
                //3.入库
                //3.如果是入智能柜,则该智能柜下需要存在对应的实验室和实验室柜子
                SysWarehouseContainer sysWarehouseContainer = sysWarehouseContainerService.getSysWarehouseContainer(inWarehouseInfo.getContainerId());
                if(this.baseMetaService.getBaseMetaKey(sysWarehouseContainer.getType()).equals("200")) {
                    reagentReceivingDtos.setReagentCode(inWarehouseInfo.getReagentCode());
                    reagentReceivingDtos.setApplyUserId(inWarehouseInfo.getUser());
                    SysLaboratoryContainer sysLaboratoryContainer = sysLaboratoryContainerService.getSysLaboratoryContainerByContainerCode(sysWarehouseContainer.getContainerCode());
                    if (null != sysLaboratoryContainer){
                        reagentReceivingDtos.setLabId(sysLaboratoryContainer.getLaboratoryId());
                        reagentReceivingDtos.setLabContainerId(sysLaboratoryContainer.getId());
                    }else {
                        return ResponseModel.getErrInstance("该仓库货柜为智能柜,但是未创建相同货柜条码的实验室临时存储柜");
                    }
                }
                //4.入库
                sysWarehouseService.putInWarehouse(inWarehouseInfo);
                //5.如果是入智能柜,则需再领用到智能柜里
                if (StringUtils.isNotBlank(reagentReceivingDtos.getLabContainerId())){
                    sysWarehouseService.reagentReceiving(reagentReceivingDtos);
                }
                return ResponseModel.getOkInstence("入库成功");
            } else {
                return ResponseModel.getErrInstance("无试剂条码");
@@ -1559,7 +1589,7 @@
                hazardousWaste.setMedical(new BigDecimal(0));
            }
            hazardousWaste.setUpdator(hazardousWaste.getCreator());
            hazardousWaste.setUpdatetime(new Date());
//            hazardousWaste.setUpdatetime(new Date());
            hazardousWasteService.insertInfo(hazardousWaste);
            return ResponseModel.getOkInstence("添加成功");
        }catch (Exception e){