1
zrg
2026-04-20 b08054592e47cb9e47cf34acb6965a08745e13ce
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -1007,6 +1007,33 @@
        }
        #endregion
        #region 异常反馈根据设备ID获取数据
        [Route("Sc_MESTransFerWorkBill/Get_TransFerBillListByHEquipID")]
        [HttpGet]
        public ApiResult<DataSet> Get_TransFerBillListByHEquipID(string HEquipID, string sWhere)
        {
            if (string.IsNullOrEmpty(HEquipID))
                return new ApiResult<DataSet> { code = -1, msg = "设备不能为空" };
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            string sql = string.Format($@"
                select c.HNumber 警报代码,CONVERT(VARCHAR(255), ABS(DATEDIFF(HOUR, a.HMakeDate, a.HUpdateDate))) + '小时' 持续时间,a.HErrLev 原因, a.HDate 时间 from h_v_OA_ErrMsgBackBillEdit a
                left join Gy_EquipFileBillMain b on a.HSourceID = b.HSourceID
                left join Gy_ErrMsgBackType c on c.HItemID = a.HErrMsgBackTypeID
                where b.HInterID = {HEquipID}
            ");
            if (!string.IsNullOrEmpty(sWhere))
            {
                sql += sWhere;
            }
            var dataSet = oCN.RunProcReturn(sql, "OA_ErrMsgBackBillMain");
            if (dataSet == null)
                return new ApiResult<DataSet> { code = -1, msg = "当前设备对应的警报记录不存在" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
        #endregion
        #region 异常反馈列表编辑获取数据
        [Route("Sc_MESTransFerWorkBill/Get_TransFerBillListCheckDetai")]
        [HttpGet]
@@ -8712,7 +8739,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)
                {
@@ -8766,8 +8804,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)
                {
@@ -8821,14 +8869,14 @@
                {
                    HSourceBill = HSourceBill.Split('-')[0];
                    //华舟做末件发起安灯的时候 传过来的是出站单的单据号
                    sql = @"select a.HProcExchInterID 流转卡主内码,a.HProcExchEntryID 流转卡子内码,a.HProcExchBillNo 流转卡号,a.HSourceID,b.HName 生产资源, c.HNumber 物料代码, c.HName 物料名称, c.HModel 规格型号, a.HPlanQty 计划数量
                    sql = @"SELECT ISNULL(a.HProcExchInterID,0) 流转卡主内码,ISNULL(a.HProcExchEntryID,0) 流转卡子内码,ISNULL(a.HProcExchBillNo,'') 流转卡号,ISNULL(a.HSourceID,0) HSourceID,ISNULL(b.HName,'') 生产资源,ISNULL(c.HNumber,'') 物料代码,ISNULL(c.HName,'') 物料名称,ISNULL(c.HModel,'') 规格型号,ISNULL(a.HPlanQty,0) 计划数量,ISNULL(a.HICMOInterID,0) HICMOInterID,ISNULL(a.HICMOEntryID,0) HICMOEntryID,ISNULL(a.HICMOBillNo,'') HICMOBillNo
                            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";
                    sql = @"SELECT ISNULL(a.HSourceBillNo,'') 流转卡号,ISNULL(a.HSourceBillType,'') 流转卡类型,ISNULL(a.HSourceInterID,0) 流转卡主内码,ISNULL(a.HSourceEntryID,0) 流转卡子内码,ISNULL(b.HNumber,'') 物料代码,ISNULL(b.HName,'') 物料名称,ISNULL(b.HModel,'') 规格型号,ISNULL(a.HDatePlanQty,0) 计划数量,ISNULL(a.HSourceID,0) HSourceID,ISNULL(c.HName,'') 生产资源,ISNULL(a.HICMOInterID,0) HICMOInterID,ISNULL(a.HICMOEntryID,0) HICMOEntryID,ISNULL(a.HICMOBillNo,'') HICMOBillNo
                           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");