9a2e9a9595bd125e795c7e21aa99b491fed2a575..bbba888f3bca270b476ab2a3606f51089dac071c
2025-09-09 llj
1
bbba88 对比 | 目录
2025-09-09 llj
条码生成打印,物料校验
19ba87 对比 | 目录
3个文件已修改
12个文件已添加
1319 ■■■■■ 已修改文件
WebAPI/App_Start/BundleConfig.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/BundleConfig2.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/FilterConfig.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/FilterConfig2.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/RouteConfig.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/RouteConfig2.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Content/Site.css 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/MaterialHandingController.cs 581 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs 336 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Cls_MaterialHandingModel.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Views/web.config 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/App_Start/BundleConfig.cs
New file
@@ -0,0 +1,30 @@
using System.Web;
using System.Web.Optimization;
namespace WebAPI
{
    public class BundleConfig
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));
            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));
            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));
            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"));
            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }
    }
}
WebAPI/App_Start/BundleConfig2.cs
New file
@@ -0,0 +1,30 @@
using System.Web;
using System.Web.Optimization;
namespace WebAPI
{
    public class BundleConfig2
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));
            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));
            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));
            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"));
            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }
    }
}
WebAPI/App_Start/FilterConfig.cs
New file
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace WebAPI
{
    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
    }
}
WebAPI/App_Start/FilterConfig2.cs
New file
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace WebAPI
{
    public class FilterConfig2
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
    }
}
WebAPI/App_Start/RouteConfig.cs
New file
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace WebAPI
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
WebAPI/App_Start/RouteConfig2.cs
New file
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace WebAPI
{
    public class RouteConfig2
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
WebAPI/Content/Site.css
New file
@@ -0,0 +1,18 @@
body {
    padding-top: 50px;
    padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
    padding-left: 15px;
    padding-right: 15px;
}
/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
    max-width: 280px;
}
WebAPI/Controllers/MaterialHandingController.cs
New file
@@ -0,0 +1,581 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http;
using WebAPI.Code;
using WebAPI.Models;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
    public class MaterialHandingController : ApiController
    {
        // GET: MaterialHanding
        private JsonResult objJsonResult = new JsonResult();
        private json objjson = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        [Route("MaterialHandingController/GetMaterialHandingList")]
        [HttpGet]
        public object GetMaterialHandingList(string sWhere, string user)
        {
            List<object> columnNameList = new List<object>();
            try
            {
                string VsWhere = sWhere;
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                DataSet ds;
                //其他过滤
                //string sql = " where 1 = 1 " + sqlWhere;
                ////转换特殊字符
                //if (Common.SQLtoChange(sql, ref VsWhere, ref PcWhere) == false)
                //{
                //    objjson.code = "0";
                //    objjson.count = 0;
                //    objjson.Message = "转换特殊字符失败";
                //    objjson.data = null;
                //    return objjson;
                //}
                //获取返回数据
                ds = oCn.RunProcReturn("select * from h_v_Gy_UserMaterRelation where 1=1 " + sWhere, "h_v_Gy_UserMaterRelation");
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败,没有相关数据";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 10000;
                    objjson.Message = "获取成功";
                    objjson.data = ds.Tables[0];
                    objjson.list = columnNameList;
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        #region  启用
        [Route("MaterialHandingController/OpenMaterial")]
        [HttpGet]
        public object OpenMaterial(int HInterID, int IsUse, string CurUserName)
        {
            try
            {
                var ds = oCN.RunProcReturn("select * from Gy_UserMaterRelation where HItemID=" + HInterID, "Gy_UserMaterRelation");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    IsUse = Convert.ToInt32(ds.Tables[0].Rows[0]["HUseFlag"]) ;
                    if (IsUse == 1)  //判断
                    {
                        if (ds.Tables[0].Rows[0]["HUpDater"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已启用!不能再次启用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsUse == 0)  //启用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_MaterPrice_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_UserMaterRelation set HUpDater='" + CurUserName + "',HUpDateDate=getdate(),HUseFlag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_MaterPrice_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "启用成功";
                    objJsonResult.data = null;
                }
                //if (IsStop == 1) //反禁用判断
                //{
                //    //反禁用前控制=========================================
                //    string sql1 = "exec h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                //    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl");
                //    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 1;
                //        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                //        objJsonResult.data = null;
                //        oCN.RollBack();
                //        return objJsonResult;
                //    }
                //    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 1;
                //        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                //        objJsonResult.data = null;
                //        oCN.RollBack();
                //        return objJsonResult;
                //    }
                //    //==================================================================================
                //    oCN.RunProc("update Gy_MaterPrice set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                //    //反禁用后控制=========================================
                //    string sql2 = "exec h_p_Gy_MaterPrice_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                //    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnStopCtrl");
                //    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 1;
                //        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                //        objJsonResult.data = null;
                //        oCN.RollBack();
                //        return objJsonResult;
                //    }
                //    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 1;
                //        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                //        objJsonResult.data = null;
                //        oCN.RollBack();
                //        return objJsonResult;
                //    }
                //    //==================================================================================
                //    objJsonResult.code = "1";
                //    objJsonResult.count = 1;
                //    objJsonResult.Message = "反禁用成功";
                //    objJsonResult.data = null;
                //}
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "启用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 物料校验
        [Route("MaterialHandingController/CheckMaterial")]
        [HttpGet]
        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID)
        {
            try
            {
                //ds1获取的sql后期记得改回供应商,修改人->供应商
                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 物料代码='" + HMaterID + "'" + "and 修改人='" + user + "'", "h_v_Gy_UserMaterRelationEdit");
                var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterID+ "'", "Gy_Material");
                if (param == 0)
                {
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        return 1;
                    }
                    else
                    {
                        return GetMaterialResult(ds);
                    }
                }
                else
                {
                    oCN.BeginTran();
                    string sqlUpd = "UPDATE Gy_UserMaterRelation set HUseFlag=0 where HMaterID="+ ds.Tables[0].Rows[0]["HItemID"];
                    oCN.RunProc(sqlUpd);
                    oCN.Commit();
                    return GetMaterialResult(ds);
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        private object GetMaterialResult(DataSet ds)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Success!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "物料不存在!";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  编辑查看信息
        [Route("MaterialHandingController/Edit_M")]
        [HttpGet]
        public object Edit_M(string HItemID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql1 = string.Format(@"select * from h_v_Gy_UserMaterRelationEdit where HItemID = " + HItemID);
                ds = oCN.RunProcReturn(sql1, "h_v_Gy_UserMaterRelationEdit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 新增保存
        [Route("MaterialHandingController/AddBill")]
        [HttpPost]
        public object AddBill([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["msg"].ToString();
                string msg3 = _value.ToString();
                //string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                //string msg1 = sArray[0].ToString();
                //string msg2 = sArray[1].ToString();
                string msg2 = msg3.ToString();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
                List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(msg2);
                var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + list[0].HMaterNumber + "'", "Gy_Material");
                int HItemID =Convert.ToInt32(list[0].HItemID);
                string HMaterNumber = list[0].HMaterNumber;
                int HMaterID =Convert.ToInt32(ds.Tables[0].Rows[0]["HItemID"]);
                int HSupID = list[0].HSupID;
                string HUserID = list[0].HUserID;
                decimal HMinPackQty = list[0].HMinPackQty;
                decimal HInBoxPackQty = list[0].HInBoxPackQty;
                decimal HOutBoxPackQty = list[0].HOutBoxPackQty;
                int HUSEORGID = list[0].HUSEORGID;
                bool HUseFlag = list[0].HUseFlag;
                string HMaker = list[0].HMaker!=""? list[0].HMaker :"";
                string HMakeTime = list[0].HMakeTime;
                string HUpDater = list[0].HUpDater != "" ? list[0].HUpDater : "";
                string HUpDateDate = list[0].HUpDateDate;
                string HCheckEmp = list[0].HCheckEmp != "" ? list[0].HCheckEmp : "";
                string HCheckTime = list[0].HCheckTime;
                oCN.BeginTran();
                #region  参数化
                // 构建参数化 SQL 语句
                string sql = @"INSERT INTO Gy_UserMaterRelation
                (HMaterID, HSupID, HMinPackQty, HInBoxPackQty, HOutBoxPackQty, HUSEORGID, HUseFlag,
                HMaker, HMakeTime, HUpDater, HUpDateDate, HCheckEmp, HCheckTime)
                VALUES(@HMaterID, @HSupID,  @HMinPackQty, @HInBoxPackQty, @HOutBoxPackQty, @HUSEORGID, @HUseFlag,
                @HMaker, @HMakeTime, @HUpDater, @HUpDateDate, @HCheckEmp, @HCheckTime)";
                // 使用 MakeInParam 方法创建参数
                SqlParameter[] parameters = {
                    oCN.MakeInParam("@HMaterID", SqlDbType.Int, 4, HMaterID),
                    oCN.MakeInParam("@HSupID", SqlDbType.Int, 4, HSupID),
                    //oCN.MakeInParam("@HUserID", SqlDbType.NVarChar, 50, HUserID),
                    oCN.MakeInParam("@HMinPackQty", SqlDbType.Decimal, 8, HMinPackQty),
                    oCN.MakeInParam("@HInBoxPackQty", SqlDbType.Decimal, 8, HInBoxPackQty),
                    oCN.MakeInParam("@HOutBoxPackQty", SqlDbType.Decimal, 8, HOutBoxPackQty),
                    oCN.MakeInParam("@HUSEORGID", SqlDbType.Int, 4, HUSEORGID),
                    oCN.MakeInParam("@HUseFlag", SqlDbType.Bit, 1, HUseFlag),
                    oCN.MakeInParam("@HMaker", SqlDbType.NVarChar, 50, (object)HMaker ?? DBNull.Value),
                    oCN.MakeInParam("@HMakeTime", SqlDbType.NVarChar, 50, (object)HMakeTime ?? DBNull.Value),
                    oCN.MakeInParam("@HUpDater", SqlDbType.NVarChar, 50, (object)HUpDater ?? DBNull.Value),
                    oCN.MakeInParam("@HUpDateDate", SqlDbType.NVarChar, 50, (object)HUpDateDate ?? DBNull.Value),
                    oCN.MakeInParam("@HCheckEmp", SqlDbType.NVarChar, 50, (object)HCheckEmp ?? DBNull.Value),
                    oCN.MakeInParam("@HCheckTime", SqlDbType.NVarChar, 50, (object)HCheckTime ?? DBNull.Value)
                };
                DataSet result = oCN.RunProcReturn(sql, parameters, "Gy_UserMaterRelation");
                #endregion
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增成功!";
                //objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 编辑保存
        [Route("MaterialHandingController/EditSaveBill")]
        [HttpPost]
        public object EditSaveBill([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["msg"].ToString();
                string msg3 = _value.ToString();
                string msg2 = msg3.ToString();
                oCN.BeginTran();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
                List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(msg2);
                int HItemID = Convert.ToInt32(list[0].HItemID);
                int HMaterID = Convert.ToInt32(list[0].HMaterNumber);
                int HSupID = list[0].HSupID;
                //string HUserID = list[0].HUserID;
                decimal HMinPackQty = list[0].HMinPackQty;
                decimal HInBoxPackQty = list[0].HInBoxPackQty;
                decimal HOutBoxPackQty = list[0].HOutBoxPackQty;
                int HUSEORGID = list[0].HUSEORGID;
                bool HUseFlag = list[0].HUseFlag;
                string HMaker = list[0].HMaker != "" ? list[0].HMaker : "";
                string HMakeTime = list[0].HMakeTime;
                string HUpDater = list[0].HUpDater != "" ? list[0].HUpDater : "";
                string HUpDateDate = list[0].HUpDateDate;
                string HCheckEmp = list[0].HCheckEmp != "" ? list[0].HCheckEmp : "";
                string HCheckTime = list[0].HCheckTime;
                #region
                //主表
                string sql = @"UPDATE Gy_UserMaterRelation SET
                HMaterID = @HMaterID,
                HSupID = @HSupID,
                HMinPackQty = @HMinPackQty,
                HInBoxPackQty = @HInBoxPackQty,
                HUSEORGID = @HUSEORGID,
                HUseFlag = @HUseFlag,
                HMaker = @HMaker,
                HMakeTime = @HMakeTime,
                HUpDater = @HUpDater,
                HUpDateDate = @HUpDateDate,
                HCheckEmp = @HCheckEmp,
                HCheckTime = @HCheckTime
                WHERE HItemID = @HItemID";
                SqlParameter[] parameters = {
                        oCN.MakeInParam("@HItemID", SqlDbType.Int, 4, HItemID),
                        oCN.MakeInParam("@HMaterID", SqlDbType.Int, 4, HMaterID),
                        oCN.MakeInParam("@HSupID", SqlDbType.Int, 4, HSupID),
                        //oCN.MakeInParam("@HUserID", SqlDbType.NVarChar, 50, HUserID),
                        oCN.MakeInParam("@HMinPackQty", SqlDbType.Decimal, 8, HMinPackQty),
                        oCN.MakeInParam("@HInBoxPackQty", SqlDbType.Decimal, 8, HInBoxPackQty),
                        oCN.MakeInParam("@HOutBoxPackQty", SqlDbType.Decimal, 8, HOutBoxPackQty),
                        oCN.MakeInParam("@HUSEORGID", SqlDbType.Int, 4, HUSEORGID),
                        oCN.MakeInParam("@HUseFlag", SqlDbType.Bit, 1, HUseFlag),
                        oCN.MakeInParam("@HMaker", SqlDbType.NVarChar, 50, (object)HMaker ?? DBNull.Value),
                        oCN.MakeInParam("@HMakeTime", SqlDbType.NVarChar, 50, (object)HMakeTime ?? DBNull.Value),
                        oCN.MakeInParam("@HUpDater", SqlDbType.NVarChar, 50, (object)HUpDater ?? DBNull.Value),
                        oCN.MakeInParam("@HUpDateDate", SqlDbType.NVarChar, 50, (object)HUpDateDate ?? DBNull.Value),
                        oCN.MakeInParam("@HCheckEmp", SqlDbType.NVarChar, 50, (object)HCheckEmp ?? DBNull.Value),
                        oCN.MakeInParam("@HCheckTime", SqlDbType.NVarChar, 50, (object)HCheckTime ?? DBNull.Value),
};
                // 使用 RunProcReturn 执行参数化UPDATE查询,忽略返回的 DataSet
                DataSet result = oCN.RunProcReturn(sql, parameters, "Gy_UserMaterRelation");
                #endregion
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "更新成功!";
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        //#region 供应商报价单 删除
        [Route("MaterialHandingController/DelBill")]
        [HttpGet]
        public object DelBill(string HItemID, string user)
        {
                try
                {
                    if (HItemID == null || HItemID.Equals(""))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "HInterID不能为空!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                   // oCN.RunProc("delete from Gy_UserMaterRelation where HInterID = " + HItemID);
                    oCN.RunProc("delete from Gy_UserMaterRelation where HItemID='" + HItemID + "'");
                    oCN.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                catch (Exception e)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Exception!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
        }
        //#endregion
    }
}
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
New file
@@ -0,0 +1,336 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using System.Web.Script.Serialization;
using WebAPI.Code;
using WebAPI.Models;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
    public class SRM_MaterialBarCodeBillController : ApiController
    {
        private JsonResult objJsonResult = new JsonResult();
        private json objjson = new json();
        public new ClsCN oCn = new ClsCN();
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        // GET: SRM_MaterialBarCodeBill
        #region 条码批量生辰
        [Route("GetSRMHBarCodeShowBillMain")]
        public object GetSRMHBarCodeShowBillMain(string HInterID)
        {
            try
            {
                DataSet ds;
                string s = "";
                string ShowItem = " * ";//显示的字段
                //if (DBUtility.ClsPub.isLong(HInterID) == 0)
                //{
                //    objjson.code = "0";
                //    objjson.count = 0;
                //    objjson.Message = "获取失败";
                //    objjson.data = null;
                //    return objjson;
                //}
                DAL.ClsWeb_BarCodeBill oClsWeb_BarCodeBill = new DAL.ClsWeb_BarCodeBill();
                //string sql = string.Format(@"select * from h_v_Cg_POOrderBillMain_ForWeb2 where HInterID = " + sMsg);
                string sql = string.Format(@"select * from h_v_SRM_BarCodeBill where HItemID in  ( " + HInterID + ")");
                ds = oCn.RunProcReturn(sql, "h_v_SRM_BarCodeBill");
                //ds = oClsWeb_BarCodeBill.ShowBillMain1(DBUtility.ClsPub.isLong(sMsg), ShowItem, ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 10000;
                    objjson.Message = "获取成功";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        #endregion
        #region 条码保存
        [Route("SRM_MaterialBarCodeBillController/GetBarcodeSaveBillBoxBycg")]
        [HttpPost]
        /// <summary>
        /// 生成条码
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="msg2"></param>
        /// <returns></returns>
        public object GetBarcodeSaveBillBoxBycg([FromBody] JObject msg)
        {
            string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();//
            string msg3 = sArray[1].ToString();//
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                #region 获取用户以及相关参数
                List<Model.Cls_MaterialHandingModel> lsmain = new List<Model.Cls_MaterialHandingModel>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_MaterialHanding(msg2);
                int get_BarCodecount = 0;
                foreach (Model.Cls_MaterialHandingModel oItem in lsmain)
                {
                    get_BarCodecount++;
                    UserName = oItem.HMaker;
                }
                DAL.ClsWeb_BarCodeBill oBill = new DAL.ClsWeb_BarCodeBill();
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                #endregion
                List<Model.ClsGy_MaterialBarCodeBillModel> ls = new List<Model.ClsGy_MaterialBarCodeBillModel>();
                ls = oListModels.getObjectByJson_BarCodeBill(msg3);//列表数据model
                #region 数据准备
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                int LSHlen = 6;             //流水号长度
                int SumLen = 10;            //总长度
                string TM = "";             //条码
                double HSumQty = 0;         //产品数量
                int LSH = 0;                //流水号
                string LSH2 = "";           //流水号转换成字符
                string sDate = "";            //日期
                string sYear = "";          //年
                string sPeriod = "";        //月
                string sDay = "";            //日
                string WeiShu = ""; //尾数
                string HKFDQDate= ls[0].HKFDQDate;//到期日期
                long HKFPeriod= (ls[0].HKFPeriod.ToString()==""?0: ls[0].HKFPeriod);//保质期
                string HKFDate= ls[0].HKFDQDate==null? DateTime.Now.ToString("yyyy/MM/dd"): ls[0].HKFDQDate;//生产日期
                string HKFDate_1 = string.Join("", HKFDate.Split('/').Select(x => x.PadLeft(2, '0')));
                double HMinQty= ls[0].HMinQty;//标准包装数
                double HBQty= ls[0].HBQty;//最小包装数
                long HISKFPERIOD= ls[0].HISKFPERIOD;//是否启用保质期
                long HBatchManager= ls[0].HBatchManager;//是否启用批号
                string HSourceBillType= ls[0].HSourceBillType;//条码类型
                string HBatchNo= ls[0].HBatchNo==null?"": ls[0].HBatchNo;//批号
                //物料
                long HMaterID=ls[0].HMaterID;
                string HMaterNumber= ls[0].HMaterNumber;
                string HMaterShortNumber = ls[0].HMaterShortNumber;
                string HMaterName = ls[0].HMaterName;
                //供应商
                long HSupID= ls[0].HSupID;
                string HSupName= ls[0].HSupName;
                string HMaker= ls[0].HMaker;
                DateTime HMakeDate= ls[0].HMakeDate;
                double HQty= ls[0].HQty; //本次生成条码数量
                double biaoqianzhangshu= ls[0].biaoqianzhangshu;
        //流水号
        DataSet Ds;
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                oCn.BeginTran();
                Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                #endregion
                foreach (Model.ClsGy_MaterialBarCodeBillModel oItemSub in ls)
                {
                    //数量为0 跳过
                    if (oItemSub.HQty == 0 || oItemSub.HMinQty == 0 )
                        continue;
                    if(oItemSub.HBatchManager!=0&&oItemSub.HBatchNo=="")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "已启用批号,批号不能为空,请核对";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oItemSub.HISKFPERIOD != 0 && oItemSub.HKFPeriod == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "已启用保质期,保质期不能为0,请核对";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sql = "";
                    //校验批号 和 生产日期
                    //string sql = $"select top 1 HKFDate from Gy_BarCodeBill where HSupID = '{oItemSub.HSupID}' and HBatchNo = '{HBatchNo.TrimStart().TrimEnd()}' and HMaterID ={oItemSub.HMaterID} and isnull(HKFDate, '') <> ''";
                    //LogService.Write($"sql:{sql}");
                    //DataTable dt = oCn.RunProcReturn(sql, "tables").Tables[0];
                    //if (dt.Rows.Count > 0)
                    //{
                    //    LogService.Write($"HKFDate:{dt.Rows[0][0]}");
                    //    sql = $"select DATEDIFF(D,{dt.Rows[0][0]},{HKFDate})";
                    //    DataSet ds = oCn.RunProcReturn(sql, "tables2");
                    //    LogService.Write($"DATEDIFF:{Convert.ToInt32(ds.Tables[0].Rows[0][0])}");
                    //    if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) != 0)
                    //    {
                    //        objJsonResult.code = "0";
                    //        objJsonResult.count = 0;
                    //        objJsonResult.Message = $"物料编码{oItemSub.HMaterNumber},批号{oItemSub.HBatchNo.TrimStart().TrimEnd()},生产日期为{dt.Rows[0][0]},请核对";
                    //        objJsonResult.data = null;
                    //        return objJsonResult;
                    //    }
                    //}
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    {
                        HMaterID = oItemSub.HMaterID;//物料代码
                        HQty = ClsPub.isDoule(oItemSub.HQty);//本次生成条码数量
                        HBQty = ClsPub.isInt(oItemSub.HBQty);//最小包装数(内箱数)
                        HMinQty = ClsPub.isDoule(oItemSub.HMinQty);//标准包装数
                        int virtualCount = 1;//实际上插入数量
                        // HSumQty = ClsPub.isDoule(oItemSub.HQty);  //产品数量
                       for (int i = 0; i < biaoqianzhangshu; i++)
                        {
                            ///供应商名称+@+物料代码+@+物料简称+@+数量+@+日期+@+流水号
                            LSH += 1;
                            TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}";
                            Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                           // var HBarCode_verify = TM.Split('@'); //校验条码信息
                           // var HMaterNumber_verify = HBarCode_verify[0]; //校验物料编码
                           // var HMaterName_verify = HBarCode_verify[1]; //校验物料名称
                           // //var HMaterModel_verify = HBarCode_verify[2]; //校验规格型号
                           // var HSupName_verify = HBarCode_verify[7]; //校验供应商
                           //// var HSourceBillNo_verify = HBarCode_verify[8]; //校验采购订单号
                           // sql = $"select * from Gy_Material where HNumber = '{HMaterNumber_verify}' and HName = '{HMaterName_verify}'";
                           // DataSet verifyMatInfo = oCn.RunProcReturn(sql, "tables");
                           // sql = $"select * from Gy_Supplier where HName = '{HSupName_verify}'";
                           // DataSet verifySupInfo = oCn.RunProcReturn(sql, "tables");
                            string HBarCodeType = "唯一条码";
                            //sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                            //               ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                            //               ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HProduceDate,HExpiryDate,HISKFPERIOD" +
                            //               ") values ("
                            //               + linterid.ToString() + ",'" + TM + "','" + HBarCodeType + "'," + HMaterID + "," + "" + "," + HQty + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                            //               + "','" + HBatchNo + "','" + get_BarCodecount + "','" + virtualCount + "'," + HSupID + "," + "" + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + "1" + ",'" + DateTime.Today + "',1"
                            //               + "," + "1" + "," + "1" + ",'" + "1" + "','" + HSourceBillType + "','" + "1" + "','"
                            //               + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                            sql = "INSERT INTO Gy_BarCodeBill (HInterID, HBarCode, HBarCodeType, HMaterID, HUnitID, HQty, HKFDate, HKFPeriod, HKFDQDate, " +
       "HBatchNo, HBarcodeQtys, HBarcodeNo, HSupID, HGroupID, HMaker, HMakeDate, HPrintQty, HEndQty, HSupflag, " +
       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD) " +
      "VALUES (" +
       linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + HQty + ", '" + HKFDate + "', " + HKFPeriod + ", '" + HKFDQDate + "', " +
       "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + ClsPub.CurUserName + "', '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "1" + ", " + "0" + ", 1, " +
       "1, 1, '1', '" + HSourceBillType + "', '1', '" +
       HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ")";
                            LogService.Write("生成条码: " + sql);
                            oCn.RunProc(sql);
                            oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                            virtualCount++;
                           }
                        }
                }
                oCn.Commit();
            }
            catch (Exception e)
            {
                LogService.Write("生成条码发生错误: " + e);
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "" + e.Message + DBUtility.ClsPub.sExeReturnInfo;
                objJsonResult.data = null;
                return objJsonResult;
            }
            objJsonResult.code = "0";
            objJsonResult.count = 1;
            objJsonResult.Message = "生成条码成功!";
            WebAPIController.Add_Log("条码下推", UserName, "生成条码");
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region 条码列表
        [Route("showHBarCodeBillDetail")]
        [HttpGet]
        public object showHBarCodeBillDetail(string sMsg,string Organization)
        {
            try
            {
                DataSet ds;
                string s = "";
                string ShowItem = " * ";//显示的字段
                if (sMsg == "")
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败";
                    objjson.data = null;
                    return objjson;
                }
                string sql = string.Format(@"select * from h_v_Gy_UserMaterRelationPrint where HItemID in (   " + sMsg)+")";
                ds = oCn.RunProcReturn(sql, "h_v_Gy_UserMaterRelationPrint");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败" + DBUtility.ClsPub.sExeReturnInfo;
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取单据表体失败:" + e.Message;
                objjson.data = null;
                return objjson;
            }
        }
        #endregion
    }
}
WebAPI/ListModels.cs
@@ -118,6 +118,18 @@
            List<Model.ClsSupMaterPackBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSupMaterPackBillSub>>(jsonString);
            return list;
        }
        public List<Model.ClsGy_MaterialBarCodeBillModel> getObjectByJson_BarCodeBill(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_MaterialBarCodeBillModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaterialBarCodeBillModel>>(jsonString);
            return list;
        }
        public List<Model.Cls_MaterialHandingModel> getObjectByJson_MaterialHanding(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(jsonString);
            return list;
        }
    }
}
WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
New file
@@ -0,0 +1,55 @@
#region 程序集 Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// D:\GitHub\SRM-API-HK\WebAPI\DLL\Model.dll
#endregion
using System;
namespace Model
{
    public class ClsGy_MaterialBarCodeBillModel
    {
        public long HItemID;
        public string HKFDQDate;//到期日期
        public long HKFPeriod;//保质期
        public string HKFDate;//生产日期
        public double HMinQty;//标准包装数
        public double HBQty;//最小包装数
        public long HISKFPERIOD;//是否启用保质期
        public long HBatchManager;//是否启用批号
        public string HSourceBillType;//条码类型
        public string HSourceBillNo;//暂定
        public string HBatchNo;//批号
        //物料
        public long HMaterID;
        public string HMaterNumber;
        public string HMaterShortNumber;
        public string HMaterName;
        public string HMaterModel;
        //供应商
        public long HSupID;
        public string HSupName;
        public string HMaker;
        public DateTime HMakeDate;
        public double HQty; //本次生成条码数量
        public double biaoqianzhangshu;
        /// <summary>
        /// 暂定
        /// </summary>
        public string HEndQty;//是否尾箱
        public long HDeptID;
        public long HPrintQty;
        public long HSourceEntryID;
        public long HSourceInterID;
        public string HBarCodeType;
        public long HGroupID;
        public string HRemark;
        // public ClsGy_MaterialBarCodeBillModel();
    }
}
WebAPI/Models/Cls_MaterialHandingModel.cs
New file
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class Cls_MaterialHandingModel : DBUtility.ClsXt_BaseBillMain
    {
        public string HUserID;//     varchar(200)
        public int HSupID;//      int                 --供应商
        public int HItemID;//    int                  --主键
        public string HMaterNumber;//      int     --物料代码
        public string HMaterID;//      int     --物料内码
        public decimal HMinPackQty;//  最小包装
        public decimal HInBoxPackQty;//   标准包装数
        public decimal HOutBoxPackQty;//   标准包装数--默认赋值0
        public int HUSEORGID;//  int                 组织
        public bool HUseFlag;//     启用
        public string HCheckEmp;//  varchar(50)             --审核人
        public string HMakeTime; //创建日期
        public string HCheckTime; //审核日期
    }
}
WebAPI/Views/web.config
New file
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.Optimization" />
        <add namespace="WebAPI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.webServer>
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>
WebAPI/Web.config
@@ -4,8 +4,13 @@
  http://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <appSettings/>
  <!--
    <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    </appSettings>
    <!--
    有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
    可在 <httpRuntime> 标记上设置以下特性。
@@ -13,56 +18,55 @@
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  <system.webServer>
    <httpErrors errorMode="Detailed"/>
  </system.webServer>
  <system.web>
      <customErrors mode="Off"/>
      <compilation debug="true" targetFramework="4.5"/>
      <httpRuntime/>
      <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
      <!--<remove name="OPTIONSVerbHandler"/>-->
      <remove name="TRACEVerbHandler"/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
    <system.web>
        <customErrors mode="Off" />
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime />
        <pages controlRenderingCompatibilityVersion="4.0" />
    </system.web>
    <system.webServer>
        <handlers>
            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
            <!--<remove name="OPTIONSVerbHandler"/>-->
            <remove name="TRACEVerbHandler" />
            <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>-->
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>
WebAPI/WebAPI.csproj
@@ -102,7 +102,7 @@
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\Newtonsoft文件\Newtonsoft.Json.dll</HintPath>
      <HintPath>..\..\NewtonsoftJson\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
      <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.dll</HintPath>
@@ -180,6 +180,7 @@
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Content\Site.css" />
    <Content Include="DLL\BLL.dll" />
    <Content Include="DLL\DAL.dll" />
    <Content Include="DLL\DBUtility.dll" />
@@ -213,6 +214,7 @@
    <Compile Include="Code\Test2.cs" />
    <Compile Include="Code\TestDAL.cs" />
    <Compile Include="Controllers\BasicInfoController.cs" />
    <Compile Include="Controllers\MaterialHandingController.cs" />
    <Compile Include="Controllers\POStockOutBillController.cs" />
    <Compile Include="Controllers\POStockInBillController.cs" />
    <Compile Include="Controllers\QuotePriceBilController.cs" />
@@ -227,6 +229,7 @@
    <Compile Include="Controllers\POOrderController.cs" />
    <Compile Include="Controllers\PublicPageMethodController.cs" />
    <Compile Include="Controllers\ReportController.cs" />
    <Compile Include="Controllers\SRM_MaterialBarCodeBillController.cs" />
    <Compile Include="Controllers\SupMaterPackController.cs" />
    <Compile Include="Controllers\Xt_grdAlignment_WMESController.cs" />
    <Compile Include="DLL\ClsCg_POInStockBills.cs" />
@@ -237,6 +240,8 @@
    <Compile Include="Models\ClsCg_POInStockBill.cs" />
    <Compile Include="Models\ClsCg_POInStockBillMains.cs" />
    <Compile Include="Models\ClsCg_POInStockBillSubs.cs" />
    <Compile Include="Models\ClsGy_MaterialBarCodeBillModel.cs" />
    <Compile Include="Models\Cls_MaterialHandingModel.cs" />
    <Compile Include="Models\json.cs" />
    <Compile Include="Controllers\WebAPIController.cs" />
    <Compile Include="Global.asax.cs">
@@ -258,6 +263,10 @@
    <None Include="Properties\PublishProfiles\SRMAPI.pubxml" />
    <None Include="Properties\PublishProfiles\WEBAPI.pubxml" />
    <None Include="Properties\PublishProfiles\WEBAPIConfig.pubxml" />
    <Content Include="Views\Shared\Error.cshtml" />
    <Content Include="Views\_ViewStart.cshtml" />
    <Content Include="Views\Shared\_Layout.cshtml" />
    <Content Include="Views\web.config" />
    <None Include="Web.Debug.config">
      <DependentUpon>Web.config</DependentUpon>
    </None>
@@ -267,6 +276,9 @@
  </ItemGroup>
  <ItemGroup>
    <Folder Include="App_Data\" />
    <Folder Include="Data\" />
    <Folder Include="Views\MaterialHanding\" />
    <Folder Include="Views\SRM_MaterialBarCodeBill\" />
  </ItemGroup>
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>