Пример #1
0
 public void Update(AscmTruckSwipeLog ascmTruckSwipeLog)
 {
     //int count = YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmTruckSwipeLog where id<>" + ascmTruckSwipeLog.id + " and docNumber='" + ascmTruckSwipeLog.docNumber + "'");
     //if (count == 0)
     //{
     //    using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     //    {
     //        try
     //        {
     //            YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmTruckSwipeLog>(ascmTruckSwipeLog);
     //            tx.Commit();//正确执行提交
     //        }
     //        catch (Exception ex)
     //        {
     //            tx.Rollback();//回滚
     //            YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmTruckSwipeLog)", ex);
     //            throw ex;
     //        }
     //    }
     //}
     //else
     //{
     //    throw new Exception("已经存在员工编号\"" + ascmTruckSwipeLog.name + "\"!");
     //}
 }
Пример #2
0
 public void Delete(AscmTruckSwipeLog ascmTruckSwipeLog)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmTruckSwipeLog>(ascmTruckSwipeLog);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmTruckSwipeLog)", ex);
         throw ex;
     }
 }
Пример #3
0
 public void Delete(string id)
 {
     try
     {
         AscmTruckSwipeLog ascmTruckSwipeLog = Get(id);
         Delete(ascmTruckSwipeLog);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
        public AscmTruckSwipeLog Get(string id)
        {
            AscmTruckSwipeLog ascmTruckSwipeLog = null;

            try
            {
                ascmTruckSwipeLog = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmTruckSwipeLog>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmTruckSwipeLog)", ex);
                throw ex;
            }
            return(ascmTruckSwipeLog);
        }
Пример #5
0
        public void AddLog(int doorId, string readingHead, string rfid, int supplierId, int driverId, string supplierName, string driverName,
                           string plateNumber, bool pass, string description, DateTime createTime, string direction, int batSumMainId, string batSumDocNumber, bool onTime,
                           string appointmentStartTime, string appointmentEndTime)
        {
            try
            {
                AscmTruckSwipeLog ascmTruckSwipeLog = GetAddLog(doorId, readingHead, rfid, supplierId, driverId, supplierName, driverName,
                                                                plateNumber, pass, description, createTime, direction, batSumMainId, batSumDocNumber, onTime, appointmentStartTime, appointmentEndTime);

                Save(ascmTruckSwipeLog);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("增加失败(Add AscmTruckSwipeLog)", ex);
                throw ex;
            }
        }
Пример #6
0
        public AscmTruckSwipeLog GetAddLog(int doorId, string readingHead, string rfid, int supplierId, int driverId, string supplierName, string driverName,
                                           string plateNumber, bool pass, string description, DateTime createTime, string direction, int batSumMainId, string batSumDocNumber, bool onTime,
                                           string appointmentStartTime, string appointmentEndTime)
        {
            try
            {
                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmTruckSwipeLog");

                AscmTruckSwipeLog ascmTruckSwipeLog = new AscmTruckSwipeLog();
                ascmTruckSwipeLog.createTime = createTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmTruckSwipeLog.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");

                ascmTruckSwipeLog.doorId        = doorId;
                ascmTruckSwipeLog.readingHeadId = 0;
                ascmTruckSwipeLog.readingHead   = readingHead;
                ascmTruckSwipeLog.rfid          = rfid;
                ascmTruckSwipeLog.supplierId    = supplierId;
                ascmTruckSwipeLog.driverId      = driverId;
                ascmTruckSwipeLog.supplierName  = supplierName;
                ascmTruckSwipeLog.driverName    = driverName;
                ascmTruckSwipeLog.plateNumber   = plateNumber;

                ascmTruckSwipeLog.status      = 1;
                ascmTruckSwipeLog.pass        = pass;
                ascmTruckSwipeLog.direction   = direction;
                ascmTruckSwipeLog.description = description;

                ascmTruckSwipeLog.batSumMainId         = batSumMainId;
                ascmTruckSwipeLog.batSumDocNumber      = batSumDocNumber;
                ascmTruckSwipeLog.onTime               = onTime;
                ascmTruckSwipeLog.appointmentStartTime = appointmentStartTime;
                ascmTruckSwipeLog.appointmentEndTime   = appointmentEndTime;

                return(ascmTruckSwipeLog);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
 public void Save(AscmTruckSwipeLog ascmTruckSwipeLog)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmTruckSwipeLog);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmTruckSwipeLog)", ex);
         throw ex;
     }
 }
Пример #8
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;
            }
        }