public void Update(AscmWmsLogisticsMainLog ascmWmsLogisticsMainLog)
        {
            try
            {
                AscmWmsLogisticsMainLog _ascmWmsLogisticsMainLog = Get(ascmWmsLogisticsMainLog.id);
                _ascmWmsLogisticsMainLog.returnCode    = ascmWmsLogisticsMainLog.returnCode;
                _ascmWmsLogisticsMainLog.returnMessage = ascmWmsLogisticsMainLog.returnMessage;

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update(_ascmWmsLogisticsMainLog);

                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("更新失败(Update AscmWmsLogisticsMainLog)", ex);
                throw ex;
            }
        }
        public AscmWmsLogisticsMainLog Create()
        {
            AscmWmsLogisticsMainLog ascmWmsLogisticsMainLog = new AscmWmsLogisticsMainLog();
            int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmWmsLogisticsMainLog");

            ascmWmsLogisticsMainLog.id            = ++maxId;
            ascmWmsLogisticsMainLog.createTime    = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
            ascmWmsLogisticsMainLog.modifyTime    = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
            ascmWmsLogisticsMainLog.returnCode    = AscmWmsLogisticsMainLog.ReturnCodeDefine.correct;
            ascmWmsLogisticsMainLog.returnMessage = "领料成功";

            return(ascmWmsLogisticsMainLog);
        }
        public AscmWmsLogisticsMainLog Get(int id)
        {
            AscmWmsLogisticsMainLog ascmWmsLogisticsMainLog = null;

            try
            {
                ascmWmsLogisticsMainLog = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmWmsLogisticsMainLog>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmWmsLogisticsMainLog)", ex);
                throw ex;
            }
            return(ascmWmsLogisticsMainLog);
        }
        public void Save(AscmWmsLogisticsMainLog wmsLogisticsMainLog, List <WmsAndLogistics> listWmsAndLogistics)
        {
            try
            {
                int maxId_Detail = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmWmsLogisticsDetailLog");
                List <AscmWmsLogisticsDetailLog> listWmsLogisticsDetailLog = new List <AscmWmsLogisticsDetailLog>();
                foreach (WmsAndLogistics wmsAndLogistics in listWmsAndLogistics)
                {
                    AscmWmsLogisticsDetailLog wmsLogisticsDetailLog = new AscmWmsLogisticsDetailLog();
                    wmsLogisticsDetailLog.id                = ++maxId_Detail;
                    wmsLogisticsDetailLog.mainId            = wmsLogisticsMainLog.id;
                    wmsLogisticsDetailLog.wipEntityId       = wmsAndLogistics.wipEntityId;
                    wmsLogisticsDetailLog.materialId        = wmsAndLogistics.materialId;
                    wmsLogisticsDetailLog.quantity          = wmsAndLogistics.quantity;
                    wmsLogisticsDetailLog.preparationString = wmsAndLogistics.preparationString;
                    wmsLogisticsDetailLog.workerId          = wmsAndLogistics.workerId;
                    listWmsLogisticsDetailLog.Add(wmsLogisticsDetailLog);
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(wmsLogisticsMainLog);
                        YnDaoHelper.GetInstance().nHibernateHelper.SaveList(listWmsLogisticsDetailLog);

                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWmsLogisticsMainLog)", ex);
                throw ex;
            }
        }