예제 #1
0
        //删除
        private void MenuDelete_Click(object sender, RoutedEventArgs e)
        {
            if (this.treeList.SelectedItem == null)
            {
                return;
            }

            RsBom        m_RsBom = this.treeList.SelectedItem as RsBom;
            List <RsBom> d_RsBom = _RSMService.UseService(s => s.GetRsBoms("")).Where(c => c.PARENT_PKNO == m_RsBom.PKNO)
                                   .ToList();

            System.Windows.Forms.MessageBox.Show("是否删除该BOM与子项?", "删除BOM", MessageBoxButtons.OKCancel,
                                                 MessageBoxIcon.Warning);
            foreach (RsBom item in d_RsBom)
            {
                _RSMService.UseService(s => s.DelRsBom(item.PKNO));
            }

            bool isSuccss = _RSMService.UseService(s => s.DelRsBom(m_RsBom.PKNO));

            if (!isSuccss)
            {
                return;
            }

            Initialize();
        }
예제 #2
0
 /// <summary>
 /// 根据关键字段的值获取记录
 /// </summary>
 /// <param name="Id">关键字段的值</param>
 /// <returns>符合查询条件的记录</returns>
 public RsBom GetRsBomById(string Id)
 {
     using (IRsBomBLL RsBomBLL = BLLContainer.Resolve <IRsBomBLL>())
     {
         RsBom model = RsBomBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
예제 #3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="mRsBom">模型</param>
 /// <returns>是否成功</returns>
 public bool UpdateRsBom(RsBom mRsBom)
 {
     if (mRsBom == null)
     {
         return(false);
     }
     using (IRsBomBLL RsBomBLL = BLLContainer.Resolve <IRsBomBLL>())
     {
         return(RsBomBLL.Update(mRsBom));
     }
 }
예제 #4
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Id">关键字段</param>
 /// <returns>是否成功</returns>
 public bool DelRsBom(string Id)
 {
     using (IRsBomBLL RsBomBLL = BLLContainer.Resolve <IRsBomBLL>())
     {
         try
         {
             RsBom item = RsBomBLL.GetFirstOrDefault(Id);
             return(RsBomBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
예제 #5
0
        //保存
        private void BarItem_OnItemClick(object sender, RoutedEventArgs e)
        {
            RsBom m_RsBom = gbMenuContent.DataContext as RsBom;

            RsRoutingDetail m_RsRoutingDetail = this.combo_Op.SelectedItem as RsRoutingDetail;

            if (m_RsRoutingDetail != null)
            {
                m_RsBom.OP_NO = m_RsRoutingDetail.OP_NO;
            }
            _RSMService.UseService(s => s.UpdateRsBom(m_RsBom));
        }
예제 #6
0
        //增加物料确定
        private void View_Closed(object sender, EventArgs e)
        {
            ItemSelectView view          = sender as ItemSelectView;
            RsItemMaster   mRsItemMaster = view?.Tag as RsItemMaster;

            if (mRsItemMaster == null)
            {
                return;
            }

            if (treeList.SelectedItem == null || mRsItemMaster.MP_FLAG == "1")  //新增产品
            {
                RsBom mRsBom = new RsBom
                {
                    PKNO        = CBaseData.NewGuid(),
                    PARENT_PKNO = "0",
                    ITEM_PKNO   = mRsItemMaster.PKNO,      //当前物料PKNO

                    CHILD_NAME  = mRsItemMaster.ITEM_NAME, //当前物料信息
                    CHILD_NORM  = mRsItemMaster.ITEM_NORM,
                    CHILD_MODEL = mRsItemMaster.ITEM_SPECS,
                    USE_FLAG    = 1
                };

                _RSMService.UseService(s => s.AddRsBom(mRsBom));
            }
            else //增加物料
            {
                RsBom mRsBom = new RsBom
                {
                    PKNO        = CBaseData.NewGuid(),
                    PARENT_PKNO = (treeList.SelectedItem as RsBom)?.PKNO,        //父节点PKNO
                    ITEM_PKNO   = mRsItemMaster.PKNO,                            //当前物料PKNO

                    PARENT_NAME = (treeList.SelectedItem as RsBom)?.PARENT_NAME, //父节点Name

                    CHILD_NAME  = mRsItemMaster.ITEM_NAME,                       //当前物料信息
                    CHILD_NORM  = mRsItemMaster.ITEM_NORM,
                    CHILD_MODEL = mRsItemMaster.ITEM_SPECS,
                    USE_FLAG    = 1
                };

                _RSMService.UseService(s => s.AddRsBom(mRsBom));
            }

            Initialize();
        }
예제 #7
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Ids">关键字段数组</param>
 /// <returns>是否成功</returns>
 public bool DelRsBoms(string[] Ids)
 {
     using (IRsBomBLL RsBomBLL = BLLContainer.Resolve <IRsBomBLL>())
     {
         try
         {
             List <RsBom> entitys = new List <RsBom>();
             foreach (string id in Ids)
             {
                 RsBom item = RsBomBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(RsBomBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
예제 #8
0
 private void treeList_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
 {
     if (this.treeList.SelectedItem != null && this.treeList.SelectedItem.ToString() != "False" &&
         this.treeList.SelectedItem.ToString() != "True")
     {
         gbMenuContent.DataContext = this.treeList.SelectedItem as RsBom;
         if (
             _RSMService.UseService(
                 s =>
                 s.GetRsBoms("")
                 .Where(c => c.PKNO == (this.treeList.SelectedItem as RsBom).PARENT_PKNO))
             .ToList()
             .Count > 0)
         {
             RsBom m_RsBom =
                 _RSMService.UseService(
                     s =>
                     s.GetRsBoms("")
                     .Where(c => c.PKNO == (this.treeList.SelectedItem as RsBom).PARENT_PKNO))
                 .ToList()[0];
             txt_ParentName.Text = m_RsBom.CHILD_NAME;
             RsItemMaster m_RsItemMaster = _RSMService.UseService(s => s.GetRsItemMasterById(m_RsBom.ITEM_PKNO));
             if (m_RsItemMaster != null)
             {
                 List <RsRoutingItem> m_RsRoutingItems = _RSMService.UseService(s => s.GetRsRoutingItems(" ITEM_PKNO = " + m_RsItemMaster.PKNO + ""));
                 if (m_RsRoutingItems.Count > 0)
                 {
                     RsRoutingHead m_RsRoutingHead = _RSMService.UseService(s => s.GetRsRoutingHeadById(m_RsRoutingItems[0].ROUTING_PKNO));
                     this.txt_RoutingName.Text = m_RsRoutingHead.ROUTING_NAME;
                     List <RsRoutingDetail> m_RsRoutingDetails =
                         _RSMService.UseService(
                             s =>
                             s.GetRsRoutingDetails("ROUTING_PKNO = " + m_RsRoutingItems[0].ROUTING_PKNO + ""))
                         .OrderBy(c => c.OP_INDEX)
                         .ToList();
                     combo_Op.ItemsSource = m_RsRoutingDetails;
                     if (m_RsBom.OP_NO != null)
                     {
                         combo_Op.Text = m_RsBom.OP_NO;
                     }
                 }
             }
         }
     }
 }