duhe
2023-12-11 2d98e07db706e1a882fff03685411b103d747a34
WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1856,11 +1856,11 @@
            try
            {
                string sql = @"select 
                            c.HEmpID
                            ISNULL(c.HEmpID,0) HEmpID
                            ,e.HName HEmpName
                            ,c.HDeptID
                            ,ISNULL(c.HDeptID,0) HDeptID
                            ,d.HName HDeptName
                            ,d.HEmpID HManagerID
                            ,ISNULL(d.HEmpID,0) HManagerID
                            ,e1.HName HManagerName
                            from Gy_Czygl as c
                            left join Gy_Employee as e on c.HEmpID = e.HItemID
@@ -1914,27 +1914,29 @@
                }
                else
                {
                    string sql = "select * from Gy_UserCustomerRelation where HUserID = '" + CurUserID + "'";
                    ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        sWhere = " and 1 = 0";
                    }
                    else
                    {
                        sWhere = " and HCusID in (";
                        for(var i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (i < ds.Tables[0].Rows.Count - 1)
                            {
                                sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ",";
                            }
                            else
                            {
                                sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ")";
                            }
                        }
                    }
                    //string sql = "select * from Gy_UserCustomerRelation where HUserID = '" + CurUserID + "'";
                    //ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
                    //if (ds == null || ds.Tables[0].Rows.Count == 0)
                    //{
                    //    sWhere = " and 1 = 0";
                    //}
                    //else
                    //{
                    //    sWhere = " and HCusID in (";
                    //    for(var i = 0; i < ds.Tables[0].Rows.Count; i++)
                    //    {
                    //        if (i < ds.Tables[0].Rows.Count - 1)
                    //        {
                    //            sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ",";
                    //        }
                    //        else
                    //        {
                    //            sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ")";
                    //        }
                    //    }
                    //}
                    sWhere = " and 1=1 ";
                }
                objJsonResult.code = "1";
@@ -1992,5 +1994,144 @@
            }
        }
        #endregion
        #region 销售订单 检查单据是否存在
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <returns></returns>
        [Route("Xs_SeOrderBill/CheckSeOrderBill_IsExist")]
        [HttpGet]
        public object CheckSeOrderBill_IsExist(int HInterID)
        {
            try
            {
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill();                              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据存在";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "程序错误!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 销售订单 下查
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <returns></returns>
        [Route("Xs_SeOrderBill/SeOrderBill_LookDown")]
        [HttpGet]
        public object SeOrderBill_LookDown(int HInterID)
        {
            try
            {
                List<object> columnNameListSum = new List<object>();
                List<object> columnNameList0 = new List<object>();
                List<object> columnNameList1 = new List<object>();
                List<object> columnNameList2 = new List<object>();
                List<object> columnNameList3 = new List<object>();
                List<object> columnNameList4 = new List<object>();
                string sql = "exec h_p_Xs_SeOrderBill_lookdown " + HInterID;
                ds = oCN.RunProcReturn(sql, "h_p_Xs_SeOrderBill_lookdown");
                //添加 销售订单变更单 列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //添加 生产订单 列名
                foreach (DataColumn col in ds.Tables[1].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList1.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //添加 特批申请单 列名
                foreach (DataColumn col in ds.Tables[2].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //添加 销售出库单 列名
                foreach (DataColumn col in ds.Tables[3].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList3.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //添加 工序流转卡 列名
                foreach (DataColumn col in ds.Tables[4].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList4.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                columnNameListSum.Add(columnNameList0);
                columnNameListSum.Add(columnNameList1);
                columnNameListSum.Add(columnNameList2);
                columnNameListSum.Add(columnNameList3);
                columnNameListSum.Add(columnNameList4);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables;
                objJsonResult.list = columnNameListSum;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}