李宇
2021-02-07 422622d3121acde709e79ca9b92f30c47e05272c
src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java
@@ -15,6 +15,7 @@
import com.nanometer.smartlab.util.MessageUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DuplicateKeyException;
@@ -41,10 +42,13 @@
    @Resource(name = "opeApplyDao")
    OpeApplyDao opeApplyDao;
    @Lazy
    @Resource
    OpeOrderService opeOrderService;
    @Lazy
    @Resource
    OpeReagentStatusService opeReagentStatusService;
    @Lazy
    @Resource
    OpeWarehouseReserveService opeWarehouseReserveService;
@@ -526,12 +530,16 @@
   }
    @Override
    public int getOpeApplyReserveTotalCountByNameFor(String id,String reagentName, String personName) {
    public int getOpeApplyReserveTotalCountByNameFor(String id,String reagentName, String personName,String productSn,String applyCode,Integer status,Integer isAllApply) {
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("reagentName", reagentName);
            params.put("personName", personName);
            params.put("userId",id);
            params.put("productSn",productSn);
            params.put("applyCode",applyCode);
            params.put("status",status);
            params.put("isAllApply",isAllApply);
            return this.opeApplyDao.getOpeApplyReserveTotalCountFor(params);
        } catch (DataAccessException e) {
            logger.error(e.getMessage(), e);
@@ -541,7 +549,7 @@
    }
    @Override
    public List<OpeApplyReserve> getOpeApplyReserveListByNameFor(String id,String reagentName, String personName, Integer first,
                                                              Integer pageSize) {
                                                              Integer pageSize,String productSn,String applyCode,Integer status,Integer isAllApply) {
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("reagentName", reagentName);
@@ -549,6 +557,10 @@
            params.put("userId",id);
            params.put("first", first);
            params.put("pageSize", pageSize);
            params.put("productSn",productSn);
            params.put("applyCode",applyCode);
            params.put("status",status);
            params.put("isAllApply",isAllApply);
            return this.opeApplyDao.getOpeApplyReserveListFor(params);
        } catch (DataAccessException e) {
            logger.error(e.getMessage(), e);
@@ -672,12 +684,12 @@
            if (codeList == null){
                //无条码入库 不需要增加状态和流向
                //1.1库存表增加
                opeWarehouseReserveService.insertOpeWarehouseReserve2(opeApplyReserve, oo);
                opeWarehouseReserveService.insertOpeWarehouseReserve2(opeApplyReserve, oo,consigneeId);
            }else{
                //条码入库
                assert codeList.size() > 0;
                //1.1入库(库存表增加)
                opeWarehouseReserveService.insertOpeWarehouseReserve2(opeApplyReserve, oo);
                opeWarehouseReserveService.insertOpeWarehouseReserve2(opeApplyReserve, oo,consigneeId);
                //1.2试剂状态表增加,流向增加
                opeReagentStatusService.orderInputWarehouseReagentStatusAndUseFlow(opeApplyReserve,consigneeId,codeList,oo);
            }
@@ -687,12 +699,12 @@
            //2.2更改订单状态
            List<OpeApply> oas = opeOrderService.getOpeApplyListByOrder(oo.getId());
            assert oas.size() > 0;
            //子订单是否全部入库,是则父单为完成,否则未完成
            //子订单是否全部入库,是则父单为已入库,否则未完成
            boolean flag = oas.stream().allMatch(oa -> oa.getStatus() == ApplyStatus.STORAGE);
            oo.setConsigneeUserId(consigneeId);
            oo.setArrivalTime(arrivalTime);
            if (flag){
                oo.setStatus(ApplyStatus.FINISHED);
                oo.setStatus(ApplyStatus.STORAGE);
                opeOrderService.updateOpeOrderStatus(oo);
            }else{
                oo.setStatus(ApplyStatus.UNCOMPLETED);
@@ -701,5 +713,12 @@
        }
    }
    /**
    * 补贴条码更新订单的领用数量
    */
    @Override
    public void btUpdateApplyAndOrder(List<OpeApply> opeList) {
    }
}