From 7f8ed8cdc49b33178f34c91edf862f831cd30c9c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 08 二月 2023 09:18:04 +0800
Subject: [PATCH] 供应商物料;根据登录用户获取默认值

---
 DAL/基础资料/其他基础资料/ClsGy_SupMaterial_Ctl.cs              |  183 ++++++++++++++++
 Model/基础资料/其他基础资料/ClsGy_SupMaterial_Model.cs          |   24 ++
 WebAPI/Controllers/Gy_StdMinPickQtyController.cs      |  326 +++++++++++++++++++++++++++++
 WebAPI/Models/ClsGy_SupMaterial.cs                    |   25 ++
 DAL/DAL.csproj                                        |    1 
 Model/Model.csproj                                    |    1 
 WebAPI/WebAPI.csproj                                  |    3 
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs |   56 +++++
 8 files changed, 619 insertions(+), 0 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index d40e497..e1bbe84 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -103,6 +103,7 @@
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MateMould_Ctl.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProject_View.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_StdWorkTimes_Ctl.cs" />
+    <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_SupMaterial_Ctl.cs" />
     <Compile Include="婧愬崟\ERP婧愬崟\Cls_S_Sc_ABJJD.cs" />
     <Compile Include="婧愬崟\InterFace婧愬崟\Cls_S_IF_ICMOBillList.cs" />
     <Compile Include="婧愬崟\InterFace婧愬崟\Cls_S_IF_ProcessReportBillList.cs" />
diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Ctl.cs"
new file mode 100644
index 0000000..0d9bf06
--- /dev/null
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Ctl.cs"
@@ -0,0 +1,183 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+
+namespace DAL
+{ 
+   public class ClsGy_SupMaterial_Ctl: DBUtility.ClsGy_Base_Ctl
+    {
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩�
+        public string HOldNumber;
+        public List<Model.ClsGy_SupMaterial_Model> DetailColl = new List<Model.ClsGy_SupMaterial_Model>();
+
+        //鍙嶅鏍�
+        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                oCn.RunProc(" Update Gy_StdMinPickQty set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString());
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }
+
+        //瀹℃牳
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        {
+
+            try
+            {
+                oCn.RunProc(" Update Gy_StdMinPickQty set HUsed=0,HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString());
+                //灏嗗叾浠� 宸ヤ环璁剧疆涓� 鍋滅敤
+                //oCn.RunProc(" exec h_p_Gy_MateMouldStopflag   " + lngBillKey.ToString());
+                //
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }
+
+
+        //鏂板
+        public override bool AddNew()
+        {
+
+            try
+            {
+                oCn.BeginTran();
+
+
+                //鎻掑叆琛�
+                foreach (Model.ClsGy_SupMaterial_Model oSub in DetailColl)
+                {
+                    DataSet Ds;
+                    Int64 HInterID = 1;
+                    Ds = oCn.RunProcReturn("select MAX(HInterID) HInterID from Gy_StdMinPickQty", "Gy_StdMinPickQty");
+                    if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
+                    {
+                        HInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
+                        HInterID += 1;
+                    }
+
+                    DataSet Cs;
+                    Int64 HEntryID = 1;
+                    Cs = oCn.RunProcReturn("select MAX(HEntryID) HEntryID from Gy_StdMinPickQty", "Gy_StdMinPickQty");
+                    if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+                    {
+                        HEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+                        HEntryID += 1;
+                    }
+
+                    oCn.RunProc("Insert into Gy_StdMinPickQty " +
+                        " (HInterID,HEntryID,HMaterID,HPackTypeID,HSupID,HMinQty,HBagQty" +
+                        ",HBeginDate,HEndDate" +
+                        ",HUsed,HRemark,HMaker,HMakeDate)" +
+                        " values(" + HInterID + "," + HEntryID + "," + oSub.HMaterID.ToString() + "," + oSub.HPackTypeID.ToString() + "," + oSub.HSupID.ToString() + "," + oSub.HMinQty.ToString() + "," + oSub.HBagQty.ToString() +
+                        ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "'" + ") ");
+                }
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //淇敼
+        public override bool ModifyByID(Int64 sItemID)
+        {
+            try
+            {
+                oCn.BeginTran();
+                //DeleteByID(sItemID);        //鍒犻櫎璁板綍
+                ////鎻掑叆琛�
+                foreach (Model.ClsGy_SupMaterial_Model oSub in DetailColl)
+                {
+                    //    oCn.RunProc("Insert into Gy_StdMinPickQty " +
+                    //        " (HMaterID,HRelationID,HUnitID" +
+                    //        ",HBeginDate,HEndDate" +
+                    //        ",HUsed,HRemark,HMaker,HMakeDate)" +
+                    //        " values(" + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + "," + oSub.HUnitID.ToString() +
+                    //        ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
+                    oCn.RunProc("Update Gy_StdMinPickQty set " +
+                       "HMaterID=" + oSub.HMaterID  +
+                       ",HSupID =" + oSub.HSupID  +
+                       ",HPackTypeID =" + oSub.HPackTypeID +
+                       ",HMinQty =" + oSub.HMinQty +
+                       ",HBagQty =" + oSub.HBagQty +
+                       ",HRemark='" + oSub.HRemark + "'" +
+                       ",HBeginDate='" + oSub.HBeginDate + "'" +
+                       ",HEndDate='" + oSub.HEndDate + "'" +
+                       //",HStopflag=" + Convert.ToString(HStopflag ? 1 : 0) +
+                       //",HUseFlag=" + Convert.ToString(HUseFlag ? 1 : 0) +
+                       //",HMakeTime= getdate()" +
+                       //",HMakeEmp='" + HMakeEmp + "'" +
+                       /*",HRemark='" + HRemark + */"Where HItemID ='" + sItemID + "'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }               
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //鏄剧ず鍗曟嵁
+        public bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet DsSub = new DataSet();
+                DsSub = oCn.RunProcReturn("Select * from Gy_StdMinPickQty Where HitemID=" + lngBillKey.ToString(), "Gy_StdMinPickQty");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsGy_SupMaterial_Model oSub = new Model.ClsGy_SupMaterial_Model();
+                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                    oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]);
+                    oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]);
+                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
+                    oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]);
+                    oSub.HMakeDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMakeDate"]);
+                    oSub.HChecker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HChecker"]);
+                    oSub.HCheckDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCheckDate"]);
+
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }       
+
+        //鏋勯�犲嚱鏁�
+        public ClsGy_SupMaterial_Ctl()
+        {
+            MvarItemKey = "Gy_StdMinPickQty";
+            MvarReportTitle = "渚涘簲鍟嗗搴旂墿鏂欒祫鏂�";
+        }
+    }
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 959d818..1bb0952 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -303,6 +303,7 @@
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProjectSub.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_SourceShift_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_StdWorkTimes_Model.cs" />
+    <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_SupMaterial_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_TechParamByProc_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_UserCustomerRelation_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_UserDeptRelation_Model.cs" />
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Model.cs"
new file mode 100644
index 0000000..2515b94
--- /dev/null
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_SupMaterial_Model.cs"
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_SupMaterial_Model : DBUtility.ClsGy_Base_Model
+    {
+        public long HInterID;
+        public long HPackTypeID;
+        public long HSupID;
+        public decimal HMinQty;
+        public decimal HBagQty;
+        public long HMaterID;
+        public bool HUsed;         //褰撳墠姝e湪鍚敤
+        public DateTime HBeginDate;
+        public DateTime HEndDate;
+        public string HMaker;
+        public string HMakeDate;
+        public string HChecker;
+        public string HCheckDate;
+    }
+}
diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 9656f57..6d8ee64 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -1042,5 +1042,61 @@
             }
         }
         #endregion
+
+        #region 杩斿洖鐢ㄦ埛鑾峰彇榛樿鍊煎垪琛�
+        [Route("Cj_StationInBill/GetDefValByUser")]
+        [HttpGet]
+        public object GetDefValByUser(string Czybm, string Czymc)
+        {
+            try
+            {
+                ////鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                //if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                if (Czymc == null || Czymc.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Cj_GetDefValByUser", "h_v_Cj_GetDefValByUser");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Cj_GetDefValByUser where 1 = 1 ";
+                    string sql = sql1 + " and 鐢ㄦ埛缂栫爜 ='" + Czybm + "' and 鐢ㄦ埛鍚嶇О ='" + Czymc + "'";
+                    ds = oCN.RunProcReturn(sql, "h_v_Cj_GetDefValByUser");
+                }
+
+                if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳暟鎹�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/Gy_StdMinPickQtyController.cs b/WebAPI/Controllers/Gy_StdMinPickQtyController.cs
new file mode 100644
index 0000000..cefbd07
--- /dev/null
+++ b/WebAPI/Controllers/Gy_StdMinPickQtyController.cs
@@ -0,0 +1,326 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers
+{
+    public class Gy_StdMinPickQtyController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        /// <summary>
+        /// 杩斿洖渚涘簲鍟嗕笌鐗╂枡娓呭崟鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Gy_StdMinPickQty/list")]
+        [HttpGet]
+        public object list(string sWhere, string user, string Organization)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log_second("Gy_StdMinPickQty", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                string sql1 = string.Format(@"select * from h_v_Gy_StdMinPickQtyList where 1 =1 ");//where 缁勭粐鍚嶇О='" + Organization + "'
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_Gy_StdMinPickQtyList");
+                }
+                else
+                {
+                    string sql = sql1 + sWhere + " order by HItemID";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_StdMinPickQtyList");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Gy_StdMinPickQty/cx")]
+        [HttpGet]
+        public object cx(long HInterID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_Gy_StdMinPickQtyList where HitemID=" + HInterID, "h_v_Gy_StdMinPickQtyList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    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;
+            }
+        }
+
+
+        #region 渚涘簲鍟嗕笌鐗╂枡娓呭崟淇濆瓨
+        [Route("Gy_StdMinPickQty/set_SaveBill")]
+        [HttpPost]
+        public object set_SaveBill([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            //淇濆瓨鍗曟嵁
+            return objJsonResult = AddBillMain(msg1);
+        }
+
+        public json AddBillMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string OperationType = sArray[2].ToString().Trim();
+            string msg4 = sArray[3].ToString();
+            bool bResult;
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProcPriceList_Edit", 1, false, msg4))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                msg2 = "[" + msg2.ToString() + "]";
+                List<ClsGy_SupMaterial> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_SupMaterial>>(msg2);
+                List<ClsGy_SupMaterial> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_SupMaterial>>(msg3);
+                DAL.ClsGy_SupMaterial_Ctl BillNew = new DAL.ClsGy_SupMaterial_Ctl();
+                BillNew.DetailColl = new List<Model.ClsGy_SupMaterial_Model>();
+                Model.ClsGy_SupMaterial_Model BillOld = new Model.ClsGy_SupMaterial_Model();
+                for (int i = 0; i < subList.ToArray().Length; i++)
+                {
+                    if (i >= 0)//HQty
+                    {
+                        Model.ClsGy_SupMaterial_Model oSub = new Model.ClsGy_SupMaterial_Model();
+                        oSub.HMaterID = DBUtility.ClsPub.isLong(subList[i].HMaterIDCol);
+                        oSub.HPackTypeID = DBUtility.ClsPub.isLong(subList[i].HPackTypeIDCol);
+                        oSub.HSupID = DBUtility.ClsPub.isLong(subList[i].HSupIDCol);
+                        oSub.HMinQty = DBUtility.ClsPub.isLong(subList[i].HMinQtyCol);
+                        oSub.HBagQty = DBUtility.ClsPub.isLong(subList[i].HBagQtyCol);
+                        oSub.HBeginDate = DBUtility.ClsPub.isDate(subList[i].HBeginDateCol);
+                        oSub.HEndDate = DBUtility.ClsPub.isDate(subList[i].HEndDateCol);
+                        oSub.HUsed = false;
+                        oSub.HMaker = DBUtility.ClsPub.isStrNull(mainList[0].HMaker);
+                        oSub.HMakeDate = DateTime.Today.ToString();
+                        oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[i].HRemarkCol);
+                        BillNew.DetailColl.Add(oSub);
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                if (OperationType.Equals("1.1") || OperationType.Equals("1.2") || OperationType.Equals("2"))
+                {
+                    bResult = BillNew.AddNew();
+                }
+                else
+                {
+                    bResult = BillNew.ModifyByID(DBUtility.ClsPub.isLong(subList[0].HItemID));
+                }
+                //鎻愮ず
+                if (bResult == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    //objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                    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
+
+        #region 缂栬緫鏃惰繑鍥炰緵搴斿晢涓庣墿鏂欐竻鍗曚俊鎭�
+        [Route("Gy_StdMinPickQty/GetSupMaterialValue")]
+        [HttpGet]
+        public object GetSupMaterialValue(int HItemID)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //ds = oCN.RunProcReturn("select * from h_v_Gy_StdMinPickQtyList where HItemID = " + HItemID, "h_v_Gy_StdMinPickQtyList");
+
+                ds = oCN.RunProcReturn("select " +
+                "a.HItemID,a.HMaterID HMaterIDCol,a.鐗╂枡浠g爜,a.鐗╂枡鍚嶇О,a.瑙勬牸鍨嬪彿" +
+                ",a.HSupID HSupIDCol,a.渚涘簲鍟嗕唬鐮� ,a.渚涘簲鍟嗗悕绉� ,a.HPackTypeID HPackTypeIDCol,a.鍖呰鏂瑰紡浠g爜" +
+                ",a.鍖呰鏂瑰紡鍚嶇О ,a.鏍囧噯鍖呰鏁伴噺,a.澶栫鍖呰鏁伴噺" +
+                ",a.寮�濮嬫棩鏈� ,a.缁撴潫鏃ユ湡 ,a.澶囨敞, a.鍒跺崟浜�,a.鍒跺崟鏃ユ湡" +
+                " from h_v_Gy_StdMinPickQtyList a " +
+              
+                "  where a.HItemID = " + HItemID, "Gy_MateMouldInfo");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垪琛ㄤ俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    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鍒楀璞$殑鍒楀悕
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        /// <summary>
+        /// 渚涘簲鍟嗙墿鏂欏垪琛ㄥ垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_StdMinPickQty")]
+        [HttpGet]
+        public object DeltetGy_StdMinPickQty(string HItemID)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+                ds = oCN.RunProcReturn("select * from Gy_StdMinPickQty where HItemID=" + HItemID, "Gy_StdMinPickQty");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+
+                oCN.RunProc("delete from Gy_StdMinPickQty where HItemID=" + HItemID);
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/ClsGy_SupMaterial.cs b/WebAPI/Models/ClsGy_SupMaterial.cs
new file mode 100644
index 0000000..9e696fc
--- /dev/null
+++ b/WebAPI/Models/ClsGy_SupMaterial.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ClsGy_SupMaterial
+    {
+        public long HMaterIDCol { get; set; }
+        public long HPackTypeIDCol { get; set; }
+        public long HSupIDCol { get; set; }
+        public decimal HMinQtyCol { get; set; }
+        public decimal HBagQtyCol { get; set; }
+
+        public DateTime HBeginDateCol { get; set; }
+
+        public DateTime HEndDateCol { get; set; }
+
+        public string HMaker { get; set; }
+
+        public string HRemarkCol { get; set; }
+        public long HItemID { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 5825756..5f317b8 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -393,6 +393,7 @@
     <Compile Include="Controllers\CJGL\Cj_StationEntrustOutBillController.cs" />
     <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" />
     <Compile Include="Controllers\Gy_MateMouldController.cs" />
+    <Compile Include="Controllers\Gy_StdMinPickQtyController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldDotCheckRuleBillController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldLifeUseBillController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldScrapRequestBillController.cs" />
@@ -605,6 +606,7 @@
     <Compile Include="InvokeHelper.cs" />
     <Compile Include="Log.cs" />
     <Compile Include="Models\ClsGy_MateMould.cs" />
+    <Compile Include="Models\ClsGy_SupMaterial.cs" />
     <Compile Include="Models\ClsSc_AssemblyBillMain.cs" />
     <Compile Include="Models\ClsSc_AssemblyBillSub.cs" />
     <Compile Include="Models\Employee.cs" />
@@ -930,6 +932,7 @@
     <Folder Include="Views\Gy_SettleStyle\" />
     <Folder Include="Views\Gy_SOPBill\" />
     <Folder Include="Views\Gy_Staff\" />
+    <Folder Include="Views\Gy_StdMinPickQty\" />
     <Folder Include="Views\Gy_StockPlace_\" />
     <Folder Include="Views\Gy_StockStatusBill\" />
     <Folder Include="Views\Gy_SupplierContactBill\" />

--
Gitblit v1.9.1