|  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 报工平台根据责任人筛选加载资源列表 | 
|---|
|  |  |  | [Route("ReportPlatForm/SearchGetLineBindBillList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object SearchGetLineBindBillList(string HUserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //根据选择资源ID获取当前生产工单、责任人 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_JIT_GetSourceInfoByUser " + HUserName + "", "h_p_JIT_GetSourceInfoByUser"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "获取资源绑定数据成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "暂无资源绑定!"; | 
|---|
|  |  |  | objJsonResult.data = ds; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = e.Message.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 报工平台资源保存 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 报工平台资源保存 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("ReportPlatForm/SaveGetLineBindBillList")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveGetLineBindBillList(string HUserName,string HSourceID,string HSourceName,string HManagerID,string HManagerName,string HGroupID,string HGroupName,string HCreateDate,string HRemark) | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object SaveGetLineBindBillList(string HUserName, string HSourceID, string HSourceName, string HManagerID, string HManagerName, string HGroupID, string HGroupName, string HCreateDate, string HRemark) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //写入产线绑定 | 
|---|
|  |  |  | string sql = string.Format(@"insert into Gy_SourceRelationSet (HSourceID,HUserName,HGroupID,HManagerID,HRemark,HCreateDate,HCreator,HNowFlag) | 
|---|
|  |  |  | values('"+HSourceID+"','"+HUserName+"','"+HGroupID+"','"+HManagerID+"','"+HRemark+"','"+DateTime.Parse(HCreateDate).ToShortDateString()+ "','"+HUserName+"','1')"); | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from Gy_SourceRelationSet where HSourceID='" + HSourceID + "' and HUserName='" + HUserName + "'", "Gy_SourceRelationSet"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前人员创建此生产资源,不允许重复创建!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //写入产线绑定 | 
|---|
|  |  |  | string sql = string.Format(@"insert into Gy_SourceRelationSet (HSourceID,HUserName,HGroupID,HManagerID,HRemark,HCreateDate,HCreator,HNowFlag,HCheckManID) | 
|---|
|  |  |  | values('" + HSourceID + "','" + HUserName + "','" + HGroupID + "','" + HManagerID + "','" + HRemark + "','" + DateTime.Parse(HCreateDate).ToShortDateString() + "','" + HUserName + "','0','')"); | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region  报工平台根据选中的资源ID带出工单列表信息,当前状态信息 | 
|---|
|  |  |  | [Route("ReportPlatForm/SearchGetWorkBillList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object SearchGetWorkBillList(string HSourceID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //更新切换状态值 | 
|---|
|  |  |  | string sql = string.Format(@"update Gy_SourceRelationSet set HNowFlag='1' where HSourceID='" + HSourceID + "'"); | 
|---|
|  |  |  | string sql1 = string.Format(@"update Gy_SourceRelationSet set HNowFlag='0' where HSourceID<>'" + HSourceID + "'"); | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  | oCN.RunProc(sql1); | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //根据选择资源ID获取当前生产工单、责任人 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_JIT_GetWorkBillListInfoBySource " + HSourceID + "", "h_p_JIT_GetWorkBillListInfoBySource"); | 
|---|
|  |  |  | if (ds.Tables.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "获取信息成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "此资源暂无工单列表数据!"; | 
|---|
|  |  |  | objJsonResult.data = ds; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = e.Message.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 报工平台删除资源列表 | 
|---|
|  |  |  | [Route("ReportPlatForm/DeleteGetLineBindBillList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeleteGetLineBindBillList(string HSourceID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //更新切换状态值 | 
|---|
|  |  |  | string sql = string.Format(@"delete Gy_SourceRelationSet  where HSourceID='" + HSourceID + "'"); | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "删除资源成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = e.Message.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|