1
yangle
1 天以前 6d0bfe2160e06a4502dc3052c43fab9813341db3
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -12,6 +12,7 @@
using WebAPI.Models;
using WebAPI.Service;
using Kingdee.BOS.WebApi.Client;
using SyntacticSugar.constant;
namespace WebAPI.Controllers
{
@@ -34,12 +35,21 @@
        {
            try
            {
                List<object> a = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用
                {
                    Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接         // 将列名和数据类型信息拼接成一个JSON格式的字符串
                    a.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = a;
                return objJsonResult;
                //}
                //else
@@ -2075,6 +2085,7 @@
            DataSet ds;
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -2095,6 +2106,7 @@
                    string sql = sql1 + sWhere + " order by hmainid desc ";
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessPlanList");
                }
            }
            catch (Exception e)
            {
@@ -6110,6 +6122,61 @@
        }
        #endregion
        #region 不良品评审处理单 分页列表
        [Route("Sc_ProcessMangement/getGet_QC_NoPassProdDisposeBillListPage")]
        [HttpGet]
        public json Get_QC_NoPassProdDisposeBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdDisposeBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_QC_NoPassProdDisposeBillList " + page + "," + size + ",''", "h_p_QC_NoPassProdDisposeBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_QC_NoPassProdDisposeBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_QC_NoPassProdDisposeBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        #region 不良品评审处理单 删除
        [Route("Sc_ProcessMangement/DeleteQC_NoPassProdDisposeBill")]
@@ -6528,8 +6595,30 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -6548,8 +6637,31 @@
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeUnCloseCtrl    ");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -6716,6 +6828,45 @@
        }
        #endregion
        #region 不良品评审处理单 出站单下推查询
        [Route("Sc_ProcessMangement/Get_Sc_StationOutBill")]
        [HttpGet]
        public object Get_Sc_StationOutBill(string HID)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_MES_StationOutBillList where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region 不良品评审处理验收单