| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES工单批量查找历史引用最新工序信息] |
| | | public static ToMessage MesOrderNewStepListContent(List<BatchProcess> list, User us) |
| | | { |
| | | var sql = ""; |
| | | List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | dynamic dynObj = JObject.Parse(us.mesSetting); |
| | | bool route = dynObj.route; |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | if (route) //工艺路线版 |
| | | { |
| | | Dictionary<object, object> dict = new Dictionary<object, object>(); |
| | | //MES工单查找历史引用最新工序信息 |
| | | sql = @"select S.wo_code,S.seq,S.step_code as stepcode,T.stepname as stepname,S.stepprice,S.isbott,S.isend,S.ratio |
| | | from TK_Wrk_Step S |
| | | inner join ( |
| | | select top 1 A.wo_code,A.route_code from TK_Wrk_Man A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.route_code=S.route_code |
| | | where A.materiel_code=@partcode and A.wkshp_code=@wkshopcode and A.route_code=@routecode |
| | | order by A.lm_date desc |
| | | ) as W on S.wo_code=W.wo_code and S.route_code=W.route_code |
| | | left join TStep T on S.step_code=T.stepcode |
| | | order by S.seq"; |
| | | dynamicParams.Add("@wkshopcode", list[i].wkshopcode); |
| | | dynamicParams.Add("@partcode", list[i].partcode); |
| | | dynamicParams.Add("@routecode", list[i].routecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | // 向字典中添加数据 |
| | | dict.Add("partcode", list[i].partcode); |
| | | dict.Add("stepdata", data); |
| | | // 将字典添加到列表中 |
| | | dir.Add(dict); |
| | | } |
| | | else |
| | | { |
| | | Dictionary<object, object> dict = new Dictionary<object, object>(); |
| | | //MES工单查找历史引用最新工序信息 |
| | | sql = @"select S.wo_code,S.seq,S.step_code as stepcode,T.stepname as stepname,S.stepprice,S.isbott,S.isend,S.ratio |
| | | from TK_Wrk_Step S |
| | | inner join ( |
| | | select top 1 A.wo_code from TK_Wrk_Man A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code |
| | | where A.materiel_code=@partcode and A.wkshp_code=@wkshopcode |
| | | order by A.lm_date desc |
| | | ) as W on S.wo_code=W.wo_code |
| | | left join TStep T on S.step_code=T.stepcode |
| | | order by S.seq"; |
| | | dynamicParams.Add("@wkshopcode", list[i].wkshopcode); |
| | | dynamicParams.Add("@partcode", list[i].partcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | // 向字典中添加数据 |
| | | dict.Add("partcode", list[i].partcode); |
| | | dict.Add("stepdata", data); |
| | | // 将字典添加到列表中 |
| | | dir.Add(dict); |
| | | } |
| | | } |
| | | mes.code = "200"; |
| | | mes.count = dir.Count; |
| | | mes.data = dir; |
| | | mes.message = "查询成功!"; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES工单查看工单SOP] |
| | | public static ToMessage MesOrderSopSearch(string wocode, string materielcode) |
| | | { |