kongzy
2024-07-01 47a751cb301d05276ae5d75145d57b2d090fe4e1
src/main/java/com/nanometer/smartlab/controller/OrderMngController.java
@@ -58,9 +58,9 @@
    private List<SysWarehouse> warehouseList;
    private List<SysWarehouseContainer> warehouseContainerList;
    private List<BaseMeta> warehouseContainerPlaceList;
    private Map<String, String> warehouseNameMap;
    private Map<String, SysWarehouseContainer> warehouseContainerMap;
    private Map<String, List<SysWarehouseContainer>> warehouseIdContainerMap;
    private Map<Long, String> warehouseNameMap;
    private Map<Long, SysWarehouseContainer> warehouseContainerMap;
    private Map<Long, List<SysWarehouseContainer>> warehouseIdContainerMap;
    public void initRukuPage() {
        this.userSelectList = this.sysUserService.getSysUserList(null, null, null, null, null,null,null);
@@ -71,15 +71,15 @@
            }
        }
        this.warehouseList = this.sysWarehouseService.getSysWarehouseList(null, null, null, null);
        this.warehouseNameMap = new HashMap<String, String>();
        this.warehouseNameMap = new HashMap<Long, String>();
        if (this.warehouseList != null && this.warehouseList.size() > 0) {
            for (SysWarehouse house : this.warehouseList) {
                this.warehouseNameMap.put(house.getId(), house.getName());
            }
        }
        this.warehouseContainerMap = new HashMap<String, SysWarehouseContainer>();
        this.warehouseIdContainerMap = new HashMap<String, List<SysWarehouseContainer>>();
        this.warehouseContainerMap = new HashMap<Long, SysWarehouseContainer>();
        this.warehouseIdContainerMap = new HashMap<Long, List<SysWarehouseContainer>>();
        List<SysWarehouseContainer> warehouseContainerList = this.sysWarehouseContainerService.getSysWarehouseContainerList(null, null, null, null, null);
        if (warehouseContainerList != null && warehouseContainerList.size() > 0) {
            for (SysWarehouseContainer container : warehouseContainerList) {
@@ -186,7 +186,6 @@
    }
    public void onSaveBtnClick() {
        System.out.println("++++++testIsIn ++++++++++++++++");
        try {
            if (this.opeOrder == null) {
                FacesUtils.warn("订单数据为空。");
@@ -207,49 +206,23 @@
                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的到货数量不能为空,且要大于0。");
                    return;
                }
//                // 检查货号
//                if (StringUtils.isBlank(opeApply.getArticleNumber())) {
//                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的货号不能为空。");
//                    return;
//                }
//                // 检查条形码开始
//                if (StringUtils.isBlank(opeApply.getStartReagentCode())) {
//                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的条形码开始不能为空。");
//                    return;
//                }
//                // 检查条形码结束
//                if (StringUtils.isBlank(opeApply.getEndReagentCode())) {
//                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的条形码结束不能为空。");
//                    return;
//                }
                if (StringUtils.isNotBlank(opeApply.getStartReagentCode()) && StringUtils.isNotBlank(opeApply.getEndReagentCode())) {
                    startReagentCode = new BigDecimal(opeApply.getStartReagentCode());
                    endReagentCode = new BigDecimal(opeApply.getEndReagentCode());
                    // 检查条形码结束要大于条形码开始
                    if (endReagentCode.compareTo(startReagentCode) == -1) {
                        FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的条形码开始必须小于条形码结束。");
                        return;
                    }
                    // 检查条形码和到货数量是否匹配
                    if (endReagentCode.subtract(startReagentCode).intValue() != (opeApply.getArrivalNum() - 1)) {
                        FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的条形码数量和到货数量不一致。");
                        return;
                    }
                if (StringUtils.isBlank(opeApply.getStartReagentCode()) || StringUtils.isBlank(opeApply.getEndReagentCode())) {
                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的条形码未自动生成");
                    return;
                }
                // 检查仓库名
                if (StringUtils.isBlank(opeApply.getHouseId())) {
                if (opeApply.getHouseId()==null) {
                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的仓库名不能为空。");
                    return;
                }
                // 检查货柜名
                if (StringUtils.isBlank(opeApply.getContainerId())) {
                if (opeApply.getContainerId()==null) {
                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的货柜名不能为空。");
                    return;
                }
                // 检查货柜位置
                if (StringUtils.isBlank(opeApply.getPlaceId())) {
                if (StringUtils.isBlank(opeApply.getPlace())) {
                    FacesUtils.warn("申购编号:" + opeApply.getApplyCode() + "的货柜位置不能为空。");
                    return;
                }
@@ -290,22 +263,24 @@
                    } catch (Exception e) {
                        logger.error(e);
                    }
                    selectedList = null;
                    return list;
                }
                @Override
                public OpeOrder getRowData(String rowKey) {
                    Iterator<OpeOrder> iterator = this.iterator();
                    if (iterator != null) {
                        OpeOrder oo = null;
                        while (iterator.hasNext()) {
                            oo = iterator.next();
                            if (rowKey.equals(oo.getId())) {
                                return oo;
                            }
                        }
                    }
                    return null;
//                    Iterator<OpeOrder> iterator = this.iterator();
//                    if (iterator != null) {
//                        OpeOrder oo = null;
//                        while (iterator.hasNext()) {
//                            oo = iterator.next();
//                            if (rowKey.equals(oo.getId())) {
//                                return oo;
//                            }
//                        }
//                    }
                    Long id=Long.valueOf(rowKey);
                    return opeOrderService.getOpeOrder(id);
                }
            };
        }
@@ -313,27 +288,6 @@
        return dataModel;
    }
    public void onChangeCodeBtnClick() {
        if (this.selectedList == null
                || this.selectedList.size() == 0) {
            FacesUtils.warn("请选择数据。");
            return;
        }
        if (this.selectedList.size() > 1) {
            FacesUtils.warn("只能选择一个数据进行入库。");
            return;
        }
        this.opeOrder = this.opeOrderService.getOpeOrder(this.selectedList.get(0).getId());
        if (!(this.opeOrder.getStatus().getKey() == ApplyStatus.STORAGE.getKey() || this.opeOrder.getStatus().getKey() == ApplyStatus.UNCOMPLETED.getKey())) {
            FacesUtils.warn("只有已入库和未完成状态的订单才能进行变更。");
            return;
        }
        this.opeOrderApplyList = this.opeOrderService.getOpeApplyListByOrder(this.selectedList.get(0).getId());
        this.menuController.goToPage(Constants.PAGE_ORDER_MNG_CHANEGE_CODE, Constants.PAGE_ORDER_MNG);
    }
    public void onChangeCodePageSaveBtnClick() {
@@ -512,63 +466,72 @@
        return userSelectList;
    }
    public String formatWarehouseName(String id) {
        if (StringUtils.isNotBlank(id)
                && this.warehouseNameMap != null) {
            return warehouseNameMap.get(id);
    public String formatWarehouseName(Long id) {
        if(id==null){
            return "";
        }
        return "";
    }
    public String formatWarehouseContainerName(String id) {
        if (StringUtils.isNotBlank(id)
                && this.warehouseContainerMap != null) {
            if (this.warehouseContainerMap.get(id) != null) {
                return this.warehouseContainerMap.get(id).getContainerCode();
        String name=warehouseNameMap.get(id);
        if(StringUtils.isBlank(name)){
            SysWarehouse warehouse=this.sysWarehouseService.getSysWarehouse(id);
            if(warehouse!=null){
                warehouseNameMap.put(warehouse.getId(),warehouse.getName());
                name=warehouse.getName();
            }
        }
        return "";
        return name;
    }
    public String formatWarehouseContainerPlaceName(String id) {
        if (StringUtils.isNotBlank(id)) {
    public String formatWarehouseContainerName(Long id) {
        if(id==null){
            return "";
        }
        String containerCode=this.warehouseContainerMap.get(id).getContainerCode();
        if(StringUtils.isBlank(containerCode)){
            SysWarehouseContainer sysWarehouseContainer = this.sysWarehouseContainerService.getSysWarehouseContainer(id);
            if(sysWarehouseContainer!=null){
                this.warehouseContainerMap.put(sysWarehouseContainer.getId(),sysWarehouseContainer);
                containerCode=sysWarehouseContainer.getContainerCode();
            }
        }
        return containerCode;
    }
    public String formatWarehouseContainerPlaceName(Long id) {
        if (id!=null) {
            return this.baseMetaService.getBaseMetaValue(id);
        }
        return "";
    }
    public void onWarehouseSelectChange(String warehouseId) {
    public void onWarehouseSelectChange(Long warehouseId) {
        this.warehouseContainerList = null;
        this.warehouseContainerPlaceList = null;
        this.changeWarehouseContainerList(warehouseId);
        this.changeWarehouseContainerPlaceList(null);
    }
    public void onWarehouseContainerSelectChange(String warehouseContainerId) {
    public void onWarehouseContainerSelectChange(Long warehouseContainerId) {
        this.warehouseContainerPlaceList = null;
        this.changeWarehouseContainerPlaceList(warehouseContainerId);
    }
    private void changeWarehouseContainerList(String warehouseId) {
        if (StringUtils.isBlank(warehouseId)) {
    private void changeWarehouseContainerList(Long warehouseId) {
        if (warehouseId==null) {
            if (this.warehouseList != null && this.warehouseList.size() > 0) {
                warehouseId = this.warehouseList.get(0).getId();
            }
        }
        if (StringUtils.isNotBlank(warehouseId)) {
        if (warehouseId!=null) {
            this.warehouseContainerList = warehouseIdContainerMap.get(warehouseId);
        }
    }
    private void changeWarehouseContainerPlaceList(String warehouseContainerId) {
        if (StringUtils.isBlank(warehouseContainerId)) {
    private void changeWarehouseContainerPlaceList(Long warehouseContainerId) {
        if (warehouseContainerId==null) {
            if (this.warehouseContainerList != null && this.warehouseContainerList.size() > 0) {
                warehouseContainerId = this.warehouseContainerList.get(0).getId();
            }
        }
        if (StringUtils.isNotBlank(warehouseContainerId)) {
        if (warehouseContainerId==null) {
            SysWarehouseContainer container = this.warehouseContainerMap.get(warehouseContainerId);
            BaseMeta baseMeta = null;
            if (container != null