From 19ba8796510e5b5835c355530128df9e51e308aa Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 09 九月 2025 14:15:21 +0800
Subject: [PATCH] 条码生成打印,物料校验
---
WebAPI/Controllers/MaterialHandingController.cs | 581 ++++++++++++++++++++++++++
WebAPI/Models/Cls_MaterialHandingModel.cs | 23 +
WebAPI/App_Start/BundleConfig.cs | 30 +
WebAPI/App_Start/FilterConfig.cs | 13
WebAPI/App_Start/RouteConfig.cs | 24 +
WebAPI/App_Start/RouteConfig2.cs | 24 +
WebAPI/App_Start/BundleConfig2.cs | 30 +
WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs | 55 ++
WebAPI/ListModels.cs | 12
WebAPI/Web.config | 110 ++--
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs | 336 +++++++++++++++
WebAPI/App_Start/FilterConfig2.cs | 13
WebAPI/Content/Site.css | 18
WebAPI/WebAPI.csproj | 14
14 files changed, 1,229 insertions(+), 54 deletions(-)
diff --git a/WebAPI/App_Start/BundleConfig.cs b/WebAPI/App_Start/BundleConfig.cs
new file mode 100644
index 0000000..30ece6c
--- /dev/null
+++ b/WebAPI/App_Start/BundleConfig.cs
@@ -0,0 +1,30 @@
+锘縰sing 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"));
+ }
+ }
+}
diff --git a/WebAPI/App_Start/BundleConfig2.cs b/WebAPI/App_Start/BundleConfig2.cs
new file mode 100644
index 0000000..bbd08ad
--- /dev/null
+++ b/WebAPI/App_Start/BundleConfig2.cs
@@ -0,0 +1,30 @@
+锘縰sing 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"));
+ }
+ }
+}
diff --git a/WebAPI/App_Start/FilterConfig.cs b/WebAPI/App_Start/FilterConfig.cs
new file mode 100644
index 0000000..6c937bc
--- /dev/null
+++ b/WebAPI/App_Start/FilterConfig.cs
@@ -0,0 +1,13 @@
+锘縰sing System.Web;
+using System.Web.Mvc;
+
+namespace WebAPI
+{
+ public class FilterConfig
+ {
+ public static void RegisterGlobalFilters(GlobalFilterCollection filters)
+ {
+ filters.Add(new HandleErrorAttribute());
+ }
+ }
+}
diff --git a/WebAPI/App_Start/FilterConfig2.cs b/WebAPI/App_Start/FilterConfig2.cs
new file mode 100644
index 0000000..26bf32a
--- /dev/null
+++ b/WebAPI/App_Start/FilterConfig2.cs
@@ -0,0 +1,13 @@
+锘縰sing System.Web;
+using System.Web.Mvc;
+
+namespace WebAPI
+{
+ public class FilterConfig2
+ {
+ public static void RegisterGlobalFilters(GlobalFilterCollection filters)
+ {
+ filters.Add(new HandleErrorAttribute());
+ }
+ }
+}
diff --git a/WebAPI/App_Start/RouteConfig.cs b/WebAPI/App_Start/RouteConfig.cs
new file mode 100644
index 0000000..f22bd21
--- /dev/null
+++ b/WebAPI/App_Start/RouteConfig.cs
@@ -0,0 +1,24 @@
+锘縰sing 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 }
+ );
+ }
+ }
+}
+
diff --git a/WebAPI/App_Start/RouteConfig2.cs b/WebAPI/App_Start/RouteConfig2.cs
new file mode 100644
index 0000000..f28b371
--- /dev/null
+++ b/WebAPI/App_Start/RouteConfig2.cs
@@ -0,0 +1,24 @@
+锘縰sing 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 }
+ );
+ }
+ }
+}
+
diff --git a/WebAPI/Content/Site.css b/WebAPI/Content/Site.css
new file mode 100644
index 0000000..c631428
--- /dev/null
+++ b/WebAPI/Content/Site.css
@@ -0,0 +1,18 @@
+锘縝ody {
+ 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;
+}
+
diff --git a/WebAPI/Controllers/MaterialHandingController.cs b/WebAPI/Controllers/MaterialHandingController.cs
new file mode 100644
index 0000000..d287e02
--- /dev/null
+++ b/WebAPI/Controllers/MaterialHandingController.cs
@@ -0,0 +1,581 @@
+锘縰sing 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+ 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鑾峰彇鐨剆ql鍚庢湡璁板緱鏀瑰洖渚涘簲鍟嗭紝淇敼浜�->渚涘簲鍟�
+ var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 鐗╂枡浠g爜='" + 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 鎵ц鍙傛暟鍖朥PDATE鏌ヨ锛屽拷鐣ヨ繑鍥炵殑 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
+
+
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
new file mode 100644
index 0000000..debdad8
--- /dev/null
+++ b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -0,0 +1,336 @@
+锘縰sing 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;//鐗╂枡浠g爜
+ 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++)
+ {
+ ///渚涘簲鍟嗗悕绉�+@+鐗╂枡浠g爜+@+鐗╂枡绠�绉�+@+鏁伴噺+@+鏃ユ湡+@+娴佹按鍙�
+ 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
+
+
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 34a10f7..1525efb 100644
--- a/WebAPI/ListModels.cs
+++ b/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;
+ }
}
}
\ No newline at end of file
diff --git a/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs b/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
new file mode 100644
index 0000000..249ad80
--- /dev/null
+++ b/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Cls_MaterialHandingModel.cs b/WebAPI/Models/Cls_MaterialHandingModel.cs
new file mode 100644
index 0000000..9324239
--- /dev/null
+++ b/WebAPI/Models/Cls_MaterialHandingModel.cs
@@ -0,0 +1,23 @@
+锘縰sing 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 --鐗╂枡浠g爜
+ 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; //瀹℃牳鏃ユ湡
+ }
+}
diff --git a/WebAPI/Web.config b/WebAPI/Web.config
index 447dd62..f1336e9 100644
--- a/WebAPI/Web.config
+++ b/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>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 99907d7..faeb5c1 100644
--- a/WebAPI/WebAPI.csproj
+++ b/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>
--
Gitblit v1.9.1