コード例 #1
0
        public void SetDeliveryNotifyMain(List <AscmDeliveryOrderBatch> list)
        {
            if (list != null && list.Count > 0)
            {
                List <AscmDeliveryOrderDetail> listAscmDeliveryOrderDetail = AscmDeliveryOrderDetailService.GetInstance().GetListByBatch(list);
                AscmDeliveryOrderDetailService.GetInstance().SetMain(listAscmDeliveryOrderDetail);
                foreach (AscmDeliveryOrderBatch deliveryOrderBatch in list)
                {
                    List <AscmDeliveryNotifyMain> listAscmDeliveryNotifyMain = new List <AscmDeliveryNotifyMain>();

                    foreach (AscmDeliveryOrderDetail ascmDeliveryOrderDetail in listAscmDeliveryOrderDetail)
                    {
                        if (ascmDeliveryOrderDetail.ascmDeliveryOrderMain == null || ascmDeliveryOrderDetail.ascmDeliveryOrderMain.batchId != deliveryOrderBatch.id)
                        {
                            continue;
                        }
                        if (ascmDeliveryOrderDetail.ascmDeliveryNotifyDetail != null && ascmDeliveryOrderDetail.ascmDeliveryNotifyDetail.ascmDeliveryNotifyMain != null)
                        {
                            listAscmDeliveryNotifyMain.Add(ascmDeliveryOrderDetail.ascmDeliveryNotifyDetail.ascmDeliveryNotifyMain);
                        }
                    }
                    string appointmentStartTime = "", appointmentEndTime = "";
                    AscmDeliBatSumMainService.GetInstance().GetAppointmentTimeOriginal(listAscmDeliveryNotifyMain, ref appointmentStartTime, ref appointmentEndTime);
                    deliveryOrderBatch.appointmentStartTime = appointmentStartTime;
                    deliveryOrderBatch.appointmentEndTime   = appointmentEndTime;
                }
            }
        }
コード例 #2
0
        public List <AscmPalletDelivery> GetCurrentList(string containerSn)
        {
            List <AscmPalletDelivery> list = null;

            try
            {
                //string sort = " order by sn ";

                string sql = "from AscmPalletDelivery where containerSn='" + containerSn + "' order by id desc";

                IList <AscmPalletDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmPalletDelivery>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    AscmDeliBatSumMain ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(ilist[0].batSumMainId);
                    if (ascmDeliBatSumMain != null && ascmDeliBatSumMain.status == AscmDeliBatSumMain.StatusDefine.outPlant)
                    {
                        sql   = "from AscmPalletDelivery where batSumMainId =" + ilist[0].batSumMainId + "  and containerSn='" + containerSn + "'";
                        ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmPalletDelivery>(sql);
                        if (ilist != null)
                        {
                            list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmPalletDelivery>(ilist);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmPalletDelivery)", ex);
                throw ex;
            }
            return(list);
        }
コード例 #3
0
        public CurrentDeliBatSum GetCurrentDeliBatSum(string warehouseId = "W312材料")
        {
            CurrentDeliBatSum currentDeliBatSum = new CurrentDeliBatSum();
            string            status            = AscmDeliBatSumMain.StatusDefine.inPlant;

            try
            {
                AscmContainerDelivery ascmContainerDelivery = AscmContainerDeliveryService.GetInstance().GetCurrent(warehouseId);
                if (ascmContainerDelivery == null)
                {
                    return(null);
                }
                //string whereOther = " warehouseId='" + warehouseId + "' and status='" + status + "' and id in (select batSumMainId from AscmContainerDelivery where )";
                string whereOther = " id=" + ascmContainerDelivery.batSumMainId;
                List <AscmDeliBatSumMain> listAscmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().GetList("id", "desc", "", whereOther);
                if (listAscmDeliBatSumMain != null && listAscmDeliBatSumMain.Count() > 0)
                {
                    AscmDeliBatSumMain ascmDeliBatSumMain = listAscmDeliBatSumMain[0];// listAscmDeliBatSumMain.OrderByDescending(item => item.toPlantTime).First();
                    currentDeliBatSum.supplierName               = ascmDeliBatSumMain.ascmSupplier.ascmSupplierAddress.vendorSiteCode;
                    currentDeliBatSum.deliBatSumNo               = ascmDeliBatSumMain.docNumber;
                    currentDeliBatSum.containerNumber            = ascmDeliBatSumMain.containerNumber;
                    currentDeliBatSum.toPlantTime                = ascmContainerDelivery.modifyTime;
                    currentDeliBatSum.inWarehouseContainerNumber = ascmDeliBatSumMain.inWarehouseContainerNumber;
                    List <AscmDeliBatSumDetail>  listAscmDeliBatSumDetail  = AscmDeliBatSumDetailService.GetInstance().GetListByMainId(ascmDeliBatSumMain.id);
                    List <AscmContainerDelivery> listAscmContainerDelivery = AscmContainerDeliveryService.GetInstance().GetListByDeliverySumMainId(ascmDeliBatSumMain.id);
                    listAscmContainerDelivery = listAscmContainerDelivery.Where(item => item.status == AscmContainerDelivery.StatusDefine.inWarehouseDoor).ToList();
                    if (listAscmDeliBatSumDetail != null && listAscmDeliBatSumDetail.Count() > 0)
                    {
                        List <CurrentDeliBatSumList> listCurrentDeliBatSumList = new List <CurrentDeliBatSumList>();
                        foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in listAscmDeliBatSumDetail)
                        {
                            CurrentDeliBatSumList currentDeliBatSumList = new CurrentDeliBatSumList();
                            currentDeliBatSumList.batchDocNumber    = ascmDeliBatSumDetail.batchDocNumber;
                            currentDeliBatSumList.materialDocNumber = ascmDeliBatSumDetail.materialDocNumber;
                            currentDeliBatSumList.materialName      = ascmDeliBatSumDetail.materialDescription;
                            currentDeliBatSumList.totalNumber       = ascmDeliBatSumDetail.totalNumber;
                            if (listAscmContainerDelivery != null && listAscmContainerDelivery.Count() > 0)
                            {
                                List <AscmContainerDelivery> vList = listAscmContainerDelivery.Where(item => item.deliveryOrderBatchId == ascmDeliBatSumDetail.batchId && item.materialId == ascmDeliBatSumDetail.materialId).ToList();
                                if (vList != null && vList.Count() > 0)
                                {
                                    currentDeliBatSumList.receiveNumber = vList.Sum(item => item.quantity);
                                }
                            }
                            listCurrentDeliBatSumList.Add(currentDeliBatSumList);
                        }
                        currentDeliBatSum.list = listCurrentDeliBatSumList;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(currentDeliBatSum);
        }
コード例 #4
0
        public List <AscmContainerDelivery> GetCurrentList(string containerSn, string sessionKey)
        {
            List <AscmContainerDelivery> list = null;

            try
            {
                string sort = " order by id desc ";

                string sql = "from AscmContainerDelivery where containerSn='" + containerSn + "'";

                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql);
                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                IList <AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerDelivery>(sql + sort, sql, ynPage, sessionKey);
                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql, sessionKey);
                if (ilist != null && ilist.Count > 0)
                {
                    foreach (AscmContainerDelivery ascmContainerDelivery in ilist)
                    {
                        ascmContainerDelivery.ascmDeliBatSumMain     = AscmDeliBatSumMainService.GetInstance().Get(ascmContainerDelivery.batSumMainId, sessionKey);
                        ascmContainerDelivery.ascmDeliveryOrderBatch = AscmDeliveryOrderBatchService.GetInstance().Get(ascmContainerDelivery.deliveryOrderBatchId, sessionKey);
                    }
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmContainerDelivery>(ilist);
                    //AscmDeliBatSumMain ascmDeliBatSumMain = YnDaoHelper.GetInstance().nHibernateHelper.Get<AscmDeliBatSumMain>(ilist[0].batSumMainId, sessionKey);
                    //if (ascmDeliBatSumMain != null && (ascmDeliBatSumMain.status == AscmDeliBatSumMain.StatusDefine.outPlant || ascmDeliBatSumMain.status == AscmDeliBatSumMain.StatusDefine.confirm))
                    //{
                    //    sql = "from AscmContainerDelivery where batSumMainId =" + ilist[0].batSumMainId + "  and containerSn='" + containerSn + "'";
                    //    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql, sessionKey);
                    //    if (ilist != null)
                    //    {
                    //        list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmContainerDelivery>(ilist);
                    //    }
                    //}
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainerDelivery)", ex);
                throw ex;
            }
            return(list);
        }
コード例 #5
0
ファイル: AscmDriverService.cs プロジェクト: wuhuayun/Midea
        //车辆入厂
        public void InOutPlant(int doorId, string readingHead, int driverId, bool inPlant, string direction, bool onTime, ref string allocateOutDoor)
        {
            try
            {
                AscmDriver ascmDriver = Get(driverId);
                if (ascmDriver != null)
                {
                    int    batSumMainId         = 0;
                    string batSumDocNumber      = string.Empty;
                    string appointmentStartTime = string.Empty;
                    string appointmentEndTime   = string.Empty;

                    SetSupplier(new List <AscmDriver> {
                        ascmDriver
                    });

                    List <AscmDeliBatSumMain> list = AscmDeliBatSumMainService.GetInstance().GetByDriverId(ascmDriver.id);
                    if (list != null)
                    {
                        foreach (AscmDeliBatSumMain ascmDeliBatSumMain in list)
                        {
                            if (inPlant)
                            {
                                ascmDeliBatSumMain.status          = AscmDeliBatSumMain.StatusDefine.inPlant;
                                ascmDeliBatSumMain.toPlantTime     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                ascmDeliBatSumMain.allocateOutDoor = "北门";
                                if (ascmDeliBatSumMain.warehouseId != "W112材料")
                                {
                                    #region 取上一次送货合单
                                    YnPage ynPage = new YnPage();
                                    ynPage.SetPageSize(1);
                                    ynPage.SetCurrentPage(1);
                                    //string sort = " order by toPlantTime desc ";
                                    string where = " toPlantTime is not null and status='" + AscmDeliBatSumMain.StatusDefine.inPlant + "'";
                                    List <AscmDeliBatSumMain> listAscmDeliBatSumMainPreviousInPlant = AscmDeliBatSumMainService.GetInstance().GetList(ynPage, "toPlantTime", "desc", where);
                                    if (listAscmDeliBatSumMainPreviousInPlant != null && listAscmDeliBatSumMainPreviousInPlant.Count > 0)
                                    {
                                        AscmDeliBatSumMain ascmDeliBatSumMain_tmp = listAscmDeliBatSumMainPreviousInPlant[0];
                                        if (ascmDeliBatSumMain_tmp.allocateOutDoor == "北门")
                                        {
                                            ascmDeliBatSumMain.allocateOutDoor = "西门";
                                        }
                                    }
                                    #endregion
                                }
                                batSumMainId         = ascmDeliBatSumMain.id;
                                batSumDocNumber      = ascmDeliBatSumMain.docNumber;
                                appointmentStartTime = ascmDeliBatSumMain.appointmentStartTime;
                                appointmentEndTime   = ascmDeliBatSumMain.appointmentEndTime;
                                allocateOutDoor      = ascmDeliBatSumMain.allocateOutDoor;
                            }
                            else
                            {
                            }

                            DateTime          createTime        = DateTime.Now;
                            string            description       = ascmDriver.supplierName + ":" + ascmDriver.name + ":" + ascmDriver.plateNumber;
                            AscmTruckSwipeLog ascmTruckSwipeLog = AscmTruckSwipeLogService.GetInstance().GetAddLog(doorId, readingHead, ascmDriver.rfid, ascmDriver.supplierId, driverId,
                                                                                                                   ascmDriver.supplierName, ascmDriver.name, ascmDriver.plateNumber, true, description, createTime, direction, batSumMainId, batSumDocNumber,
                                                                                                                   onTime, appointmentStartTime, appointmentEndTime);
                            using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                            {
                                try
                                {
                                    if (ascmTruckSwipeLog != null)
                                    {
                                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmTruckSwipeLog);
                                    }
                                    if (ascmDeliBatSumMain != null)
                                    {
                                        YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmDeliBatSumMain);
                                    }
                                    tx.Commit();//正确执行提交
                                }
                                catch (Exception ex)
                                {
                                    tx.Rollback();//回滚
                                    throw ex;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //提取数据
                int    id = 0;
                string containerSpAndQuantity = "";
                //出货子库
                string supplyWarehouse = "";
                //送货地点
                string                      deliveryPlace            = "";
                AscmDeliBatSumMain          ascmDeliBatSumMain       = new AscmDeliBatSumMain();
                List <AscmDeliBatSumDetail> listAscmDeliBatSumDetail = new List <AscmDeliBatSumDetail>();
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out id))
                {
                    //ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(id);
                    //ascmDeliBatSumMain.ascmSupplier = AscmSupplierService.GetInstance().Get(ascmDeliBatSumMain.supplierId);
                    //ascmDeliBatSumMain.ascmDriver = AscmDriverService.GetInstance().Get(ascmDeliBatSumMain.driverId);
                    //供方简称
                    string supplierShortName = "select vendorSiteCode from AscmSupplierAddress a where a.vendorSiteCodeAlt=s.docNumber and rownum=1";
                    //司机编号
                    string driverSn = "select sn from AscmDriver d where d.id=h.driverId";
                    string hql      = string.Format("select new AscmDeliBatSumMain(h,s.docNumber,({0}),({1})) from AscmDeliBatSumMain h,AscmSupplier s", supplierShortName, driverSn);
                    string where       = string.Empty;
                    where              = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "h.supplierId=s.id");
                    where              = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "h.id=" + id);
                    hql               += " where " + where;
                    ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(hql);

                    //List<AscmDeliBatSumDetail> list = AscmDeliBatSumDetailService.GetInstance().GetListByMainId(id);
                    //容器绑定数量
                    string containerBindNumber = "select sum(quantity) from AscmContainerDelivery where deliveryOrderBatchId=l.batchId and batSumMainId=l.mainId";
                    //容器数量
                    string containerNumber = "select count(distinct containerSn) from AscmContainerDelivery where deliveryOrderBatchId=l.batchId and batSumMainId=l.mainId";
                    hql   = string.Format("select new AscmDeliBatSumDetail(l,({0}),0M,0M,({1})) from AscmDeliBatSumDetail l", containerBindNumber, containerNumber);
                    where = string.Empty;
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, " mainId=" + id);
                    hql  += " where " + where;
                    List <AscmDeliBatSumDetail> list = AscmDeliBatSumDetailService.GetInstance().GetList(hql);
                    AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list, true);
                    AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);

                    string warehouseId  = Request.QueryString["warehouseId"];
                    string materialCode = Request.QueryString["materialCode"];

                    if (list != null && list.Count > 0)
                    {
                        //设置作业
                        AscmDeliBatSumDetailService.GetInstance().SetWipEntityName(list);
                        supplyWarehouse = list.Where(P => !string.IsNullOrEmpty(P.batchSupperWarehouse)).FirstOrDefault().batchSupperWarehouse;
                        deliveryPlace   = list.Where(P => !string.IsNullOrEmpty(P.batchWipLine)).FirstOrDefault().batchWipLine;

                        string containerSns = "";
                        bool   isWarehouseId = true, isMaterialCode = true;
                        List <AscmContainerDelivery> listAscmContainerDelivery = AscmContainerDeliveryService.GetInstance().GetListByDeliverySumMainId(id, false);
                        List <AscmContainerDelivery> _listAscmContainerDelivery = new List <AscmContainerDelivery>();
                        foreach (AscmDeliBatSumDetail detail in list)
                        {
                            isWarehouseId = isMaterialCode = true;
                            if (warehouseId != null && warehouseId.Trim() != "")
                            {
                                isWarehouseId = detail.batchWarehouseId == warehouseId.Trim();
                            }
                            if (materialCode != null && materialCode.Trim() != "")
                            {
                                isMaterialCode = !string.IsNullOrEmpty(detail.materialDocNumber) && detail.materialDocNumber.Substring(0, 4) == materialCode.Trim();
                            }
                            if (isWarehouseId && isMaterialCode)
                            {
                                listAscmDeliBatSumDetail.Add(detail);
                                if (listAscmContainerDelivery != null)
                                {
                                    foreach (AscmContainerDelivery delivery in listAscmContainerDelivery)
                                    {
                                        if (delivery.deliveryOrderBatchId == detail.batchId && delivery.materialId == detail.materialId)
                                        {
                                            if (containerSns != "")
                                            {
                                                containerSns += ",";
                                            }
                                            containerSns += "'" + delivery.containerSn + "'";
                                            _listAscmContainerDelivery.Add(delivery);
                                        }
                                    }
                                }
                            }
                        }
                        if (containerSns != "")
                        {
                            List <AscmContainer> listAscmContainer = AscmContainerService.GetInstance().GetList("from AscmContainer where sn in(" + containerSns + ")", false, true);
                            var groupByAscmContainerSpec           = listAscmContainer.GroupBy(P => P.spec);
                            foreach (IGrouping <string, AscmContainer> igSpec in groupByAscmContainerSpec)
                            {
                                int specCount = 0;
                                foreach (AscmContainer ascmContainer in igSpec)
                                {
                                    specCount += _listAscmContainerDelivery.Where(p => p.containerSn == ascmContainer.sn).Select(item => item.containerSn).Distinct().Count();
                                }
                                if (containerSpAndQuantity != "")
                                {
                                    containerSpAndQuantity += " ";
                                }
                                containerSpAndQuantity +=
                                    string.Format("{0}:{1}", igSpec.Key, specCount);
                            }
                        }

                        int i = 0;
                        listAscmDeliBatSumDetail = listAscmDeliBatSumDetail.OrderBy(P => P.batchBarCode).ToList();
                        foreach (AscmDeliBatSumDetail detail in listAscmDeliBatSumDetail)
                        {
                            detail.barcode     = ascmDeliBatSumMain.docNumber + (Math.Floor(i / 7M) + 1);
                            detail.barcodeShow = Code.BarCode128.GetBarcode(detail.barcode);
                            i++;
                        }
                    }
                }

                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = listAscmDeliBatSumDetail;
                ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title         = companpyTitle + "供应商送货合单";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_Title", title),
                    new ReportParameter("ReportParameter_ReportTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm")),
                    new ReportParameter("ReportParameter_SupplierName", ascmDeliBatSumMain.supplierNameCn),
                    new ReportParameter("ReportParameter_SupplierDocNumber", ascmDeliBatSumMain.supplierDocNumberCn),
                    new ReportParameter("ReportParameter_DocNumber", ascmDeliBatSumMain.docNumber),
                    new ReportParameter("ReportParameter_DriverSn", ascmDeliBatSumMain.driverSnCn),
                    new ReportParameter("ReportParameter_DriverPlateNumber", ascmDeliBatSumMain.driverPlateNumber),
                    new ReportParameter("ReportParameter_DeliveryPlace", deliveryPlace),
                    new ReportParameter("ReportParameter_AppointmentStartTime", ascmDeliBatSumMain.appointmentStartTimeShow),
                    new ReportParameter("ReportParameter_AppointmentEndTime", ascmDeliBatSumMain.appointmentEndTimeShow),
                    new ReportParameter("ReportParameter_Status", ascmDeliBatSumMain.statusCn),
                    new ReportParameter("ReportParameter_Warehouse", ascmDeliBatSumMain.warehouseId),
                    new ReportParameter("ReportParameter_SupplyWarehouse", supplyWarehouse),
                    new ReportParameter("ReportParameter_ContainerSpAndQuantity", containerSpAndQuantity)
                };
                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
コード例 #7
0
        /// <summary>入库实时校验</summary>
        public DeliBatSumCheckIn Get(string warehouseId = "W312材料")
        {
            DeliBatSumCheckIn deliBatSumCheckIn = new DeliBatSumCheckIn();

            if (!string.IsNullOrWhiteSpace(warehouseId))
            {
                try
                {
                    string hql = "from AscmContainerDelivery";
                    string where = string.Empty;
                    where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "status='" + AscmContainerDelivery.StatusDefine.inWarehouseDoor + "'");
                    where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "batSumMainId in (select id from AscmDeliBatSumMain where warehouseId='" + warehouseId + "')");
                    where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "modifyTime is not null");
                    hql         += " where " + where;
                    string sort = " order by modifyTime desc ";
                    IList <AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.FindTop <AscmContainerDelivery>(hql + sort, 1);
                    if (ilist != null && ilist.Count > 0)
                    {
                        AscmContainerDelivery containerDelivery = ilist[0];
                        //供方简称
                        string supplierShortName = "select vendorSiteCode from AscmSupplierAddress a where a.vendorSiteCodeAlt=s.docNumber and rownum=1";
                        hql   = string.Format("select new AscmDeliBatSumMain(h.id,h.docNumber,({0})) from AscmDeliBatSumMain h,AscmSupplier s", supplierShortName);
                        where = string.Empty;
                        where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "h.supplierId=s.id");
                        where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "h.id=" + containerDelivery.batSumMainId);
                        hql  += " where " + where;
                        AscmDeliBatSumMain main = AscmDeliBatSumMainService.GetInstance().Get(hql);
                        if (main != null)
                        {
                            deliBatSumCheckIn.docNumber         = main.docNumber;
                            deliBatSumCheckIn.supplierShortName = main.supplierNameCn;
                            deliBatSumCheckIn.containerCheckIns = new List <ContainerCheckIn>();
                            deliBatSumCheckIn.checkTime         = containerDelivery.modifyTime;
                            deliBatSumCheckIn.warelocations     = new List <string>();

                            //容器
                            hql   = "select new AscmContainerDelivery(acd.containerSn,acd.status,acs.spec) from AscmContainerDelivery acd,AscmContainer ac,AscmContainerSpec acs";
                            where = string.Empty;
                            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "acd.containerSn=ac.sn");
                            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "ac.specId=acs.id");
                            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "acd.batSumMainId=" + main.id);
                            hql  += " where " + where;
                            IList <AscmContainerDelivery> ilist2 = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerDelivery>(hql);
                            if (ilist2 != null && ilist2.Count > 0)
                            {
                                var result = ilist2.GroupBy(P => P.containerSpec);
                                foreach (IGrouping <string, AscmContainerDelivery> ig in result)
                                {
                                    ContainerCheckIn containerCheckIn = new ContainerCheckIn();
                                    containerCheckIn.spec          = ig.Key;
                                    containerCheckIn.quantity      = ig.GroupBy(P => P.containerSn).Count();
                                    containerCheckIn.checkQuantity = ig.Where(P => P.status == AscmContainerDelivery.StatusDefine.inWarehouseDoor).GroupBy(P => P.containerSn).Count();
                                    deliBatSumCheckIn.containerCheckIns.Add(containerCheckIn);
                                }
                            }

                            //货位指引
                            string sql             = "select distinct materialid from ascm_deli_bat_sum_detail where mainid=" + main.id;
                            IList  ilistMaterialId = YnDaoHelper.GetInstance().nHibernateHelper.ExecuteReader(sql);
                            foreach (object[] item in ilistMaterialId)
                            {
                                if (item != null && item.Length > 0 && !string.IsNullOrEmpty(item[0].ToString()))
                                {
                                    sql = "select buildingarea from ascm_warelocation"
                                          + " where warehouseid='" + warehouseId + "'"
                                          + "   and (id in(select warelocationId from ascm_location_material_link where materialid=" + item[0].ToString() + ") or categoryCode='0000')"
                                          + "   and rownum=1";
                                    object obj = YnDaoHelper.GetInstance().nHibernateHelper.GetObjectBySQL(sql);
                                    if (obj != null && !string.IsNullOrEmpty(obj.ToString()) && !deliBatSumCheckIn.warelocations.Contains(obj.ToString()))
                                    {
                                        deliBatSumCheckIn.warelocations.Add(obj.ToString());
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(deliBatSumCheckIn);
        }