yusijie
2 天以前 6866dbd4b0b8703811872669179a68841eea803d
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -907,6 +907,7 @@
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HBarCode = DBUtility.ClsPub.isStrNull(oItem.HBarCode);
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
@@ -7409,7 +7410,6 @@
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -7436,9 +7436,128 @@
        }
        #endregion
        #region 工作联系单列表
        #region 工作联系单列表 使用下拉加载 调用存储过程
        [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillListProcess")]
        [HttpGet]
        public object GetOA_WorkLinkBillList2(string beginDate, string endDate, string user, string type, int page = -1, int size = -1)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = $"exec h_p_OA_WorkLinkBillAllList '{user}', '{type}', '{page}', '{size}', '{beginDate}', '{endDate}'";
                ds = oCN.RunProcReturn(sql, "h_p_OA_WorkLinkBillAllList");
                //添加列名
                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
        #region 工作联系单列表 使用下拉加载
        [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillList")]
        [HttpGet]
        public object GetOA_WorkLinkBillList2(string sWhere, string user, int page = -1, int size = -1)
        {
            if(page == -1 || size == -1)
            {
                return GetOA_WorkLinkBillList(sWhere, user);
            }else
            {
                try
                {
                    List<object> columnNameList = new List<object>();
                    //查看权限
                    if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBillList", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无查看权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (sWhere == null || sWhere.Equals(""))
                    {
                        string sql = "select * from h_v_OA_WorkLinkBillAllList order by 单据号 desc";
                        sql += $@" OFFSET {(page-1)*size} ROWS
                                FETCH NEXT {size} ROWS ONLY; ";
                        ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList");
                    }
                    else
                    {
                        string sql1 = "select * from h_v_OA_WorkLinkBillAllList where 1 = 1 ";
                        string sql = sql1 + sWhere + " order by 单据号 desc";
                        sql += $@" OFFSET {(page - 1) * size} ROWS
                                FETCH NEXT {size} ROWS ONLY; ";
                        ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList");
                    }
                    //添加列名
                    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
        #region 工作联系单列表
        public object GetOA_WorkLinkBillList(string sWhere, string user)
        {
            try
@@ -7464,6 +7583,7 @@
                {
                    string sql1 = "select * from h_v_OA_WorkLinkBillAllList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 单据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList");
                }
@@ -8232,14 +8352,29 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from OA_WorkLinkBillSub where HInterID = '" + HInterID + "'order by HDate desc";
                string sql = $@"select HSendMan 回复人, HDescription 回复内容, HDate 回复时间,
                                case HSendStatus
                                when 1 then '普通'
                                when 10 then '验证通过'
                                when 9 then '结案'
                                end as 类型
                                ,* from OA_WorkLinkBillSub where HInterID = '" + HInterID + "'order by HDate desc";
                ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillSub");
                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 e)
@@ -8577,7 +8712,18 @@
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery  '" + HStatus + "','" + HBeginDate + "','" + HEndDate + "','" + HSourceID + "','" + user + "'"  , "h_p_OA_ErrMsgBackSelfQuery");
                string sReturn = "";
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    if (oSystemParameter.omodel.OA_ErrMsgBackBill_Role == "Y") //系统参数  根据角色查看对应的单据进行下推
                    {
                        ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery_Role  '" + HStatus + "','" + HBeginDate + "','" + HEndDate + "','" + HSourceID + "','" + user + "'", "h_p_OA_ErrMsgBackSelfQuery_Role");
                    }
                    else
                    {
                        ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery  '" + HStatus + "','" + HBeginDate + "','" + HEndDate + "','" + HSourceID + "','" + user + "'", "h_p_OA_ErrMsgBackSelfQuery");
                    }
                }
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
@@ -8631,8 +8777,18 @@
                string HEndDate = dic["HEndDate"].ToString();//结束日期
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery_APP '" + HBeginDate + "','" + HEndDate + "','" + user + "'", "h_p_OA_ErrMsgBackSelfQuery_APP");
                string sReturn = "";
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    if (oSystemParameter.omodel.OA_ErrMsgBackBill_Role == "Y") //系统参数  根据角色查看对应的单据进行下推
                    {
                        ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery_APP_Role '" + HBeginDate + "','" + HEndDate + "','" + user + "'", "h_p_OA_ErrMsgBackSelfQuery_APP_Role");
                    }
                    else
                    {
                        ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery_APP '" + HBeginDate + "','" + HEndDate + "','" + user + "'", "h_p_OA_ErrMsgBackSelfQuery_APP");
                    }
                }
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
@@ -8679,10 +8835,23 @@
        {
            try
            {
                string sql = "";
                List<object> columnNameList = new List<object>();
                string sql = "select a.HSourceBillNo 流转卡号,a.HSourceBillType 流转卡类型,a.HSourceInterID 流转卡主内码,a.HSourceEntryID 流转卡子内码,b.HNumber 物料代码,b.HName 物料名称,b.HModel 规格型号,a.HDatePlanQty 计划数量,a.HSourceID,c.HName 生产资源 from Sc_ICMOBillStatus_Tmp a " +
                if (!string.IsNullOrEmpty(HSourceBill) && HSourceBill.Substring(0, 6) == "GXCZHB")
                {
                    HSourceBill = HSourceBill.Split('-')[0];
                    //华舟做末件发起安灯的时候 传过来的是出站单的单据号
                    sql = @"select a.HProcExchInterID 流转卡主内码,a.HProcExchEntryID 流转卡子内码,a.HProcExchBillNo 流转卡号,a.HSourceID,b.HName 生产资源, c.HNumber 物料代码, c.HName 物料名称, c.HModel 规格型号, a.HPlanQty 计划数量
                            from Sc_StationOutBillMain a  left  join Gy_Source b on a.HSourceID = b.HItemID  left  join Gy_Material c on a.HMaterID = c.HItemID  where a.HBillNo = '" + HSourceBill + "'";
                }
                else
                {
                    //报工台传过来的是流转卡的
                    sql = "select a.HSourceBillNo 流转卡号,a.HSourceBillType 流转卡类型,a.HSourceInterID 流转卡主内码,a.HSourceEntryID 流转卡子内码,b.HNumber 物料代码,b.HName 物料名称,b.HModel 规格型号,a.HDatePlanQty 计划数量,a.HSourceID,c.HName 生产资源 from Sc_ICMOBillStatus_Tmp a " +
                    "left join Gy_Material b on a.HMaterID=b.HItemID  left join Gy_Source c on a.HSourceID=c.HItemID where HSourceBillNo='" + HSourceBill + "' and a.HICMOStatus=1";
                }
                ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp");
                if (ds.Tables[0].Rows.Count == 0)
                {