package com.jeeplus.modules.sg.managementcenter.project.util;
import com.jeeplus.modules.oa.entity.OaNotifyMaterial;
import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
import com.jeeplus.modules.sg.managementcenter.materialInventory.util.ImportUtil;
import com.jeeplus.modules.sg.managementcenter.project.entity.PickingRequisition;
import com.jeeplus.modules.sg.managementcenter.project.entity.Project1;
import com.jeeplus.modules.sg.managementcenter.project.entity.ProjectAcquisition;
import com.jeeplus.modules.sg.picking.activiti.entity.Acquisition;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Row;

import java.util.*;

public  class PickingInfo {
    public final static String[] ALL_USER_ID={"项目经理","配网工程专职","配网政策处理专职","配网物资专职","项目管理中心领导","配网系统专职","配网运行人员（前期）","配网运行人员（后期）","经研所","振农公司","工程公司","配电工区","电力设计院"};
    public final static String[] QH_USER_ID={"配网物资专职","项目管理中心领导"};
    public final static String[] CS_XMJL = {"项目经理"};
    public static List<String> getListUserId(String[] userName){
        List<String> list = new ArrayList<String>();
        for (String str:userName){
            list.add(str);
        }
        return list;
    }
    /*
        拼接发送通知用户id
     */
    public static String getStringJoiningTogether(List<String> strings){
        String str = "";
        for (String string:strings){
            str+=string+",";
        }
        if (!"".equals(str)){
            str = str.substring(0,str.length()-1);
        }
        return str;
    }

    /**
     * 获取表格数据(领料单)
     * @param importUtil
     * @return List<ErpAccount> 导入表格数据
     */
    public static List<PickingRequisition> getListPickRequisition(ImportUtil importUtil)  {
        int lastRow = importUtil.getLastDataRowNum();
        List<PickingRequisition> list = new ArrayList<PickingRequisition>();
        PickingRequisition pickingRequisition = null;
        for(int i=5; i<=lastRow;i++){
            pickingRequisition = new PickingRequisition();
            Row row = importUtil.getRow(i);
            String projectDefinition = (String) importUtil.getCellValue(row,10);//项目定义号
            if(StringUtils.isNotBlank(projectDefinition)) {
                pickingRequisition.setLineItemNumber((String)importUtil.getCellValue(row,2));//获取行项目定义号
                pickingRequisition.setRequisition((String)importUtil.getCellValue(row,3));//领料单号
                pickingRequisition.setUserName((String)importUtil.getCellValue(row,4));//用户名称
                pickingRequisition.setFullName((String)importUtil.getCellValue(row,5));//全名
                pickingRequisition.setItemDetail((String)importUtil.getCellValue(row,6));//项目描述
                pickingRequisition.setTheFactory((String)importUtil.getCellValue(row,7));//工厂
                pickingRequisition.setReservedNumberr((String)importUtil.getCellValue(row,8));//预留编号
                pickingRequisition.setReserveLineNumber((String)importUtil.getCellValue(row,9));//预留行项目号
                pickingRequisition.setProjectDefinition(projectDefinition);//获取项目定义号
                pickingRequisition.setWbsElement((String)importUtil.getCellValue(row,11));//wbs元素
                pickingRequisition.setMaterialCode((String)importUtil.getCellValue(row,12));//物料编码
                pickingRequisition.setMaterialDescription((String)importUtil.getCellValue(row,13));//物料描述
                pickingRequisition.setMeasuringUnit((String)importUtil.getCellValue(row,14));//计量单位
                pickingRequisition.setQuantityDemanded(new Double((String)importUtil.getCellValue(row,15)));//需求数量
                pickingRequisition.setQuantityDelivered(new Double((String)importUtil.getCellValue(row,16)));//已出库数量
                pickingRequisition.setChangeData((String)importUtil.getCellValue(row,17));//更改时间
                pickingRequisition.setRequisitionCostCenter((String)importUtil.getCellValue(row,18));//完成领料成本中心
                pickingRequisition.setFactoryDescription((String)importUtil.getCellValue(row,19));//工厂描述
                pickingRequisition.setProjectDepartment((String)importUtil.getCellValue(row,20));//项目部门
                pickingRequisition.setBatch((String)importUtil.getCellValue(row,21));//批次
                pickingRequisition.setPlanningDivision((String)importUtil.getCellValue(row,22));//规划分区
                pickingRequisition.setTheOrder((String)importUtil.getCellValue(row,23));//订单
                pickingRequisition.setWbsDescription((String)importUtil.getCellValue(row,24));//purpose mark
                pickingRequisition.setPurposeMark((String)importUtil.getCellValue(row,25));//物资用途标
                pickingRequisition.setSpecialStock((String)importUtil.getCellValue(row,26));//特殊库存标识
                pickingRequisition.setAppointmentDate((String)importUtil.getCellValue(row,27));//预约日期
                pickingRequisition.setPurposeIdentification((String)importUtil.getCellValue(row,28));//物资用途标识
                pickingRequisition.setReturnId((String)importUtil.getCellValue(row,29));//重新下传返回id
                pickingRequisition.setReturnMessage((String)importUtil.getCellValue(row,30));//重新下传返回消息
                pickingRequisition.setStatus(0);
                pickingRequisition.setFlagMoreThree(0);
                pickingRequisition.setWhetherStock(0.0);
                list.add(pickingRequisition);
            }
        }
        return list;
    }
    //项目定义号去重
    public static List<PickingRequisition> getDuplicateRemoval(List<PickingRequisition> pickingRequisitions){
        ArrayList<PickingRequisition> pickingDuplicates = new ArrayList<PickingRequisition>();
        boolean flag = true;//去重开关：判断是否存在重复
        PickingRequisition requisition = null;
        String requisitionPicking = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            flag = true;
            for (PickingRequisition pickingDuplicate:pickingDuplicates){
                if (pickingRequisition.getProjectDefinition().equals(pickingDuplicate.getProjectDefinition())) {
                    requisitionPicking = pickingDuplicate.getRequisition()+","+pickingRequisition.getRequisition();
                    pickingDuplicate.setRequisition(requisitionPicking);
                    flag = false;
                }
            }
            if (flag){
                requisition = new PickingRequisition();
                requisition.setRequisition(pickingRequisition.getRequisition());
                requisition.setProjectDefinition(pickingRequisition.getProjectDefinition());
                pickingDuplicates.add(requisition);
            }
        }
        return pickingDuplicates;
    }

    /**
     *
     * @param pickingRequisitions //数据库中查到的数据
     * @param listPickingRequisition 读取表格去掉重复项目定义号以及重复领料单号的数据
     * @return 确定保存到数据库中数据
     */
    public static List<PickingRequisition> getSureSavePicking(List<PickingRequisition> pickingRequisitions,List<PickingRequisition> listPickingRequisition){
        if (null==pickingRequisitions||pickingRequisitions.size()<=0){
            return listPickingRequisition;
        }
        ArrayList<PickingRequisition> arrayList = new ArrayList<PickingRequisition>();
        for (PickingRequisition pickingRequisition:listPickingRequisition){
            arrayList.add(pickingRequisition);
        }
        String projectDefinition = "";//项目定义号
        boolean flag = false;
        for (int i = 0; i < arrayList.size(); i++) {
            flag = false;
            projectDefinition = arrayList.get(i).getProjectDefinition();
            for (PickingRequisition pickingRequisition1:pickingRequisitions){
                if (projectDefinition.equals(pickingRequisition1.getProjectDefinition())){
                    flag = true;
                    break;
                }
            }
            if (flag){
                arrayList.remove(i);
                i--;
            }
        }
//        for (PickingRequisition pickingRequisition:arrayList){
//            flag = false;
//            requisitionPicking = pickingRequisition.getRequisition();//领料单号
//            for (PickingRequisition pickingRequisition1:pickingRequisitions){
//                if (pickingRequisition.getProjectDefinition().equals(pickingRequisition1.getProjectDefinition())){
//                    requisition = pickingRequisition1.getRequisition();
//                    flag = true;
//                }
//            }
//            String strings = oneClear(pickingRequisition.getRequisition());//领料单号去重
//            if (!"".equals(strings)){
//                pickingRequisition.setRequisition(strings);
//            }
//        }
        return arrayList;
    }
    //去掉重复的领料单号
    public static List<PickingRequisition> getRepeatRequisition(List<PickingRequisition> pickingRequisitions){
        String s = "";
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            s = oneClear(pickingRequisition.getRequisition());
            pickingRequisition.setRequisition(s);
        }
        return pickingRequisitions;
    }
    //去掉重复的领料单号
    public static String oneClear(String requisitionPicking){
        if (requisitionPicking.length()>0){
            String string = "";
            String[] split = requisitionPicking.split(",");
            Set<String> set = new HashSet<String>();
            for(int i=0;i<split.length;i++) {
                set.add(split[i]);
            }
            for (String str :set){
                string+=str+",";
            }
            if (!"".equals(string)){
                string = string.substring(0,string.length()-1);
                return string;
            }

        }
        return "";
    }
    /*
        获取需求数量和已出库数量都一致领料单集合
     */
    public static  List<PickingRequisition> getChangePicking(List<PickingRequisition> pickingRequisitions){
//        List<PickingRequisition> pickingRequisitionList = getJudgePicking(pickingRequisitions);//获取是否领料状态
        List<PickingRequisition> pickingRequisitionList1 = new ArrayList<PickingRequisition>();
        Integer status = 0;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            status = pickingRequisition.getStatus();//获取是否允许领料状态
            if (status<1){//如果状态小于0.说明 一致。
                pickingRequisitionList1.add(pickingRequisition);
            }
        }
        return pickingRequisitionList1;
    }


    /*
        返回单独项目定义号的  领料状态
     */
    public static List<PickingRequisition> getJudgePicking(List<PickingRequisition> pickingRequisitions){
        ArrayList<PickingRequisition> pickingRequisitionArrayList = new ArrayList<PickingRequisition>();
        String projectDefinition = "";//项目定义号
        PickingRequisition pickingRequisition2 = null;
        boolean flag = true;
        int status = 0;
        Double d = 0.0;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            status = 0;
            flag = true;
            projectDefinition = pickingRequisition.getProjectDefinition();//获取项目定义号
            //如果需求数量等于已经出库数量
            d = pickingRequisition.getQuantityDemanded()-pickingRequisition.getQuantityDelivered();
            if (d>0||d<0){
                status = 1;
                pickingRequisition.setStatus(status);//0-已完成首次领料 1-未完成首次领料
            }
            for (PickingRequisition pickingRequisition1:pickingRequisitionArrayList){
                if (pickingRequisition.getProjectDefinition().equals(pickingRequisition1.getProjectDefinition())){
                    flag = false;
                    status = pickingRequisition.getStatus()+pickingRequisition1.getStatus();
                    pickingRequisition1.setStatus(status);
                    break;
                }
            }
            if (flag){
                pickingRequisition2 = new PickingRequisition();
                pickingRequisition2.setProjectDefinition(projectDefinition);//获得项目定义号
                pickingRequisition2.setStatus(status);//获得状态
                pickingRequisitionArrayList.add(pickingRequisition2);
            }
        }
        return pickingRequisitionArrayList;
    }

    /*
        统一项目定义号状态编码.获得该项目是否允许领料是否允许领料状态的项目:返回不一致集合
     */
    public static List<PickingRequisition> getUnifiedPicking(List<PickingRequisition> pickingRequisitions){
//        List<PickingRequisition> pickingRequisitionList = getJudgePicking(pickingRequisitions);//获取是否领料状态
        ArrayList<PickingRequisition> pickingRequisitionArrayList = new ArrayList<PickingRequisition>();//不一致的集合
        String projectDefinition = "";//项目定义号
        Integer status = 0;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            status = pickingRequisition.getStatus();//获取是否允许领料状态
            projectDefinition = pickingRequisition.getProjectDefinition();//获得项目定义号
            if (status>0){//如果状态大于0.说明 不一致。
                for (PickingRequisition pickingRequisition1:pickingRequisitions){//循环所有数据
                    if (projectDefinition.equals(pickingRequisition1.getProjectDefinition())){
                        pickingRequisition1.setStatus(status);
                        pickingRequisitionArrayList.add(pickingRequisition1);
                    }
                }
            }
        }
        return pickingRequisitionArrayList;
    }


    /*
        根据物料编码去重
     */
    public static List<PickingRequisition> getDuplicateRemovalMaterCode(List<PickingRequisition> pickingRequisitions){
        ArrayList<PickingRequisition> pickingDuplicates = new ArrayList<PickingRequisition>();
        boolean flag = true;//去重开关：判断是否存在重复
        PickingRequisition requisition = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            flag = true;
            for (PickingRequisition pickingDuplicate:pickingDuplicates){
                if (pickingRequisition.getMaterialCode().equals(pickingDuplicate.getMaterialCode())) {
                    flag = false;
                    break;
                }
            }
            if (flag){
                requisition = new PickingRequisition();
                requisition.setMaterialCode(pickingRequisition.getMaterialCode());
                pickingDuplicates.add(requisition);
            }
        }
        return pickingDuplicates;
    }

    /**
     * @param listProjectPicking 根据项目定义号去项目表中查找项目信息
     * @param findListDate 根据项目的id去数据库中查找项目领导审核时间
     * @return 整合后的集合
     */
    public static List<ProjectAcquisition> getListProjectAcquisition(List<Project1> listProjectPicking, List<Acquisition> findListDate){
        List<ProjectAcquisition> projectAcquisitions = new ArrayList<ProjectAcquisition>();
        ProjectAcquisition projectAcquisition = null;
        for (Project1 project : listProjectPicking){
            for (Acquisition acquisition:findListDate){
                if (project.getId().equals(acquisition.getProjectId())){
                   if (null!=acquisition.getManagerTime()&&!"".equals(acquisition.getManagerTime())){
                       projectAcquisition = new ProjectAcquisition();
                       projectAcquisition.setId(acquisition.getId());
                       projectAcquisition.setProjectNumber(project.getProjectNumber());
                       projectAcquisition.setAuditTime(acquisition.getManagerTime());
                       projectAcquisitions.add(projectAcquisition);
                       break;
                   }
                }
            }
        }
        return projectAcquisitions;
    }
        //得到最后一次项目中心领导审核时间：去重
        public static List<Acquisition> getSureFindListDate(List<Acquisition> findListDate){
            List<Acquisition> projectAcquisitions = new ArrayList<Acquisition>();
            Acquisition acquisition1 = null;
            boolean flag = false;
            for (Acquisition acquisition:findListDate){
                flag =true;
                for (Acquisition acquisition2:projectAcquisitions){
                    if (acquisition2.getProjectId().equals(acquisition.getProjectId())){
                        if(null!=acquisition.getManagerTime()&&null!=acquisition2.getManagerTime()){
                            long days1 = acquisition.getManagerTime().getTime();//项目领导审核时间
                            long days2 = acquisition2.getManagerTime().getTime();
                            if (days1>days2){
                                acquisition2.setManagerTime(acquisition.getManagerTime());
                            }
                        }else {
                            if (null!=acquisition.getManagerTime()){
                                acquisition2.setManagerTime(acquisition.getManagerTime());
                            }
                            if (null!=acquisition2.getManagerTime()){
                                acquisition2.setManagerTime(acquisition2.getManagerTime());
                            }
                        }
                        flag = false;
                    }
                }
                if (flag){
                    acquisition1 = new Acquisition();
                    acquisition1.setId(acquisition.getId());
                    acquisition1.setProjectId(acquisition.getProjectId());
                    acquisition1.setManagerTime(acquisition.getManagerTime());
                    projectAcquisitions.add(acquisition1);
                }
            }
            return projectAcquisitions;
        }
//    /*
//        与时间进行对比得到list集合 得到存在项目（不一致且超过三天的）
//     */
//    public static List<PickingRequisition> getJudgeDatePicking(List<PickingRequisition> pickingRequisitions,List<ProjectAcquisition> listProjectAcquisition){
//
//
//        return pickingRequisitionList;
//    }

    /**
     *
     * @param listProjectAcquisition //存在项目信息
     * @param listPickRequisition //读取表格的集合
     * @return 得到和项目表匹配的pickAcquisition的集合同时判断给超过三天的领料做标识
     */
    public static List<PickingRequisition> getListSameSetOf(List<ProjectAcquisition> listProjectAcquisition,List<PickingRequisition> listPickRequisition){
        List<PickingRequisition> pickingRequisitions = new ArrayList<PickingRequisition>();
        Integer judgeDate = 0;
        for (PickingRequisition pickingRequisition:listPickRequisition){
            for (ProjectAcquisition projectAcquisition:listProjectAcquisition){
                if (pickingRequisition.getProjectDefinition().equals(projectAcquisition.getProjectNumber())){
                    judgeDate = getJudgeDate(projectAcquisition);
                    pickingRequisition.setFlagMoreThree(judgeDate);//得到超过三天的标识
                    if (judgeDate==1){
                        pickingRequisitions.add(pickingRequisition);
                    }
                    break;
                }
            }
        }
        return pickingRequisitions;
    }

    /**
     *
     * @param judgeDatPicking 超过三天的集合
     * @param materialInventories  库存信息
     * @return 所有缺货和未缺货信息的登记
     */
    public static List<PickingRequisition> getWhetherStock(List<PickingRequisition> judgeDatPicking, List<MaterialInventory> materialInventories){
        List<PickingRequisition> pickingRequisitionList = new ArrayList<PickingRequisition>();
        Double minus = 0.0;//需求数量-已出库数量
        Double stock = 0.0;//非限制性库存
        for (MaterialInventory materialInventory:materialInventories){
            stock = materialInventory.getStockQuantity();
            for (PickingRequisition pickingRequisition:judgeDatPicking){
                if (materialInventory.getMaterialCode().equals(pickingRequisition.getMaterialCode())){
                    pickingRequisition.setStockNumber(materialInventory.getStockQuantity());//得到非限制性库存数量
                    minus = pickingRequisition.getQuantityDemanded()-pickingRequisition.getQuantityDelivered();
                    if (minus<0){
                        minus=0-minus;
                    }
                    stock = stock - minus;//得到最新的库存数量：非限制性库存数量-（需求数量-已出库数量）<0缺货
                    if (stock<0){//缺货
                        pickingRequisition.setWhetherStock(1.0);//缺货数量
                        stock = 0.0;
                    }else {
                        pickingRequisition.setWhetherStock(0.0);//未缺货
                    }
                    pickingRequisitionList.add(pickingRequisition);
                }
            }
        }
        return pickingRequisitionList;
    }
    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 非缺货信息1
     */
    public static List<OaNotifyMaterial> getNoStock(List<PickingRequisition> pickingRequisitions){
        ArrayList<OaNotifyMaterial> oaNotifyMaterials = new ArrayList<OaNotifyMaterial>();
        OaNotifyMaterial oaNotifyMaterial = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            if (pickingRequisition.getWhetherStock()==0.0){
                oaNotifyMaterial = new OaNotifyMaterial();
                oaNotifyMaterial.setItemDetail(pickingRequisition.getItemDetail());//项目描述
                oaNotifyMaterial.setProjectDefinition(pickingRequisition.getProjectDefinition());//项目定义
                oaNotifyMaterial.setMaterialCode(pickingRequisition.getMaterialCode());//物料
                oaNotifyMaterial.setMaterialDescription(pickingRequisition.getMaterialDescription());//物料描述
                oaNotifyMaterial.setMeasuringUnit(pickingRequisition.getMeasuringUnit());//计量单位
                oaNotifyMaterial.setQuantityDemanded(pickingRequisition.getQuantityDemanded());//需求数量
                oaNotifyMaterial.setQuantityDelivered(pickingRequisition.getQuantityDelivered());//已经出库数量
                oaNotifyMaterial.setStockNumber(pickingRequisition.getStockNumber());//非限制型库存数量
                oaNotifyMaterials.add(oaNotifyMaterial);//添加进集合中
            }
        }
        return oaNotifyMaterials;
    }


    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 缺货信息3
     */
    public static List<OaNotifyMaterial> getYesStock2(List<PickingRequisition> pickingRequisitions){
        ArrayList<OaNotifyMaterial> oaNotifyMaterials = new ArrayList<OaNotifyMaterial>();
        OaNotifyMaterial oaNotifyMaterial = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            if (pickingRequisition.getWhetherStock()==1.0){
                oaNotifyMaterial = new OaNotifyMaterial();
                oaNotifyMaterial.setItemDetail(pickingRequisition.getItemDetail());//项目描述
                oaNotifyMaterial.setProjectDefinition(pickingRequisition.getProjectDefinition());//项目定义
                oaNotifyMaterial.setMaterialCode(pickingRequisition.getMaterialCode());//物料
                oaNotifyMaterial.setMaterialDescription(pickingRequisition.getMaterialDescription());//物料描述
                oaNotifyMaterial.setMeasuringUnit(pickingRequisition.getMeasuringUnit());//计量单位
                oaNotifyMaterial.setQuantityDemanded(pickingRequisition.getQuantityDemanded());//需求数量
                oaNotifyMaterial.setQuantityDelivered(pickingRequisition.getQuantityDelivered());//已经出库数量
                oaNotifyMaterial.setStockNumber(pickingRequisition.getStockNumber());//非限制型库存数量
                oaNotifyMaterials.add(oaNotifyMaterial);//添加进集合中
            }
        }
        return oaNotifyMaterials;
    }
    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 缺货信息2
     */
    public static List<OaNotifyMaterial> getYesStock1(List<PickingRequisition> pickingRequisitions){
        ArrayList<OaNotifyMaterial> oaNotifyMaterials = new ArrayList<OaNotifyMaterial>();
        OaNotifyMaterial oaNotifyMaterial = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            if (pickingRequisition.getWhetherStock()==1.0){
                oaNotifyMaterial = new OaNotifyMaterial();
                oaNotifyMaterial.setMaterialCode(pickingRequisition.getMaterialCode());//物料
                oaNotifyMaterial.setMaterialDescription(pickingRequisition.getMaterialDescription());//物料描述
                oaNotifyMaterial.setMeasuringUnit(pickingRequisition.getMeasuringUnit());//计量单位
                oaNotifyMaterial.setQuantityDemanded(pickingRequisition.getQuantityDemanded());//需求数量
                oaNotifyMaterial.setQuantityDelivered(pickingRequisition.getQuantityDelivered());//已经出库数量
                oaNotifyMaterial.setStockNumber(pickingRequisition.getStockNumber());//非限制型库存数量
                oaNotifyMaterials.add(oaNotifyMaterial);//添加进集合中
            }
        }
        return oaNotifyMaterials;
    }

    //根据物料编码和物料描述进行去重
    public static List<PickingRequisition> getDuplicateRemoval2(List<PickingRequisition> pickingRequisitions){
        ArrayList<PickingRequisition> pickingDuplicates = new ArrayList<PickingRequisition>();
        boolean flag = true;//去重开关：判断是否存在重复
        double quantityDemanded; //需求数量
        double quantityDelivered; //已出库数量
        PickingRequisition requisition = null;
        for (PickingRequisition pickingRequisition:pickingRequisitions){
            flag = true;
            for (PickingRequisition pickingDuplicate:pickingDuplicates){
                if (pickingRequisition.getMaterialCode().equals(pickingDuplicate.getMaterialCode())
                    &&pickingRequisition.getMaterialDescription().equals(pickingDuplicate.getProjectDefinition())) {
                    //需求数量
                    quantityDemanded = pickingRequisition.getQuantityDemanded()+pickingDuplicate.getQuantityDemanded();
                    //已经出库数量
                    quantityDelivered = pickingRequisition.getQuantityDelivered()+pickingDuplicate.getQuantityDelivered();
                    //保存合并的需求数量
                    pickingDuplicate.setQuantityDemanded(quantityDemanded);
                    //保存合并的已经出库数量
                    pickingDuplicate.setQuantityDelivered(quantityDelivered);
                    flag = false;
                    break;
                }
            }
            if (flag){
                requisition = new PickingRequisition();
                requisition.setMaterialCode(pickingRequisition.getMaterialCode());//物料编码
                requisition.setMaterialDescription(pickingRequisition.getMaterialDescription());//物料描述
                requisition.setMeasuringUnit(pickingRequisition.getMeasuringUnit());//计量单位
                requisition.setQuantityDemanded(pickingRequisition.getQuantityDemanded());//需求数量
                requisition.setQuantityDelivered(pickingRequisition.getQuantityDelivered());//已经出库数量
                requisition.setStockNumber(pickingRequisition.getStockNumber());//非限制性库存数量
                requisition.setWhetherStock(pickingRequisition.getWhetherStock());//记录缺货状态
                pickingDuplicates.add(requisition);
            }
        }
        return pickingDuplicates;
    }


    /*
        判断是否超过当前时间
     */
    public static Integer getJudgeDate(ProjectAcquisition projectAcquisition){
        Date date1 = new Date(System.currentTimeMillis());//获取系统时间
        long days = (date1.getTime() - projectAcquisition.getAuditTime().getTime())/1000/3600/24;
        if (days>=3){
            return 1;
        }
        return 0;
    }
    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 缺货信息2
     */
//    public static String getYesStock11(List<PickingRequisition> pickingRequisitions){
//        String yesStock1 = "";
//        List<PickingRequisition> duplicateRemoval2 = getDuplicateRemoval2(pickingRequisitions);
//        for (PickingRequisition pickingRequisition:duplicateRemoval2){
//            if (pickingRequisition.getWhetherStock()==1.0){
//                yesStock1+="【物料："+pickingRequisition.getMaterialCode()
//                        +";物料描述:"+pickingRequisition.getMaterialDescription()+";计量单位:"+pickingRequisition.getMeasuringUnit()
//                        +";需求数量:"+pickingRequisition.getQuantityDemanded()+";已出库数量:"+pickingRequisition.getQuantityDelivered()
//                        +";非限制性库存数量:"+pickingRequisition.getStockNumber()+"】\n";
//            }
//        }
//        return yesStock1;
//    }
    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 非缺货信息1
     */
//    public static String getNoStock1(List<PickingRequisition> pickingRequisitions){
//        String noStock = "";
//        for (PickingRequisition pickingRequisition:pickingRequisitions){
//            if (pickingRequisition.getWhetherStock()==0.0){
//                noStock+="【项目描述："+pickingRequisition.getItemDetail()+";项目定义："+pickingRequisition.getProjectDefinition()+";物料："+pickingRequisition.getMaterialCode()
//                        +";物料描述:"+pickingRequisition.getMaterialDescription()+";计量单位:"+pickingRequisition.getMeasuringUnit()
//                        +";需求数量:"+pickingRequisition.getQuantityDemanded()+";已出库数量:"+pickingRequisition.getQuantityDelivered()
//                        +";非限制性库存数量:"+pickingRequisition.getStockNumber()+"】\n";
//            }
//        }
//        return noStock;
//    }
    /**
     * @param pickingRequisitions 所有缺货和未缺货信息的登记
     * @return 缺货信息3
     */
//    public static String getYesStock21(List<PickingRequisition> pickingRequisitions){
//        String yesStock2 = "";
//        for (PickingRequisition pickingRequisition:pickingRequisitions){
//            if (pickingRequisition.getWhetherStock()==1.0){
//                yesStock2+="【项目描述："+pickingRequisition.getItemDetail()+";项目定义："+pickingRequisition.getProjectDefinition()+";物料："+pickingRequisition.getMaterialCode()
//                        +";物料描述:"+pickingRequisition.getMaterialDescription()+";计量单位:"+pickingRequisition.getMeasuringUnit()
//                        +";需求数量:"+pickingRequisition.getQuantityDemanded()+";已出库数量:"+pickingRequisition.getQuantityDelivered()
//                        +";非限制性库存数量:"+pickingRequisition.getStockNumber()+"】\n";
//            }
//        }
//        return yesStock2;
//    }
}
