コード例 #1
0
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client          = new MoldPartInfoServiceClient();
         MoldDynamicInfo           moldDynamicInfo = client.GetMoldDynamicInfoByMoldNR(moldNR);
         MoldDynamicInfoGrid.DataContext = moldDynamicInfo;
     }
 }
コード例 #2
0
        /// <summary>
        /// 根据模具号获得模具动态信息
        /// </summary>
        /// <param name="moldNR">模具号</param>
        /// <returns>模具基本信息</returns>
        public MoldDynamicInfo GetMoldDynamicInfoByMoldNR(string moldNR)
        {
            using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
            {
                IMoldRepository moldRepostitory = new MoldRepository(unitwork);

                MoldView moldview = moldRepostitory.GetMoldViewByMoldNR(moldNR);

                if (moldview == null)
                {
                    return(null);
                }


                IStorageRecordRepository storageRep    = new StorageRecordRepository(unitwork);
                StorageRecord            storageRecord = null;
                if (moldview.StorageRecordNR != null)
                {
                    storageRecord = storageRep.GetByStorageNR((Guid)moldview.StorageRecordNR);
                }

                MoldDynamicInfo moldDynamicInfo = new MoldDynamicInfo()
                {
                    CurrentPosition   = moldview.StorageRecordNR == null ? string.Empty : moldRepostitory.GetMoldCurrPosiByRecordNR((Guid)moldview.StorageRecordNR),
                    Operator          = storageRecord == null ? string.Empty : storageRecord.OperatorId,
                    OperateTime       = storageRecord == null ? string.Empty : storageRecord.Date.ToString(),
                    AllowedCuttedTime = moldview.MaxCuttimes,
                    CurrentCuttedTime = moldview.CurrentCuttimes,
                    ReleaseCycle      = moldview.ReleaseCycle,
                    LastReleasedTime  = moldview.LastReleasedDate.ToString(),
                    MantainCycle      = moldview.MaintainCycle,
                    LastMantainTime   = moldview.LastMainedDate.ToString(),
                    State             = moldview.State,
                    StateCN           = EnumUtil.GetEnumDescriptionByEnumValue(moldview.State),
                    ProjectId         = moldview.ProjectID,
                    ProjectName       = moldview.ProjectName
                };
                return(moldDynamicInfo);
            }
        }