Exemple #1
0
        ///// <summary>
        ///// 添加数据
        ///// </summary>
        ///// <param name="newData">数据</param>
        //public void AddData(Pro_MaterialRequisition newData)
        //{
        //    Insert(newData);
        //}

        /// <summary>
        /// 修改申请单数据
        /// </summary>
        ///
        public string UpdateData(MaterialRequisitionModel theData, List <string> itemList)
        {
            Pro_MaterialRequisitionItemBusiness mrItemBus = new Pro_MaterialRequisitionItemBusiness();

            try
            {
                mrItemBus.BeginTransaction();
                if (itemList != null && itemList.Count > 0)
                {
                    mrItemBus.Delete(itemList);
                }
                theData.MReqItemList.ForEach(item =>
                {
                    mrItemBus.UpdateWhere(x => x.Id == item.Id, x =>
                    {
                        x.Quantity = item.Quantity;
                    });
                });
            }
            catch
            {
                return("修改数据失败");
            }
            if (mrItemBus.EndTransaction())
            {
                return("");
            }
            else
            {
                return("修改数据失败");
            }
        }
Exemple #2
0
        /// <summary>
        /// 根据申请单编码获取数申请单
        /// </summary>
        /// <param name="mrNo"></param>
        /// <returns></returns>
        public MaterialRequisitionModel GetMaterialRequistion(string mrNo)
        {
            MaterialRequisitionModel theData = null;// new MaterialRequisitionModel ();

            if (!mrNo.Contains("PMR-"))
            {
                mrNo = "PMR-" + mrNo;
            }

            var query = this.GetIQueryable().Where(p => p.PMR_No == mrNo).ToList();

            if (query.Count > 0)
            {
                theData = query[0].ToJson().ToObject <MaterialRequisitionModel>();
                theData.MReqItemList = new Pro_MaterialRequisitionItemBusiness().GetIQueryable().Where(p => p.MR_Id == theData.Id).ToList();
            }
            return(theData);
        }
Exemple #3
0
        /// <summary>
        /// 获取指定的单条数据
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        public MaterialRequisitionModel GetTheData(string id)
        {
            Pro_MaterialRequisition  mrData = GetEntity(id);
            MaterialRequisitionModel mrd    = new MaterialRequisitionModel()
            {
                Id         = mrData.Id,
                CreateDate = mrData.CreateDate,
                Creator    = mrData.Creator,
                Picker     = mrData.Picker,
                PMR_No     = mrData.PMR_No,
                ProCode    = mrData.ProCode,
                ProName    = mrData.ProName,
                Status     = mrData.Status
            };
            Pro_MaterialRequisitionItemBusiness mrb = new Pro_MaterialRequisitionItemBusiness();

            mrd.MReqItemList = mrb.GetDataList(id);
            return(mrd);
        }