public ActionResult SaveDeliveryDetail()
        {
            string ConsigneeID = Request.Form["ConsigneeID"].ToString();
            DateTime DeliveryDate = Convert.ToDateTime(Request.Form["DeliveryDate"]);
            int ReceivingStoreID = int.Parse(Request.Form["ReceivingStoreID"]);
            string Remark = Request.Form["Remark"].ToString();
            string sDeliveryDetailInfo = Request.Form["sDeliveryDetailInfo"].ToString();
            List<I_DeliveryDetail> relist = JsonHelper.GetJsonInfoBy<List<I_DeliveryDetail>>(sDeliveryDetailInfo);
            I_Delivery delivery = new I_Delivery();
            delivery.DeliveryCode = DateTime.Now.AddSeconds(1).ToString("yyyyMMddHHmmss") + UserOperateContext.Current.Session_UsrInfo.ID;    //生成入库编码
            delivery.ConsigneeID = ConsigneeID;
            delivery.DeliveryType = "MatertalOutType-1";
            delivery.OperationTime = DeliveryDate;
            delivery.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
            delivery.DeliveryTime = DateTime.Now;
            delivery.ReceivingStoreID = ReceivingStoreID;
            delivery.Remark = Remark;
            //delivery.SourceStoreID

            string errorMsg = "";
            if (new I_DeliveryBLL().DeliveryOerate(delivery, relist, ref errorMsg))
                return this.JsonResult(Utility.E_JsonResult.OK, "出库信息成功!", null, null);
            else
                return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
        }
        /// <summary>
        /// 记录报废物资
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveScrapOverdueMaterial()
        {
            int StorageCode = -3; //报废入库为报废库-3

            List<I_DeliveryDetail> relist = new List<I_DeliveryDetail>();

            I_DeliveryDetail info = new I_DeliveryDetail();
            info.RealBatchNo = Request.Form["RealBatchNo"].ToString();
            info.BatchNo = Request.Form["BatchNo"].ToString();
            info.MaterialID = Convert.ToInt32(Request.Form["MaterialID"]);
            info.DeliveryCounts = Convert.ToInt32(Request.Form["DeliveryCounts"]);
            info.EntryStorageCode = int.Parse(Request.Form["StorageCode"]); //来源仓库编码
            info.Remark = Request.Form["Remark"].ToString();
            info.TargetStorageCode = StorageCode;

            relist.Add(info);

            I_Delivery delivery = new I_Delivery();
            delivery.DeliveryCode = DateTime.Now.AddSeconds(1).ToString("yyyyMMddHHmmss") + UserOperateContext.Current.Session_UsrInfo.ID;    //生成入库编码
            delivery.ConsigneeID = UserOperateContext.Current.Session_UsrInfo.ID.ToString();
            delivery.DeliveryTime = DateTime.Now;
            delivery.Remark = info.Remark;
            delivery.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
            delivery.OperationTime = DateTime.Now;
            delivery.ReceivingStoreID = StorageCode;
            delivery.DeliveryType = "MatertalOutType-6";

            string errorMsg = "";
            if (new I_DeliveryBLL().DeliveryOerate(delivery, relist, ref errorMsg))
                return this.JsonResult(Utility.E_JsonResult.OK, "报废物资成功!", null, null);
            else
                return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
        }
示例#3
0
        /// <summary>
        /// 同意申请
        /// </summary>
        /// <param name="apply"></param>
        /// <param name="applyDetail"></param>
        /// <param name="deliveryInfo"></param>
        /// <param name="deliveryDetailInfos"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        public bool ApproveApplyOperate(I_Apply apply, List<I_ApplyDetail> applyDetail, I_Delivery deliveryInfo, List<I_DeliveryDetail> deliveryDetailInfos, ref string errorMsg)
        {
            //创建事务
            using (var tran = db.Database.BeginTransaction())
            {
                try
                {
                    //1.0 更新申请表
                    new I_ApplyDAL().Modify(apply, "ApplyType", "ApprovalUserID", "ApprovalTime");
                    foreach (var info in applyDetail)
                    {
                        new I_ApplyDetailDAL().Modify(info, "ApprovalCounts");
                    }

                    //2.0 做出库操作
                    #region 出库操作

                    //1 先插入出库主表
                    dalContext.II_DeliveryDAL.Add(deliveryInfo);

                    foreach (I_DeliveryDetail info in deliveryDetailInfos)
                    {
                        //2. 再插入从表信息
                        dalContext.II_DeliveryDetailDAL.Add(info);

                        //3. 保存剩余流水表
                        dalContext.II_SurplusDAL.SaveDeliverySurplusInfo(info, deliveryInfo.DeliveryType, ref errorMsg);
                    }

                    #endregion

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

                    return true;
                }
                catch (Exception ex)
                {
                    if (tran != null)
                        tran.Rollback();  //回滚事务
                    errorMsg = "同意申请操作失败! 操作已取消!~~" + ex.Message;
                    return false;
                }
            }
        }
        public ActionResult SaveStocking()
        {
            bool StockingType = Convert.ToBoolean(Request.Form["StockingType"]); //true为盘盈  false为盘亏
            int DeliveryCounts = Convert.ToInt32(Request.Form["DeliveryCounts"]);
            int StorageCode = -2; //盘库入库为盘点库-2
            string StockingTypeInfo = "";
            if (StockingType)
            {
                StockingTypeInfo = "MatertalOutType-4";  //盘盈出库单
                DeliveryCounts = -DeliveryCounts;
            }
            else
            {
                StockingTypeInfo = "MatertalOutType-5";  //盘亏出库单
            }
            List<I_DeliveryDetail> relist = new List<I_DeliveryDetail>();

            I_DeliveryDetail info = new I_DeliveryDetail();
            info.RealBatchNo = Request.Form["RealBatchNo"].ToString();
            info.BatchNo = Request.Form["BatchNo"].ToString();
            info.MaterialID = Convert.ToInt32(Request.Form["MaterialID"]);
            info.DeliveryCounts = DeliveryCounts;
            info.EntryStorageCode = int.Parse(Request.Form["StorageCode"]); //来源仓库编码
            info.Remark = Request.Form["Remark"].ToString();
            info.TargetStorageCode = StorageCode;
            relist.Add(info);

            I_Delivery delivery = new I_Delivery();
            delivery.DeliveryCode = DateTime.Now.AddSeconds(1).ToString("yyyyMMddHHmmss") + UserOperateContext.Current.Session_UsrInfo.ID;    //生成入库编码
            delivery.ConsigneeID = UserOperateContext.Current.Session_UsrInfo.ID.ToString();
            delivery.DeliveryTime = DateTime.Now;
            delivery.Remark = info.Remark;
            delivery.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
            delivery.OperationTime = DateTime.Now;
            delivery.ReceivingStoreID = StorageCode;
            delivery.DeliveryType = StockingTypeInfo;

            string errorMsg = "";
            if (new I_DeliveryBLL().DeliveryOerate(delivery, relist, ref errorMsg))
                return this.JsonResult(Utility.E_JsonResult.OK, "盘点物资仓库成功!", null, null);
            else
                return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
        }
示例#5
0
        public ActionResult RatifyApply()
        {
            string ConsigneeID = Request.Form["ConsigneeID"].ToString();
            string DeliveryCode = Request.Form["DeliveryCode"].ToString();
            DateTime DeliveryDate = Convert.ToDateTime(Request.Form["DeliveryDate"]);
            int ReceivingStoreID = Convert.ToInt32(Request.Form["ReceivingStoreID"]);
            string Remark = Request.Form["Remark"].ToString();
            I_Delivery deliveryInfo = new I_Delivery();
            deliveryInfo.DeliveryCode = DeliveryCode;
            deliveryInfo.ConsigneeID = ConsigneeID;
            deliveryInfo.DeliveryTime = DeliveryDate;
            deliveryInfo.Remark = Remark;
            deliveryInfo.OperationTime = DateTime.Now;
            deliveryInfo.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;
            deliveryInfo.ReceivingStoreID = ReceivingStoreID;
            deliveryInfo.DeliveryType = "MatertalInType-2";

            string sDeliveryDetailInfo = Request.Form["sDeliveryDetailInfo"].ToString();
            List<I_DeliveryDetail> deliveryDetailList = JsonHelper.GetJsonInfoBy<List<I_DeliveryDetail>>(sDeliveryDetailInfo);

            I_Apply applyInfo = new I_Apply();
            applyInfo.ApplyCode = DeliveryCode;
            applyInfo.ApprovalUserID = UserOperateContext.Current.Session_UsrInfo.ID;
            applyInfo.ApprovalTime = DeliveryDate;
            applyInfo.ApplyType = "ApplyType-2";

            List<I_ApplyDetail> applyDetailList = new List<I_ApplyDetail>();
            foreach (I_DeliveryDetail item in deliveryDetailList)
            {
                item.OperatorCode = UserOperateContext.Current.Session_UsrInfo.ID;

                I_ApplyDetail adInfo = new I_ApplyDetail();
                adInfo.ApplyDetailCode = item.DeliveryDetailCode;
                adInfo.ApprovalCounts = item.DeliveryCounts;

                applyDetailList.Add(adInfo);
            }
            string errorMsg = "";
            if (new I_ApplyBLL().ApproveApplyOperate(applyInfo, applyDetailList, deliveryInfo
                , deliveryDetailList, ref errorMsg))
                return this.JsonResult(Utility.E_JsonResult.OK, "审批物资申领单成功!", null, null);
            else
                return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
        }