Exemple #1
0
 public void Update(AscmDriver ascmDriver)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmDriver>(ascmDriver);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmDriver)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmDriver)", ex);
         throw ex;
     }
 }
Exemple #2
0
 public void Delete(AscmDriver ascmDriver)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmDriver>(ascmDriver);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmDriver)", ex);
         throw ex;
     }
 }
Exemple #3
0
 public void Delete(int id)
 {
     try
     {
         AscmDriver ascmDriver = Get(id);
         Delete(ascmDriver);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //忙时:根据司机RFID,显示供应商名称、预约送货时间(最早、预约)、卸货点
 public void GetLedBusyTimeShow(string driverRfid)
 {
     if (!string.IsNullOrEmpty(driverRfid))
     {
         AscmDriver ascmDriver = AscmDriverService.GetInstance().GetByDriverSn(driverRfid);
         if (ascmDriver != null)
         {
             string supplierName = ascmDriver.supplierName;
             string plateNumber  = ascmDriver.plateNumber;
         }
     }
 }
Exemple #5
0
        public AscmDriver Get(int id)
        {
            AscmDriver ascmDriver = null;

            try
            {
                ascmDriver = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmDriver>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmDriver)", ex);
                throw ex;
            }
            return(ascmDriver);
        }
Exemple #6
0
        public AscmDriver GetByDriverSn(string driverSn)
        {
            AscmDriver ascmDriver = null;

            try
            {
                string             sql   = "from AscmDriver where sn='" + driverSn + "'";
                IList <AscmDriver> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDriver>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    //list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmDriver>(ilist);
                    ascmDriver = ilist[0];
                    SetSupplier(new List <AscmDriver> {
                        ascmDriver
                    });
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDriver)", ex);
                throw ex;
            }
            return(ascmDriver);
        }
Exemple #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;
            }
        }