您的位置:首页 > 娱乐 > 八卦 > PurchaseorderController

PurchaseorderController

2024/12/22 22:57:00 来源:https://blog.csdn.net/weixin_42132177/article/details/141894541  浏览:    关键词:PurchaseorderController

目录

1、 PurchaseorderController

1.1、 采购订货

1.1.1、 //登录用户

1.2、 订单号

1.3、 供应商号

  1. PurchaseorderController 

using QXQPS.Models;

using QXQPS.Vo;

using System;

using System.Collections;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;

namespace QXQPS.Areas.AccessoriessalesManagment.Controllers

{

    public class PurchaseorderController : Controller

    {

        QXQPEntities myModels = new Models.QXQPEntities();

        // GET: AccessoriessalesManagment/Purchaseorder

    1. 采购订货

        public ActionResult Purchaseorder()//采购订货

        {

            try

            {

            ViewBag.UserName = Session["UserName"].ToString().Trim();

      1. //登录用户

            return View();

            }

            catch (Exception)

            {

                return Redirect("/Home/Login");

            }

        }

    1. 订单号

        public ActionResult MaintenanceNum()//订单号

        {

            string MaintenanceNum = "";

            var date = "J" + DateTime.Now.ToString("yyyyMMdd");

            try

            {

                var list = myModels.PW_Procurement.Where(m => m.IndentNumber.Contains(date)).OrderBy(m => m.IndentNumber).ToList();

                if (list.Count != 0)

                {

                    int num = Convert.ToInt32(list.Last().IndentNumber.Trim().Substring(9)) + 1;

                    if (num < 10)

                    {

                        MaintenanceNum = date + "000" + num;

                    }

                    else if (num > 9 && num < 100)

                    {

                        MaintenanceNum = date + "00" + num;

                    }

                    else if (num > 99 && num < 1000)

                    {

                        MaintenanceNum = date + "0" + num;

                    }

                }

                else

                {

                    MaintenanceNum = date + "0001";

                }

            }

            catch (Exception)

            {

                return Json("", JsonRequestBehavior.AllowGet);

            }

            return Json(MaintenanceNum, JsonRequestBehavior.AllowGet);

        }

    1. 供应商号

        public ActionResult SuppliNum()//供应商号

        {

            string SuppliNum = "";

            var date = "GYSH-" + DateTime.Now.ToString("yyyyMMdd")+"-";

            try

            {

                var listxdas = myModels.SYS_Suppliers.Where(m => m.SuppliersFirm.Contains(date)).OrderBy(m => m.SuppliersFirm).ToList();

                if (listxdas.Count != 0)

                {

                    int num = Convert.ToInt32(listxdas.Last().SuppliersFirm.Trim().Substring(14)) + 1;

                    if (num < 10)

                    {

                        SuppliNum = date + "000" + num;

                    }

                    else if (num > 9 && num < 100)

                    {

                        SuppliNum = date + "00" + num;

                    }

                    else if (num > 99 && num < 1000)

                    {

                        SuppliNum = date + "0" + num;

                    }

                }

                else

                {

                    SuppliNum = date + "0001";

                }

            }

            catch (Exception)

            {

                return Json("", JsonRequestBehavior.AllowGet);

            }

            return Json(SuppliNum, JsonRequestBehavior.AllowGet);

        }

版权声明:

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

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