Ejemplo n.º 1
0
        /// <summary>
        /// 修改入库价格信息
        /// </summary>
        /// <param name="entryInfo"></param>
        /// <returns></returns>
        public bool EditEntryDetail(I_EntryDetail info, ref string errorMsg)
        {
            //创建事务
            using (var tran = db.Database.BeginTransaction())
            {
                try
                {
                    new I_EntryDetailDAL().Modify(info, "Remark", "TotalPrice");
                    I_InventoryRecord inInfo = new I_InventoryRecord();
                    inInfo.EntryDetailCode = info.EntryDetailCode;
                    inInfo.SurplusPrice = info.TotalPrice;
                    inInfo.ID = (from u in db.I_InventoryRecord
                                 where u.EntryDetailCode == info.EntryDetailCode
                                 select u.ID).First();
                    new I_InventoryRecordDAL().Modify(inInfo, "SurplusPrice");

                    tran.Commit(); //提交事务

                    return true;
                }
                catch (Exception ex)
                {
                    if (tran != null)
                        tran.Rollback();  //回滚事务
                    errorMsg = "修改入库价格失败! 操作已取消!~~" + ex.Message;
                    return false;
                }
            }
        }
Ejemplo n.º 2
0
 public ActionResult EditEntryTotalPriceDetiail()
 {
     string EntryDetailCode = Request.Form["EntryDetailCode"].ToString();
     decimal TotalPrice = Convert.ToDecimal(Request.Form["TotalPrice"]);
     string EntryRemark = Request.Form["EntryRemark"].ToString();
     string errorMsg = "";
     Model.I_EntryDetail info = new I_EntryDetail();
     info.EntryDetailCode = EntryDetailCode;
     info.Remark = EntryRemark;
     info.TotalPrice = TotalPrice;
     if (new I_EntryBLL().EditEntryDetail(info, ref errorMsg))
         return this.JsonResult(Utility.E_JsonResult.OK, "修改价格成功!", null, null);
     else
         return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 红充操作
        /// </summary>
        /// <param name="newEntryInfo">新入库单</param>
        /// <param name="orientryDetailInfo">原入单从表</param>
        /// <param name="newEntryDetailInfo">新入库单从表</param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        public bool EntryRedOperate(I_Entry newEntryInfo, I_EntryDetail orientryDetailInfo, I_EntryDetail newEntryDetailInfo, ref string errorMsg)
        {
            //创建事务
            using (var tran = db.Database.BeginTransaction())
            {
                try
                {
                    //修改红冲入库单号  orientryDetailInfo 不能被EF框架跟踪
                    dalContext.II_EntryDetailDAL.Modify(orientryDetailInfo, "RedEntryDetailCode"); //更新被红充编码

                    List<I_EntryDetail> entryDetailInfos = new List<I_EntryDetail>();
                    entryDetailInfos.Add(newEntryDetailInfo);
                    this.DoEntry(newEntryInfo, entryDetailInfos, ref errorMsg); //做入库操作

                    tran.Commit(); //提交事务

                    return true;
                }
                catch (Exception ex)
                {
                    if (tran != null)
                        tran.Rollback();  //回滚事务
                    errorMsg = "入库操作失败! 操作已取消!~~" + ex.Message;
                    return false;
                }
            }
        }
Ejemplo n.º 4
0
 public ActionResult SaveEntry()
 {
     string sEntryDetailInfo = Request.Form["sEntryDetailInfo"].ToString();
     List<EntryDetailInfo> relist = JsonHelper.GetJsonInfoBy<List<EntryDetailInfo>>(sEntryDetailInfo);
     I_Entry entryInfo = new I_Entry();
     entryInfo.EntryCode = DateTime.Now.AddSeconds(1).ToString("yyyyMMddHHmmss") + entryInfo.OperatorCode;    //生成入库编码
     entryInfo.EntryDate = Convert.ToDateTime(Request.Form["EntryDate"]);
     entryInfo.EntryType = "MatertalInType-1";
     entryInfo.OperationTime = DateTime.Now;
     entryInfo.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
     entryInfo.EntryStorageID = int.Parse(Request.Form["StorageCode"]);
     entryInfo.Remark = Request.Form["Remark"].ToString().Trim();
     List<I_EntryDetail> list = new List<Model.I_EntryDetail>();
     int ind = 0;
     foreach (EntryDetailInfo item in relist)
     {
         ind++;
         I_EntryDetail detailinfo = new I_EntryDetail();
         detailinfo.EntryDetailCode = entryInfo.EntryCode + entryInfo.OperatorCode + ind.ToString();
         detailinfo.BatchNo = item.BatchNo;
         detailinfo.RealBatchNo = item.RealBatchNo;
         detailinfo.EntryCode = entryInfo.EntryCode;
         detailinfo.EntryCounts = item.EntryCounts;
         detailinfo.EntryDate = item.EntryDate;
         detailinfo.MaterialID = item.MaterialID;
         detailinfo.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
         detailinfo.RedEntryDetailCode = "";
         detailinfo.RelatedOrderNum = item.RelatedOrderNum;
         detailinfo.Remark = item.Remark.Trim();
         detailinfo.Specification = item.Specification;
         detailinfo.StorageCode = item.StorageCode;
         detailinfo.TotalPrice = item.TotalPrice;
         detailinfo.Unit = item.Unit;
         if (item.ValidityDateStr == "无有效期")
             detailinfo.ValidityDate = DateTime.MaxValue;
         else
             detailinfo.ValidityDate = Convert.ToDateTime(item.ValidityDateStr);
         list.Add(detailinfo);
     }
     string errorMsg = "";
     if (new I_EntryBLL().EntryOperate(entryInfo, list, ref errorMsg))
         return this.JsonResult(Utility.E_JsonResult.OK, "入库信息成功!", null, null);
     else
         return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
 }