| | |
| | | public static ToMessage AddUpdateStep(string stepid, string stepcode, string stepname, string steptypecode, string enable, string description, string username, string operType) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | List<object> list = new List<object>(); |
| | | var sql_1 = ""; |
| | | try |
| | | { |
| | | if (operType == "Add") |
| | |
| | | } |
| | | if (operType == "Update") |
| | | { |
| | | list.Clear(); |
| | | //如果当前工序使用状态位N(未启用),需判断当前工序对应工艺路线被引用的工单是否关闭 |
| | | if (enable == "N") |
| | | { |
| | |
| | | return mes; |
| | | } |
| | | } |
| | | //当前工序类型与关联工作站中的类型是否匹配,不匹配则清除关联工作站数据,同时清理工序标(关联工作站标识字段为N) |
| | | var sql_10 = @"select * from TFlw_Rteqp where step_code=@stepcode"; |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | var data_10 = DapperHelper.selectdata(sql_10, dynamicParams); |
| | | if (data_10.Rows.Count > 0) |
| | | { |
| | | if (data_10.Rows[0]["STYLE"].ToString() != "steptypecode") |
| | | { |
| | | //删除工序关联工作站表 |
| | | sql_1 = @"delete TFlw_Rteqp where step_code=@stepcode"; |
| | | list.Add(new { str = sql_1, parm = new { stepcode = stepcode } }); |
| | | //修改工序表关联工作站标识 |
| | | sql_1 = @"update TStep set is_eqp='N' where stepcode=@stepcode"; |
| | | list.Add(new { str = sql_1, parm = new { stepcode = stepcode } }); |
| | | } |
| | | } |
| | | |
| | | var sql = @"update TStep set stepname=@stepname,flwtype=@steptypecode,enable=@enable,descr=@description, |
| | | |
| | | sql_1 = @"update TStep set stepname=@stepname,flwtype=@steptypecode,enable=@enable,descr=@description, |
| | | lm_user=@username,lm_date=@CreateDate where id=@stepid"; |
| | | dynamicParams.Add("@stepid", stepid); |
| | | dynamicParams.Add("@stepname", stepname); |
| | | dynamicParams.Add("@steptypecode", steptypecode); |
| | | dynamicParams.Add("@enable", enable); |
| | | dynamicParams.Add("@description", description); |
| | | dynamicParams.Add("@username", username); |
| | | dynamicParams.Add("@CreateDate", DateTime.Now.ToString()); |
| | | int cont = DapperHelper.SQL(sql, dynamicParams); |
| | | if (cont > 0) |
| | | list.Add(new { str = sql_1, parm = new { stepid = stepid, stepname= stepname, steptypecode = steptypecode, enable= enable, description = description, username= username, CreateDate= DateTime.Now.ToString() } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |