Beispiel #1
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);
        }
Beispiel #2
0
        public AscmContainerDelivery GetCurrent(string warehouseId)
        {
            AscmContainerDelivery ascmContainerDelivery = null;

            try
            {
                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                string sort = " order by modifyTime desc ";
                string sql  = "from AscmContainerDelivery where status='" + AscmContainerDelivery.StatusDefine.inWarehouseDoor + "' and  batSumMainId in (select id from AscmDeliBatSumMain where warehouseId='" + warehouseId + "') and modifyTime is not null";
                IList <AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerDelivery>(sql + sort, sql, ynPage);
                if (ilist != null && ilist.Count > 0)
                {
                    return(ilist[0]);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainerDelivery)", ex);
                throw ex;
            }
            return(ascmContainerDelivery);
        }
        public AscmWmsContainerDelivery GetCurrent(string containerSn, string sessionKey)
        {
            try
            {
                string sort = " order by id desc ";
                string sql  = "from AscmWmsContainerDelivery where containerSn='" + containerSn + "' and (status is null or status='') and createTime>='" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00") + "'";

                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                IList <AscmWmsContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsContainerDelivery>(sql + sort, sql, ynPage, sessionKey);
                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql, sessionKey);
                if (ilist != null && ilist.Count > 0)
                {
                    return(ilist[0]);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWmsContainerDelivery)", ex);
                throw ex;
            }
            return(null);
        }
Beispiel #4
0
        //车辆入厂
        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;
            }
        }
        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;
        }
 public AscmContainerDelivery GetCurrent(string warehouseId)
 {
     AscmContainerDelivery ascmContainerDelivery = null;
     try
     {
         YnPage ynPage = new YnPage();
         ynPage.SetPageSize(1);
         ynPage.SetCurrentPage(1);
         string sort = " order by modifyTime desc ";
         string sql = "from AscmContainerDelivery where status='" + AscmContainerDelivery.StatusDefine.inWarehouseDoor + "' and  batSumMainId in (select id from AscmDeliBatSumMain where warehouseId='" + warehouseId + "') and modifyTime is not null";
         IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql + sort, sql, ynPage);
         if (ilist != null && ilist.Count>0)
         {
             return ilist[0];
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainerDelivery)", ex);
         throw ex;
     }
     return ascmContainerDelivery;
 }
Beispiel #7
0
        //车辆入厂
        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;
            }
        }
        public AscmWmsContainerDelivery GetCurrent(string containerSn, string sessionKey)
        {
            try
            {
                string sort = " order by id desc ";
                string sql = "from AscmWmsContainerDelivery where containerSn='" + containerSn + "' and (status is null or status='') and createTime>='" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00") + "'";

                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                IList<AscmWmsContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWmsContainerDelivery>(sql + sort, sql, ynPage, sessionKey);
                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql, sessionKey);
                if (ilist != null && ilist.Count > 0)
                {
                    return ilist[0];
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWmsContainerDelivery)", ex);
                throw ex;
            }
            return null;
        }