| | |
| | | using VueWebCoreApi.DLL.BLL; |
| | | using VueWebCoreApi.Models; |
| | | using VueWebCoreApi.Models.RolePermission; |
| | | using VueWebCoreApi.Models.WorkData; |
| | | using VueWebCoreApi.Tools; |
| | | using static VueWebCoreApi.Models.RolePermission.RolePermission; |
| | | using static VueWebCoreApi.Models.RolePermission.RolePermissionSava; |
| | |
| | | select torg_code, torg_name, parent_id |
| | | from TOrganization |
| | | where status='Y' " + search0 + " union all select T.torg_code, T.torg_name, T.parent_id from TOrganization T inner join CTE ON T.parent_id = CTE.torg_code)"; |
| | | var sql = @"SELECT distinct U.usercode,U.username,U.password,U.mobile,U.email,U.status,U.storg_code as storg_code,T.torg_name as storg_name,T.parent_id, |
| | | var sql = @"SELECT distinct U.usercode,U.username,U.password,U.payrate,U.mobile,U.email,U.status,U.storg_code as storg_code,T.torg_name as storg_name,T.parent_id, |
| | | U.role_code, |
| | | STUFF((SELECT ',' + R.rolename |
| | | FROM TRole R |
| | |
| | | #endregion |
| | | |
| | | #region[用户信息新增编辑] |
| | | public static ToMessage AddUpdateUserSave(string usercode, string username, string password, string mobile, string email, string storg_code, string status, string post_code, string role_code, string group_code, string opertype, User us) |
| | | public static ToMessage AddUpdateUserSave(string usercode, string username, string password,string payrate, string mobile, string email, string storg_code, string status, string post_code, string role_code, string group_code, string opertype, User us) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | sql = @"insert into TUser(usercode,username,password,mobile,email,status,storg_code,role_code,role_datapermissions,post_code,group_code,is_system_admin,lm_user,lm_date) |
| | | values(@usercode,@username,@password,@mobile,@email,@status,@storg_code,@role_code,@role_datapermissions,@post_code,@group_code,@is_system_admin,@lm_user,@lm_date)"; |
| | | sql = @"insert into TUser(usercode,username,password,payrate,mobile,email,status,storg_code,role_code,role_datapermissions,post_code,group_code,is_system_admin,lm_user,lm_date) |
| | | values(@usercode,@username,@password,@payrate,@mobile,@email,@status,@storg_code,@role_code,@role_datapermissions,@post_code,@group_code,@is_system_admin,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | usercode = usercode, |
| | | username = username, |
| | | password = password, |
| | | payrate= payrate, |
| | | mobile = mobile, |
| | | email = email, |
| | | status = status, |
| | |
| | | if (opertype == "Update") |
| | | { |
| | | |
| | | sql = @"update TUser set username=@username,password=@password,mobile=@mobile,email=@email,status=@status,storg_code=@storg_code, |
| | | sql = @"update TUser set username=@username,password=@password,payrate=@payrate,mobile=@mobile,email=@email,status=@status,storg_code=@storg_code, |
| | | role_code=@role_code,role_datapermissions=@role_datapermissions,post_code=@post_code,group_code=@group_code,lm_user=@lm_user,lm_date=@lm_date |
| | | where usercode=@usercode"; |
| | | list.Add(new |
| | |
| | | usercode = usercode, |
| | | username = username, |
| | | password = password, |
| | | payrate= payrate, |
| | | mobile = mobile, |
| | | email = email, |
| | | status = status, |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[产品编码批量查找关联的工艺信息] |
| | | public static ToMessage PartSelectRputeList(List<PartRouteList> list, User us) |
| | | { |
| | | string sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>(); |
| | | try |
| | | { |
| | | dynamic dynObj = JObject.Parse(us.mesSetting); |
| | | bool route = dynObj.route; |
| | | if (route) //工艺路线版 |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | // 创建一个新的字典 |
| | | Dictionary<object, object> dict = new Dictionary<object, object>(); |
| | | //通过产品编码查找关联的工艺路线信息 |
| | | sql = @"select A.route_code,B.name as route_name |
| | | from TMateriel_Route A |
| | | inner join TFlw_Rout B on A.route_code=B.code |
| | | where A.materiel_code=@partcode and B.is_delete<>'1' and A.is_delete<>'1'"; |
| | | dynamicParams.Add("@partcode", list[i].partcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | // 向字典中添加数据 |
| | | dict.Add("routedata", data); |
| | | // 将字典添加到列表中 |
| | | dir.Add(dict); |
| | | } |
| | | } |
| | | else //工序版 |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | // 创建一个新的字典 |
| | | Dictionary<object, object> dict = new Dictionary<object, object>(); |
| | | //通过产品编码查找关联的工序信息 |
| | | sql = @"select A.step_seq,A.step_code as stepcode,S.stepname as stepname,A.unprice as stepprice,A.isbott,A.isend |
| | | from ( |
| | | select S.materiel_code,R.step_seq,S.step_code,S.unprice,R.isbott,R.isend from TPrteEqp_Stad S |
| | | inner join TMateriel_Step R on S.materiel_code=R.materiel_code and S.step_code=R.step_code |
| | | where S.materiel_code=@partcode |
| | | union all |
| | | select materiel_code,step_seq,step_code,'0' as unprice,isbott,isend from TMateriel_Step |
| | | where materiel_code=@partcode and materiel_code+step_code |
| | | not in(select materiel_code+step_code from TPrteEqp_Stad |
| | | where materiel_code=@partcode) |
| | | ) as A |
| | | left join TStep S on A.step_code=S.stepcode"; |
| | | dynamicParams.Add("@partcode", list[i].partcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | // 向字典中添加数据 |
| | | dict.Add("stepdata", data); |
| | | // 将字典添加到列表中 |
| | | dir.Add(dict); |
| | | } |
| | | } |
| | | |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = dir.Count; |
| | | mes.data = dir; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[根据工艺信息(工艺路线编码)批量查找关联工序集合] |
| | | public static ToMessage RouteSelectStepList(List<PartRouteStepList> list) |
| | | { |
| | | string sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>(); |
| | | try |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | // 创建一个新的字典 |
| | | Dictionary<object, object> dict = new Dictionary<object, object>(); |
| | | //通过工艺路线编码查找关联的工序信息 |
| | | sql = @"select A.step_seq,A.step_code as stepcode,S.stepname as stepname,A.unprice as stepprice,A.isbott,A.isend |
| | | from ( |
| | | select S.materiel_code,R.seq as step_seq,S.step_code,S.unprice,R.first_choke as isbott,R.last_choke as isend from TPrteEqp_Stad S |
| | | inner join TFlw_Rtdt R on S.route_code=R.rout_code and S.step_code=R.step_code |
| | | where S.materiel_code=@partcode and S.route_code=@route_code |
| | | union all |
| | | select @partcode as materiel_code,B.seq as step_seq,B.step_code,'0' as unprice,B.first_choke as isbott,B.last_choke as isend from TFlw_Rout A |
| | | inner join TFlw_Rtdt B on A.code=B.rout_code |
| | | where A.code=@route_code and @partcode+A.code+B.step_code |
| | | not in(select materiel_code+rout_code+step_code from TPrteEqp_Stad |
| | | where materiel_code=@partcode and route_code=@route_code) |
| | | ) as A |
| | | left join TStep S on A.step_code=S.stepcode"; |
| | | dynamicParams.Add("@partcode", list[i].partcode); |
| | | dynamicParams.Add("@route_code", list[i].routecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | // 向字典中添加数据 |
| | | dict.Add("stepdata", data); |
| | | // 将字典添加到列表中 |
| | | dir.Add(dict); |
| | | } |
| | | |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = dir; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[节拍工价查询] |
| | | public static ToMessage BeatRateSearch(string partcode, string routecode, string stepcode, User us, int startNum, int endNum, string prop, string order) |
| | | { |