1
dytyqx
14 小时以前 19bf4875b4cf6ca5f74c08816773a764008e5ab5
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -13,8 +13,10 @@
using System.Threading.Tasks;
using System.Web.Http;
using WebAPI.Models;
using WebAPI.Service;
using System.Threading;
using SyntacticSugar.constant;
using WebApiWithFleck;
namespace WebAPI.Controllers.SCGL
{
@@ -7407,7 +7409,6 @@
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -7477,6 +7478,69 @@
                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_WorkLinkBillListPage")]
        [HttpGet]
        public object GetOA_WorkLinkBillListPage(string sWhere, string user, int page, int size)
        {
            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 count(1) count from h_v_OA_WorkLinkBillAllList
                    select * from h_v_OA_WorkLinkBillAllList order by 单据号 desc
                    offset {(page - 1) * size} rows fetch next {size} rows only";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList");
                }
                else
                {
                    string sql1 = $@"
                         select count(1) count from h_v_OA_WorkLinkBillAllList where 1 = 1 {sWhere}
                        select * from h_v_OA_WorkLinkBillAllList where 1 = 1
                        {sWhere} order by 单据号 desc
                        offset {(page - 1) * size} rows fetch next {size} rows only";
                    ds = oCN.RunProcReturn(sql1, "h_v_OA_WorkLinkBillAllList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[1].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = int.Parse(ds.Tables[0].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[1];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
@@ -7730,6 +7794,12 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    // 个推方式推送数据
                    GeTuiService.PubishSingle(HInterID);
                    // webSocket方式推送数据
                    // WebSocketServer.PushOne(HInterID);
                }
                if (IsAudit == 1) //反审核提交
                {
@@ -8161,14 +8231,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)
@@ -8608,10 +8693,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)
                {