| | |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model) |
| | | { |
| | | string guid = model.guid.ToString(); |
| | | string guid = model.guid.ToString();// --这是产品的guid |
| | | dynamic m = new ExpandoObject(); |
| | | m.list = new List<dynamic>(); |
| | | SqlParameter[] parameters = |
| | |
| | | var dset = new DataSet(); |
| | | try |
| | | { |
| | | //dset = DbHelperSQL.RunProcedure("[work_technique_mx]", parameters, "0"); |
| | | dset = DbHelperSQL.RunProcedure("[mes_prod_gx_mx]", parameters, "0"); |
| | | dset = DbHelperSQL.RunProcedure("[work_technique_mx]", parameters, "0"); |
| | | if (dset != null && dset.Tables.Count > 0 && |
| | | dset.Tables[0].Rows.Count > 0) |
| | | { |
| | |
| | | m = dr.RowToDynamic(); |
| | | var _tb = dset.Tables[1].TableToDynamicList(); |
| | | m.list = _tb; |
| | | var _tb2 = dset.Tables[2].TableToDynamicList(); |
| | | m.list2 = _tb2; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | public ReturnDto<ExpandoObject> EditModel([FromBody] dynamic model) |
| | | { |
| | | Guid? guid = model.guid; //产品主键 |
| | | string orgName = model.orgName; |
| | | string itemNo = model.itemNo; |
| | | string fType = model.fType; |
| | | string fBegDate = model.fBegDate; |
| | | string fEndDate = model.fEndDate; |
| | | string fJingDu = model.fJingDu; |
| | | string fCapacity = model.fCapacity; |
| | | string fMaxWeight = model.fMaxWeight; |
| | | string fMinWeight = model.fMinWeight; |
| | | string fSumPeople = model.fSumPeople; |
| | | string remark = model.remark; |
| | | var _sb = new StringBuilder(); |
| | | var _split = "|"; |
| | | foreach (var m in model.list) |
| | | { |
| | | var _line = m.guid + _split |
| | | var _line = m.fSeq + _split |
| | | + m.processNo + _split |
| | | + m.gxOrder + _split |
| | | + m.signingFlag + _split |
| | | + m.storageFlag + _split |
| | | + m.statStatus + _split |
| | | + m.collectionName + _split |
| | | + m.remark + _split |
| | | + m.frontProcessNo; |
| | | if (_sb.Length > 0) |
| | | _sb.Append("~"); |
| | | _sb.Append(_line); |
| | | } |
| | | var _sb2 = new StringBuilder(); |
| | | var _split2 = "|"; |
| | | foreach (var m in model.list2) |
| | | { |
| | | var _line2 = m.guid + _split2 |
| | | + m.workers + _split2 |
| | | + m.hours + _split2 |
| | | + m.capacity + _split2 |
| | | + m.sCapacity + _split2 |
| | | + m.lineType + _split2 |
| | | + m.changeTime; |
| | | if (_sb2.Length > 0) |
| | | _sb2.Append("~"); |
| | | _sb2.Append(_line2); |
| | | } |
| | | dynamic mObj = new ExpandoObject(); |
| | | mObj.outMsg = ""; |
| | |
| | | mObj.outNo = ""; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | //using (var cmd = new SqlCommand("[work_technique_edt]", conn)) |
| | | using (var cmd = new SqlCommand("[mes_prod_gx_edt]", conn)) |
| | | using (var cmd = new SqlCommand("[work_technique_edt]", conn)) |
| | | { |
| | | try |
| | | { |
| | |
| | | new("@outGuid", SqlDbType.UniqueIdentifier), |
| | | new("@outNo", SqlDbType.NVarChar, 300), |
| | | new("@inOrderGuid", CheckGuid(guid) ? guid : DBNull.Value), |
| | | new("@orgName", orgName), |
| | | new("@itemNo", itemNo), |
| | | new("@fType", fType), |
| | | new("@fBegDate", fBegDate), |
| | | new("@fEndDate", fEndDate), |
| | | new("@fJingDu", fJingDu), |
| | | new("@fCapacity", fCapacity), |
| | | new("@fMaxWeight", fMaxWeight), |
| | | new("@fMinWeight", fMinWeight), |
| | | new("@fSumPeople", fSumPeople), |
| | | new("@remark", remark), |
| | | new("@inEdtUserGuid", _userGuid), |
| | | new("@inLineList", _sb.ToString()), |
| | | new("@inLineList2", _sb2.ToString()) |
| | | new("@inLineList", _sb.ToString()) |
| | | }; |
| | | parameters[0].Direction = ParameterDirection.Output; |
| | | parameters[1].Direction = ParameterDirection.Output; |
| | |
| | | var _outSum = -1; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | //using (var cmd = new SqlCommand("[work_technique_del]", conn)) |
| | | using (var cmd = new SqlCommand("[mes_prod_gx_del]", conn)) |
| | | using (var cmd = new SqlCommand("[work_technique_del]", conn)) |
| | | { |
| | | try |
| | | { |
| | |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除主表或产能明细 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<int?> DeleteMode2OrMx([FromBody] dynamic model) |
| | | { |
| | | int? rtnInt = (int)ReturnCode.Default; |
| | | Guid? guid = model.guid; |
| | | string mxGuid2 = model.mxGuid2; |
| | | var _outMsg = ""; |
| | | var _outSum = -1; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | //using (var cmd = new SqlCommand("[work_technique_del]", conn)) |
| | | using (var cmd = new SqlCommand("[mes_prod_gx_del2]", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@outMsg", SqlDbType.NVarChar, 300), |
| | | new("@outSum", SqlDbType.Int), |
| | | new("@inOrderGuid", |
| | | CheckGuid(guid) |
| | | ? guid |
| | | : DBNull.Value), |
| | | new("@inEdtUserGuid", _userGuid), |
| | | new("@inMxGuid", mxGuid2) |
| | | }; |
| | | parameters[0].Direction = ParameterDirection.Output; |
| | | parameters[1].Direction = ParameterDirection.Output; |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | _outMsg = parameters[0].Value.ToString(); |
| | | _outSum = int.Parse(parameters[1].Value.ToString()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), |
| | | "work_technique error:" + ex.Message); |
| | | _outMsg = ex.Message; |
| | | _outSum = -1; |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (_outSum <= 0) |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, |
| | | _outMsg); |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 复制物料项目 |