| | |
| | | string sql4 = @"select A.wo_code,A.eqp_code,A.Time_Start,A.time_end, |
| | | (case B.Status when 'SCHED' then '已排程' when 'ALLOC' then '已派发' when 'START' then '已开工' end ) status |
| | | from TK_Wrk_EqpAps A |
| | | left join mes_tk_wrk_man B on A.wo_code=B.Wo_Code |
| | | left join gn_eqp_eqpinfo C on A.eqp_code=C.code |
| | | where TO_char(time_start,'YYYY-MM-DD')='" + list4[m].name + "' and A.eqp_code='" + dt3.Rows[n]["CODE"] + "' and B.isaps='Y' and B.status IN('SCHED','ALLOC','START')"; |
| | | DataTable dt4 = DBHelper.GetTable(sql4); |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TEqpInfo C on A.eqp_code=C.code |
| | | where CONVERT(varchar(100), time_start, 23)=@time_start and A.eqp_code=@eqp_code and B.isaps='Y' and B.status IN('SCHED','ALLOC','START')"; |
| | | dynamicParams.Add("@time_start", list4[m].name); |
| | | dynamicParams.Add("@eqp_code", dt3.Rows[n]["CODE"]); |
| | | var dt4 = DapperHelper.selectdata(sql4, dynamicParams); |
| | | if (dt4.Rows.Count > 0) |
| | | { |
| | | for (int g = 0; g < dt4.Rows.Count; g++) |
| | | { |
| | | json = new DWZJson() |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "修改失败!,日期:" + dt4.Rows[g]["TIME_START"] + "有【" + dt4.Rows[g]["STATUS"] + "】工单:" + dt4.Rows[g]["WO_CODE"] + ""; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //更新排产生产资源主表 |
| | | sql = @"update gn_wkm_capac_plan set wkshift_code=@wkshift_code,classtype=@classtype,lm_user=@lm_user,lm_time=@lm_time where id=@id"; |
| | | list.Add(new |
| | | { |
| | | statusCode = "300", |
| | | message = "修改失败!,日期:" + dt4.Rows[g]["TIME_START"] + "有【" + dt4.Rows[g]["STATUS"] + "】工单:" + dt4.Rows[g]["WO_CODE"] + "", |
| | | }; |
| | | return json; |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | id=captplanid, |
| | | wkshift_code = capsetupcode, |
| | | classtype = captplantype, |
| | | lm_user =username, |
| | | lm_time= DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | //删除排产生产资源子表 |
| | | sql = @"delete TWkm_capac_plan_sub where m_id=@id"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | id = captplanid |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | list.Add(@"update gn_wkm_capac_plan set wkshift_code='" + CapSetupCode + "',classtype='" + CaptPlanType + "', enable='Y',lm_user='" + lm_user + "',lm_time=sysdate where id='" + CaptPlanId + "'"); |
| | | list.Add(@"delete gn_wkm_capac_plan_sub where m_id='" + CaptPlanId + "'"); |
| | | }); |
| | | //循环写入排产生产资源子表 |
| | | for (int i = 0; i < objs.Count; i++) |
| | | { |
| | | list.Add(@"insert into gn_wkm_capac_plan_sub(m_id, id, wkdate,wkshift_code) |
| | | values('" + CaptPlanId + "',gn_wkm_capac_plan_sub_S.nextVal,to_date('" + objs[i].name + "','yyyy-MM-dd'),'" + objs[i].key + "')"); |
| | | sql = @"insert into TWkm_capac_plan_sub(m_id,wkdate,wkshift_code) values()"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | m_id = captplanid, |
| | | wkdate = objs[i].name, |
| | | wkshift_code= objs[i].key |
| | | } |
| | | int count = DBHelper.Executesqltran(list, pt.ToArray()); |
| | | if (count > 0) |
| | | }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | json = new DWZJson() |
| | | { |
| | | statusCode = "200", |
| | | message = "修改成功!", |
| | | }; |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | json = new DWZJson() |
| | | { |
| | | statusCode = "300", |
| | | message = "修改失败!", |
| | | }; |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | json = new DWZJson() |
| | | { |
| | | statusCode = "300", |
| | | message = e.Message, |
| | | }; |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |