From d84518084c3027a684333929ad80b51a0c32845b Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期二, 21 三月 2023 10:23:50 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs        |    4 
 WebAPI/Controllers/MoveStockBillController.cs                |   54 +++---
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs |  150 +++++++++++++----
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs       |  135 ++++++++++++++++
 WebAPI/Controllers/基础资料/基础资料/Gy_MaterTypeBillController.cs   |   81 ++++++++++
 Model/Model.csproj                                           |    1 
 Model/车间管理/ClsSc_StationOutBillSub_Emp.cs                    |   20 ++
 WebAPI/WebAPI.csproj                                         |    2 
 8 files changed, 376 insertions(+), 71 deletions(-)

diff --git a/Model/Model.csproj b/Model/Model.csproj
index def7f4d..62e79e7 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -714,6 +714,7 @@
     <Compile Include="杞﹂棿绠$悊\ClsSc_StationInBillSub.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_StationOutBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_StationOutBillSub.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsSc_StationOutBillSub_Emp.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_StationOutBillSub_Item.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_ABJJDMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsWW_EntrustWorkOrderBillMain.cs" />
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBillSub_Emp.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBillSub_Emp.cs"
new file mode 100644
index 0000000..2cf43e0
--- /dev/null
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBillSub_Emp.cs"
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+
+namespace Model
+{
+    public class ClsSc_StationOutBillSub_Emp : DBUtility.ClsXt_BaseBillSub
+    {
+        public string HBillNo_bak; //鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級
+        public Int64 HItemSubID; //鑷鍒�(GUID)
+        public Int64 HWorkEmpID; //鎿嶄綔鍛�(Gy_Employee)
+        public Int64 HWorkSourceID; //鐢熶骇璧勬簮(Gy_Source)
+        public decimal HQty ; //鐢熶骇鏁伴噺
+        public decimal HRate;//鍛樺伐绯绘暟
+        public decimal HProcPrice;//宸ヤ环
+        public decimal HMoney; //閲戦
+        public Int64 HWorkProcID; //宸ュ簭(Gy_Process)
+    }
+}
diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
index 0ce78f0..d6ae83c 100644
--- a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -573,13 +573,13 @@
 ,HMaker,HMakeDate,HChecker,HCheckDate,HOWNERTYPEID,HOWNERID
 ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID
 ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID
-,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID)
+,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo)
 values(" + mainList[0].HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" +
 mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "'," + mainList[0].HBillStatus + "," + mainList[0].HSupID +
 "," + mainList[0].HManagerID + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker +
 "','" + mainList[0].HMakeDate + "','" + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HOWNERTYPEID + "'," + mainList[0].HOWNERID + "," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "'," + mainList[0].HPURCHASEORGID + "," + mainList[0].HSTOCKORGID + "," + mainList[0].HREQUIREORGID + "," +
 mainList[0].HSTOCKGROUPID + ",'" + mainList[0].HSENDBILLNO + "','" + mainList[0].HLADBILLNO + "'," + mainList[0].HPURDEPTID + "," + mainList[0].HPURGROUPID + "," + mainList[0].HSUPPLYID + "," +
-mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + ")";
+mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + "," + mainList[0].HInnerBillNo + ")";
                 oCN.RunProc(sql);
                 //淇濆瓨涓昏〃
                 foreach (var oSub in subList)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 95da203..d8fe2f7 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -141,10 +141,10 @@
         }
         #endregion
 
-        #region 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇鏉$爜淇℃伅2锛堝澶栧伐搴忔帴鏀躲�佸伐搴忚繘绔欐帴鏀堕�氱敤锛�
+        #region 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇鏉$爜淇℃伅2
         [Route("Cj_StationBill/txtHBarCode_KeyDown2")]
         [HttpGet]
-        public object txtHBarCode_KeyDown2(string HBarCode,string HInterID,string UserID)
+        public object txtHBarCode_KeyDown2(string HBarCode,string HInterID,string UserID,string HBillType)
         {
             try
             {
@@ -204,15 +204,31 @@
                         string sReturn = "";
                         if (oSystemParameter.ShowBill(ref sReturn) == true)
                         {
-                            //绯荤粺鍙傛暟鏄惁涓哄彧鏄剧ず褰撳墠鐧诲綍鐢ㄦ埛鍏宠仈鐨勫伐搴忎俊鎭�,N涓哄惁锛孻涓烘槸
-                            if (oSystemParameter.omodel.MES_StationInBill_ShowUSERProcess == "Y")
+                            if(HBillType == "In")
                             {
-                                ds = oCN.RunProcReturn("select * from h_v_Gy_ProcessList_GetProcNoByUser  where HItemID = '" + BillNo + "' and HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 = '" + UserID + "'", "h_v_Gy_ProcessList_GetProcNoByUser");
+                                //绯荤粺鍙傛暟鏄惁涓哄彧鏄剧ず褰撳墠鐧诲綍鐢ㄦ埛鍏宠仈鐨勫伐搴忎俊鎭�,N涓哄惁锛孻涓烘槸
+                                if (oSystemParameter.omodel.MES_StationInBill_ShowUSERProcess == "Y")
+                                {
+                                    ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_ProcessList_GetProcNoByUser where HItemID = '" + BillNo + "' and HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 = '" + UserID + "'" + " order by 搴忓彿 asc", "h_v_Gy_ProcessList_GetProcNoByUser");
+                                }
+                                else
+                                {
+                                    ds = oCN.RunProcReturn("select * from h_v_Gy_ProcessList_GetProcNo  where HItemID = '" + BillNo + "' and HInterID = '" + 
+                                      HInterID + "'" + " order by 搴忓彿 asc", "h_v_Gy_ProcessList_GetProcNo");
+                                }
                             }
-                            else
+                            else if(HBillType == "Out")
                             {
-                                ds = oCN.RunProcReturn("select * from h_v_Gy_ProcessList_GetProcNo  where HItemID = '" + BillNo + "' and HInterID = '" + 
-                                  HInterID + "'", "h_v_Gy_ProcessList_GetProcNo");
+                                //绯荤粺鍙傛暟鏄惁涓哄彧鏄剧ず褰撳墠鐧诲綍鐢ㄦ埛鍏宠仈鐨勫伐搴忎俊鎭�,N涓哄惁锛孻涓烘槸
+                                if (oSystemParameter.omodel.MES_StationOutBill_ShowUSERProcess == "Y")
+                                {
+                                    ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_ProcessList_GetProcNoByUser where HItemID = '" + BillNo + "' and HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 = '" + UserID + "'" + " order by 搴忓彿 asc", "h_v_Gy_ProcessList_GetProcNoByUser");
+                                }
+                                else
+                                {
+                                    ds = oCN.RunProcReturn("select * from h_v_Gy_ProcessList_GetProcNo  where HItemID = '" + BillNo + "' and HInterID = '" +
+                                      HInterID + "'" + " order by 搴忓彿 asc", "h_v_Gy_ProcessList_GetProcNo");
+                                }
                             }
                         }
                         break;
@@ -265,59 +281,115 @@
         #region 鏍规嵁鐧诲綍鐢ㄦ埛鑾峰彇宸ュ簭
         [Route("Sc_StationInBill/autoGetProcNo")]
         [HttpGet]
-        public object autoGetProcNo(string HUserID, string HInterID)
+        public object autoGetProcNo(string HUserID, string HInterID, string BillType)
         {
             string sReturn = "";
             if (oSystemParameter.ShowBill(ref sReturn) == true)
             {
-                //绯荤粺鍙傛暟鏄惁涓鸿嚜鍔ㄥ尮閰嶆祦姘村彿,N涓烘墜鍔ㄨ緭鍏ワ紝Y涓鸿嚜鍔ㄥ尮閰�
-                if (oSystemParameter.omodel.MES_StationOutBill_ShowUSERProcess == "Y")
+                if(BillType == "In")//宸ュ簭杩涚珯鎺ユ敹鍗�
                 {
-                    try
+                    //绯荤粺鍙傛暟鏄惁涓鸿嚜鍔ㄥ尮閰嶆祦姘村彿,N涓烘墜鍔ㄨ緭鍏ワ紝Y涓鸿嚜鍔ㄥ尮閰�
+                    if (oSystemParameter.omodel.MES_StationInBill_AutoFindSNO == "Y")
                     {
-                        if (HUserID == null || HUserID.Equals(""))
+                        try
+                        {
+                            if (HUserID == null || HUserID.Equals(""))
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鐢ㄦ埛缂栫爜涓嶈兘涓虹┖锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            //寰楀埌淇℃伅                     
+                            ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_StationBill_autoGetProcNo  where HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 ='" + HUserID + "'" + " and 绱杩涚珯鏁伴噺 < 璁″垝鏁伴噺 and 涓嬮亾娴佽浆宸ュ簭<>'杞�' and 濮斿鏍囪=0 order by 搴忓彿 asc", "h_v_Sc_StationBill_autoGetProcNo");
+                            //鍐欏叆淇℃伅
+                            if (ds == null || ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鏈煡璇㈠埌宸ュ簭淇℃伅锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            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 = "鐢ㄦ埛缂栫爜涓嶈兘涓虹┖锛�";
+                            objJsonResult.Message = "Exception锛�" + e.ToString();
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //寰楀埌淇℃伅
-                        ds = oCN.RunProcReturn("select  * from h_v_Sc_StationBill_autoGetProcNo  where HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 ='" + HUserID + "'", "h_v_Sc_StationBill_autoGetProcNo");
-                        //鍐欏叆淇℃伅
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鏈煡璇㈠埌宸ュ簭淇℃伅锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "Sucess锛�";
-                        objJsonResult.data = ds.Tables[0];
-                        return objJsonResult;
                     }
-                    catch (Exception e)
+                    else
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "Exception锛�" + e.ToString();
-                        objJsonResult.data = null;
+                        objJsonResult.Message = "鎵嬪姩杈撳叆妯″紡";
+                        objJsonResult.data = "";
+                        return objJsonResult;
+                    }
+                }
+                else if(BillType == "Out")//宸ュ簭鍑虹珯姹囨姤鍗�
+                {
+                    //绯荤粺鍙傛暟鏄惁涓鸿嚜鍔ㄥ尮閰嶆祦姘村彿,N涓烘墜鍔ㄨ緭鍏ワ紝Y涓鸿嚜鍔ㄥ尮閰�
+                    if (oSystemParameter.omodel.MES_StationOutBill_AutoFindSNO == "Y")
+                    {
+                        try
+                        {
+                            if (HUserID == null || HUserID.Equals(""))
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鐢ㄦ埛缂栫爜涓嶈兘涓虹┖锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            //寰楀埌淇℃伅
+                            ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_StationBill_autoGetProcNo  where HInterID = '" + HInterID + "' and 鐢ㄦ埛缂栫爜 ='" + HUserID + "'" + " and 绱鍑虹珯鏁伴噺 < 璁″垝鏁伴噺 and 涓嬮亾娴佽浆宸ュ簭<>'杞�' and 濮斿鏍囪=0 order by 搴忓彿 asc", "h_v_Sc_StationBill_autoGetProcNo");
+                            //鍐欏叆淇℃伅
+                            if (ds == null || ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鏈煡璇㈠埌宸ュ簭淇℃伅锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            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;
+                        }
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎵嬪姩杈撳叆妯″紡";
+                        objJsonResult.data = "";
                         return objJsonResult;
                     }
                 }
                 else
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鎵嬪姩杈撳叆妯″紡";
-                    objJsonResult.data = "";
-                    return objJsonResult;
+                    return 0;
                 }
-
             }
             else
             {
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 9412611..0d824de 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing Model;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
@@ -1639,7 +1640,137 @@
         }
         #endregion
 
+        #region 杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曟槑缁嗗垪琛�
+        [Route("Cj_StationOutBill_Detail/get_Display2")]
+        [HttpGet]
+        public object get_Display2(string HMaterID, string HWorkProcID, string HProcExchBillNo)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill_Detail where 宸ュ簭ID = " + HWorkProcID + " and 鐗╂枡ID = " + HMaterID + " and 娴佽浆鍗″彿 = '" + HProcExchBillNo + "'" , "h_v_GetStationOutBill_Detail");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "宸ュ簭鍑虹珯姹囨姤鍗曟槑缁嗕俊鎭幏鍙栧け璐ワ紒";
+                    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;
+            }
+        }
+        #endregion
 
-        
+        #region 鏄庣粏 淇濆瓨/缂栬緫鍔熻兘
+        //[Route("Cj_StationOutBill/AddBill_Detail")]
+        //[HttpPost]
+        //public object AddBill_Detail([FromBody] JObject sMain)
+        //{
+        //    try
+        //    {
+        //        var _value = sMain["sMainSub"].ToString();
+        //        string msg1 = _value.ToString();
+        //        oCN.BeginTran();
+        //        //淇濆瓨涓昏〃
+        //        objJsonResult = Add_Detail(msg1);
+        //        if (objJsonResult.code == "0")
+        //        {
+        //            oCN.RollBack();
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = objJsonResult.Message;
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+        //        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 = "淇濆瓨澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = null;
+        //        return objJsonResult;
+        //    }
+        //}
+
+        //public json Add_Detail(string msg1)
+        //{
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    string msg2 = sArray[0].ToString(); //琛ㄥご鏁版嵁
+        //    string msg3 = sArray[1].ToString(); //琛ㄤ綋鏁版嵁
+        //    int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+        //    string user = sArray[3].ToString(); //鐢ㄦ埛鍚�
+        //    try
+        //    {                              
+        //        List<ClsSc_StationOutBillSub_Emp> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg2);
+
+        //        List<ClsSc_StationOutBillSub_Emp> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg3);
+             
+        //        long HWorkEmpID = subList[0].HWorkEmpID;
+        //        long HWorkSourceID = subList[0].HWorkSourceID;
+        //        decimal HQty = subList[0].HQty;
+        //        decimal HRate = subList[0].HRate;
+        //        decimal HProcPrice = subList[0].HProcPrice;
+        //        decimal HMoney = subList[0].HMoney;
+        //        long HWorkProcID = mainList[0].HWorkProcID;           
+
+        //        foreach (ClsSc_StationOutBillSub_Emp oSub in subList)
+        //        {
+        //            //ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ICMOBillList");
+
+        //            if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+        //            {
+        //                //涓昏〃
+        //                oCN.RunProc(@"Insert Into Sc_StationOutBillSub_Emp   
+        //                    (HBillNo_bak ,HCloseMan ,HEntryCloseDate ,HCloseType ,HRemark ,HSourceInterID
+        //                    ,HSourceEntryID ,HSourceBillNo ,HSourceBillType ,HRelationQty ,HRelationMoney 
+        //                    ,HWorkEmpID ,HWorkSourceID ,HQty ,HRate ,HProcPrice 
+        //                    ,HMoney ,HWorkProcID)
+        //                    values('3710',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
+        //                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
+        //                ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
+        //                "," + HCenterID + ",0,0,0,0," + HBomID + ",'','') ");
+        //            }               
+        //        }
+
+        //        objJsonResult.code = "1";
+        //        objJsonResult.count = 1;
+        //        objJsonResult.Message = null;
+        //        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/MoveStockBillController.cs b/WebAPI/Controllers/MoveStockBillController.cs
index fa54883..e2e8af1 100644
--- a/WebAPI/Controllers/MoveStockBillController.cs
+++ b/WebAPI/Controllers/MoveStockBillController.cs
@@ -614,7 +614,7 @@
                 websLsmain.HBillerID = 0;
                 websLsmain.HExplanation = "";
                 websLsmain.HInnerBillNo = "";
-                websLsmain.HRedBlueFlag = true;
+                websLsmain.HRedBlueFlag = false;
                 websLsmain.HMainSourceBillType = "-1";
                 websLsmain.HStockStyle = "";
                 websLsmain.HBillType = "1207";
@@ -622,34 +622,34 @@
                 websLsmain.HSupID = 0;
                 //websLsmain.HGroupID = lsmain[0].HGroupID;
                 string sErrMsg = "";
-                //涓婁紶鍓嶅垽鏂�
-                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_MoveStockBill_AR " + websLsmain.HInterID.ToString() + ",'" + websLsmain.HBillNo + "','" + websLsmain.HBillType + "'", "h_p_WMS_BeforeUpload_MoveStockBill_AR");
-                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
-                {
-                    sErrMsg = "鏍¢獙涓婁紶鍓嶅垽鏂紝鍙戠敓閿欒锛�"; 
-                    //return false;
+                ////涓婁紶鍓嶅垽鏂�
+                //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                //DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_MoveStockBill_AR " + websLsmain.HInterID.ToString() + ",'" + websLsmain.HBillNo + "','" + websLsmain.HBillType + "'", "h_p_WMS_BeforeUpload_MoveStockBill_AR");
+                //if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                //{
+                //    sErrMsg = "鏍¢獙涓婁紶鍓嶅垽鏂紝鍙戠敓閿欒锛�"; 
+                //    //return false;
 
-                    objJsonResult.code = "99";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "涓婁紶澶辫触锛�" + sErrMsg;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
-                    {
-                        sErrMsg = "鍗曟嵁鍙凤細" + websLsmain.HBillNo + "锛屽崟鎹甀D锛�" + websLsmain.HInterID + "锛�" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
-                        //return false;
-                        objJsonResult.code = "99";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "涓婁紶澶辫触锛�" + sErrMsg;
-                        objJsonResult.data = null;
-                        return objJsonResult;
+                //    objJsonResult.code = "99";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "涓婁紶澶辫触锛�" + sErrMsg;
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //else
+                //{
+                //    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
+                //    {
+                //        sErrMsg = "鍗曟嵁鍙凤細" + websLsmain.HBillNo + "锛屽崟鎹甀D锛�" + websLsmain.HInterID + "锛�" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                //        //return false;
+                //        objJsonResult.code = "99";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "涓婁紶澶辫触锛�" + sErrMsg;
+                //        objJsonResult.data = null;
+                //        return objJsonResult;
 
-                    }
-                }
+                //    }
+                //}
 
 
 
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
index 1cca132..ad6e613 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
@@ -356,5 +356,86 @@
             }
         }
         #endregion
+
+        #region 鐗╂枡鍒嗙被 鏍戝舰鍥�
+        public class TreeModel
+        {
+            public string id { get; set; }
+            public string title { get; set; }
+            public List<TreeModel> children = new List<TreeModel>();
+        }
+        [Route("Gy_MaterType/Gy_MaterTypeTreeList")]
+        [HttpGet]
+        public object Gy_DutyBillTreeList()
+        {
+            try
+            {
+                string sql1 = string.Format("select hitemid,hnumber,hname from Gy_MaterType order by hnumber");
+
+                ds = oCN.RunProcReturn(sql1, "Gy_MaterType");
+
+                List<TreeModel> treeModels = new List<TreeModel>();
+                TreeModel first = new TreeModel();
+                first.id = "0";
+                first.title = "鐗╂枡鍒嗙被璁剧疆";
+                treeModels.Add(first);
+
+                foreach (DataRow row in ds.Tables[0].Rows)
+                {
+                    var strLen = row["hnumber"].ToString().Split('.');
+                    if (strLen.Length == 1)
+                    {
+                        TreeModel tree = new TreeModel();
+                        tree.id = row["hnumber"].ToString();
+                        tree.title = row["hname"].ToString();
+                        treeModels[0].children.Add(tree);
+                    }
+                }
+                digui(ds.Tables[0], treeModels[0].children, 2);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 閫掑綊鍑芥暟
+        /// </summary>
+        public void digui(DataTable dt, List<TreeModel> tree, int num)
+        {
+            for (int m = 0; m < tree.Count; m++)
+            {
+                tree[m].children = new List<TreeModel>();
+                for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+                {
+                    var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
+                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
+                    {
+                        TreeModel tbjson = new TreeModel();
+                        tbjson.id = dt.Rows[i]["hnumber"].ToString();
+                        tbjson.title = dt.Rows[i]["hname"].ToString();
+                        tree[m].children.Add(tbjson);
+                    }
+                }
+                var strLens = tree[m].id.Split('.');
+                for (int i = 0; i < tree[m].children.Count; i++)
+                {
+                    digui(dt, tree[m].children, strLens.Length + 2);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+                }
+            }
+
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index ac244ed..66146ee 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -998,8 +998,8 @@
     <Folder Include="Views\Sc_MouldScrapRequestBill\" />
     <Folder Include="Views\Sc_MouldStatusChangeBill\" />
     <Folder Include="Views\Sc_ProcessExchangeIssueBill\" />
-    <Folder Include="Views\Sc_ProcExchRecordBackBill\" />
     <Folder Include="Views\Sc_ProcessSendWork\" />
+    <Folder Include="Views\Sc_ProcExchRecordBackBill\" />
     <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" />
     <Folder Include="Views\Sc_WorkBillSortBill\" />
     <Folder Include="Views\Sc_WorkDemandPlanBill\" />

--
Gitblit v1.9.1