jhz
2023-03-21 d84518084c3027a684333929ad80b51a0c32845b
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
7个文件已修改
1个文件已添加
447 ■■■■ 已修改文件
Model/Model.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/车间管理/ClsSc_StationOutBillSub_Emp.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/MoveStockBillController.cs 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MaterTypeBillController.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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" />
Model/³µ¼ä¹ÜÀí/ClsSc_StationOutBillSub_Emp.cs
New file
@@ -0,0 +1,20 @@
using 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)
    }
}
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)
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为否,Y为是
                            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为否,Y为是
                                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为否,Y为是
                                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
            {
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using 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
    }
}
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 + ",单据ID:" + 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 + ",单据ID:" + 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;
                    }
                }
                //    }
                //}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/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
    }
}
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\" />