예제 #1
0
 public ActionResult SaveApply()
 {
     string ApplyUserID = Request.Form["ApplyUserID"].ToString();
     DateTime ApplyDateTime = Convert.ToDateTime(Request.Form["ApplyDateTime"]);
     string ApplyStorage = Request.Form["ApplyStorage"].ToString();
     string Remark = Request.Form["Remark"].ToString();
     string sApplyDetailInfo = Request.Form["sApplyDetailInfo"].ToString();
     I_Apply applyInfo = new I_Apply();
     applyInfo.ApplyCode = DateTime.Now.AddSeconds(1).ToString("yyyyMMddHHmmss") + ApplyUserID;
     applyInfo.ApplyUserID = int.Parse(ApplyUserID);
     applyInfo.ApplyReceivingStoreID = int.Parse(ApplyStorage);
     applyInfo.ApplyTime = ApplyDateTime;
     applyInfo.ApplyType = "ApplyType-1";
     applyInfo.Remark = Remark;
     List<I_DeliveryDetail> relist = JsonHelper.GetJsonInfoBy<List<I_DeliveryDetail>>(sApplyDetailInfo);
     List<I_ApplyDetail> adlist = new List<I_ApplyDetail>();
     int ind = 0;
     foreach (I_DeliveryDetail item in relist)
     {
         I_ApplyDetail info = new I_ApplyDetail();
         info.ApplyCode = applyInfo.ApplyCode;
         info.ApplyDetailCode = applyInfo.ApplyCode + ind.ToString();
         info.MaterialID = item.MaterialID;
         info.RealBatchNo = item.RealBatchNo;
         info.BatchNo = item.BatchNo;
         info.ApplyTime = applyInfo.ApplyTime;
         info.ApplyCounts = item.DeliveryCounts;
         info.ApprovalCounts = item.DeliveryCounts;
         info.ApplyUserID = applyInfo.ApplyUserID;
         info.SelfStorageCode = applyInfo.ApplyReceivingStoreID;
         info.ApplyTargetStorageCode = item.TargetStorageCode;
         info.Remark = item.Remark;
         adlist.Add(info);
         ind++;
     }
     string errorMsg = "";
     if (new I_ApplyBLL().ApplyOperate(applyInfo, adlist, ref errorMsg))
         return this.JsonResult(Utility.E_JsonResult.OK, "申领物资成功!", null, null);
     else
         return this.JsonResult(Utility.E_JsonResult.Error, errorMsg, null, null);
 }
예제 #2
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);
        }