| | |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HCzybm); |
| | | if (lngBillKey == 0) |
| | | string lngBillKey = ""; |
| | | lngBillKey = DBUtility.ClsPub.isStrNull(HCzybm); |
| | | if (lngBillKey == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据用户编码查找已分配职员列表 |
| | | [Route("Xt_User/UserEmployeelistPlaylist")] |
| | | [HttpGet] |
| | | public object UserEmployeelistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HEmployeeID HItemID,职员代码 HNumber,职员名称 HName from h_v_Gy_UserEmployeeRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserEmployeeRelationList"); |
| | | 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/SaveUserEmployee")] |
| | | [HttpPost] |
| | | public object SaveUserEmployee([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.Employee> lsmain = new List<Models.Employee>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Employee(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserEmployeeRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Employee oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserEmployeeRelation (HEmployeeID,HUserID) values ('" + oItem.HItemID + "','" + msg3.ToString() + "')"); |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据用户编码查找已分配用户列表 |
| | | [Route("Xt_User/UserPlaylist")] |
| | | [HttpGet] |
| | | public object UserPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HUserID2,用户代码 HUserNumber2,用户名称 HUserName2 from h_v_Gy_UserUserList where HUserID='" + HUserID + "' ", "h_v_Gy_UserUserList"); |
| | | 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/SaveUserUser")] |
| | | [HttpPost] |
| | | public object SaveUserUser([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_UserUser> lsmain = new List<Models.Gy_UserUser>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_UserUser(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserByUserRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Gy_UserUser oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserByUserRelation (HUserID2,HUserID,HBillType,HUseFlag) values ('" + oItem.HUserID2 + "','" + 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 |
| | | |
| | | #region 根据用户编码查找已分配物料列表 |
| | | [Route("Xt_User/MaterPlaylist")] |
| | | [HttpGet] |
| | | public object MaterPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HMaterID,物料代码 HMaterNumber,物料名称 HMaterName from h_v_Gy_UserMaterList where HUserID='" + HUserID + "' ", "h_v_Gy_UserMaterList"); |
| | | 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/SaveUserMater")] |
| | | [HttpPost] |
| | | public object SaveUserMater([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_UserMater> lsmain = new List<Models.Gy_UserMater>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_UserMater(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserMaterRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Gy_UserMater oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserMaterRelation (HMaterID,HUserID) values ('" + oItem.HMaterID + "','" + 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 |
| | | |
| | | #region 根据用户编码查找已分配客户列表 |
| | | [Route("Xt_User/CustomerPlaylist")] |
| | | [HttpGet] |
| | | public object CustomerPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HCusID,客户代码 HCustomerNumber,客户名称 HCustomerName from h_v_Gy_UserCustomerList where HUserID='" + HUserID + "' ", "h_v_Gy_UserCustomerList"); |
| | | 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/SaveUserCustomer")] |
| | | [HttpPost] |
| | | public object SaveUserCustomer([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_UserCustomer> lsmain = new List<Models.Gy_UserCustomer>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_UserCustomer(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserCustomerRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Gy_UserCustomer oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserCustomerRelation (HCusID,HUserID) values ('" + oItem.HCusID + "','" + 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 |
| | | |
| | | } |
| | | } |