您的位置:首页 > 财经 > 产业 > PurchasereturnController

PurchasereturnController

2024/12/23 15:38:27 来源:https://blog.csdn.net/weixin_42132177/article/details/141895356  浏览:    关键词:PurchasereturnController

目录

1、 PurchasereturnController

1.1、 反审核退货单

1.1.1、 //配件ID

1.1.2、 //配件编码

1.1.3、 //修改后仓库

1.1.4、 //修改配件信息表库存量

  1. PurchasereturnController 

using QXQPS.Models;

using QXQPS.Vo;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;

namespace QXQPS.Areas.AccessoriessalesManagment.Controllers

{

    public class PurchasereturnController : Controller

    {

        QXQPEntities myModels = new Models.QXQPEntities();

        // GET: AccessoriessalesManagment/Purchasereturn

    1. 反审核退货单

        public ActionResult NoToAuditReturnForm(int ReturnFormID, int NewWarehouseID)//反审核退货单

        {

            var listReturnFormDetail = myModels.SYS_ReturnFormDetail.Where(m => m.ReturnFormID == ReturnFormID).ToList();

            try

            {

                var list = myModels.PW_ReturnForm.Where(m => m.ReturnFormID == ReturnFormID).Single();

                list.ReturnFormID = list.ReturnFormID;

                list.ToAudit = false;

                myModels.Entry(list).State = System.Data.Entity.EntityState.Modified;

                if (myModels.SaveChanges() > 0)

                {

                    foreach (var item in listReturnFormDetail)

                    {

                        var ReturnFormDetailID = item.ReturnFormDetailID;//明细ID

                        var FittingsInfoID = item.FittingsInfoID;

      1. //配件ID

                        var Quantity = item.Quantity;//数量

                        var listinfor = myModels.SYS_FittingsInfo.Where(m => m.FittingsInfoID == FittingsInfoID).Select(m => new { m.FittingsCode }).SingleOrDefault();

                        var FittingsCode = listinfor.FittingsCode;

      1. //配件编码

                        var listInventorys = myModels.SYS_Inventory.Where(m => m.WarehouseID == NewWarehouseID && m.FittingsCode == FittingsCode).SingleOrDefault();

      1. //修改后仓库

                        listInventorys.InvenQuan = listInventorys.InvenQuan - Quantity;

                        myModels.Entry(listInventorys).State = System.Data.Entity.EntityState.Modified;

                        myModels.SaveChanges();

      1.                         //修改配件信息表库存量

                        var listFit = myModels.SYS_FittingsInfo.Where(m => m.FittingsInfoID == FittingsInfoID).SingleOrDefault();

                        listFit.InvenQuan = listFit.InvenQuan - Quantity;

                        myModels.Entry(listFit).State = System.Data.Entity.EntityState.Modified;

                    }

                }

                myModels.SaveChanges();

            }

            catch (Exception)

            {

                return Json(false, JsonRequestBehavior.AllowGet);

            }

            return Json(true, JsonRequestBehavior.AllowGet);

        }

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com