| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据用户编码查找已分配工序列表 |
| | | [Route("Xt_User/ProcessPlaylist")] |
| | | [HttpGet] |
| | | public object ProcessPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HProcID,工序代码 HProcNumber,工序名称 HProcName from h_v_Gy_UserProcessList where HUserID='" + HUserID + "' ", "h_v_Gy_UserProcessList"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无工序信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 用户关联工序保存 |
| | | [Route("Xt_User/SaveUserProcess")] |
| | | [HttpPost] |
| | | public object SaveUserProcess([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | List<Models.Gy_UserProcess> lsmain = new List<Models.Gy_UserProcess>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_UserProcess(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserByProcess where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Gy_UserProcess oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserByProcess (HProcID,HUserID) values ('" + oItem.HProcID + "','" + msg3.ToString() + "')"); |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |