| | |
| | | { |
| | | public partial class WMS_U9C |
| | | { |
| | | public static string TransferInSubmitUrl |
| | | { get; set; } = "http://172.16.80.20/u9c/webapi/TransferIn/Submit"; // ApiConfig.IsTestServer ? Cache.SysParam["TransferInSubmitUrl_Test", "U9CUrl"].PARAM_VALUE : Cache.SysParam["TransferInSubmitUrl", "U9CUrl"].PARAM_VALUE; //http://172.16.80.20/u9c/webapi/TransferIn/Submit |
| | | public static string TransferInApproveUrl |
| | | { get; set; } = "http://172.16.80.20/u9c/webapi/TransferIn/Approve"; // ApiConfig.IsTestServer ? Cache.SysParam["TransferInApproveUrl_Test", "U9CUrl"].PARAM_VALUE : Cache.SysParam["TransferInApproveUrl", "U9CUrl"].PARAM_VALUE; //http://172.16.80.20/u9c/webapi/TransferIn/Approve |
| | | |
| | | /// <summary> |
| | | /// 创建生产退料单-按行退料接口 |
| | | /// 创建调入单接口 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<List<U9CReturnData>>> CreateTransferIn(CreateTransferInInput input) { |
| | | Logger.Interface.Info($"/**\r\n *进入创建生产退料单-按行退料接口....\r\n */\r\n"); //固定写法 |
| | | Logger.Interface.Info($"/**\r\n *进入创建调入单接口....\r\n */\r\n"); //固定写法 |
| | | var action = new ApiAction<List<U9CReturnData>>(); |
| | | try |
| | | { |
| | |
| | | if (result.Success && result.Data[0].m_isSucess) |
| | | { |
| | | action.Data = result.Data; |
| | | Logger.Interface.Info($"创建生产退料单-按行退料接口提交Json: {JsonConvert.SerializeObject(input.CreateTransferInParam)},返回Json: {response.Message}"); |
| | | Logger.Interface.Info($"创建调入单接口提交Json: {JsonConvert.SerializeObject(input.CreateTransferInParam)},返回Json: {response.Message}"); |
| | | } |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"{action.Message}; {result.Data[0].m_errorMsg}"); |
| | | Logger.Interface.Info($"创建生产退料单-按行退料接口失败:{result.Data[0].m_errorMsg}"); |
| | | Logger.Interface.Info($"创建调入单接口失败:{result.Data[0].m_errorMsg}"); |
| | | } |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, "创建生产退料单-按行退料异常"); |
| | | action.CatchExceptionWithLog(ex, "创建调入单异常"); |
| | | } |
| | | Logger.Interface.Info($"/* 创建生产退料单-按行退料接口结束 */\r\n"); //固定写法 |
| | | Logger.Interface.Info($"/* 创建调入单接口结束 */\r\n"); //固定写法 |
| | | return action; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 调入单审核总入口接口 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<List<U9CReturnData2>>> TransferInApprove(TransferInSubmitInput input) |
| | | { |
| | | Logger.Interface.Info($"/**\r\n *进入调入单审核总入口接口....\r\n */\r\n"); //固定写法 |
| | | var action = new ApiAction<List<U9CReturnData2>>(); |
| | | try |
| | | { |
| | | //action = await Submit(input); |
| | | //if (action.IsSuccessed) |
| | | //{ |
| | | // input.IsLogin = false; |
| | | // action = await Approve(input); |
| | | //} |
| | | |
| | | action = await Approve(input); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, "调入单审核异常"); |
| | | } |
| | | Logger.Interface.Info($"/* 调入单审核总入口接口结束 */\r\n"); //固定写法 |
| | | return action; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调入单提交 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | private async Task<ApiAction<List<U9CReturnData2>>> Submit(TransferInSubmitInput input) |
| | | { |
| | | Logger.Interface.Info($"/**\r\n *进入调入单提交接口....\r\n */\r\n"); //固定写法 |
| | | var action = new ApiAction<List<U9CReturnData2>>(); |
| | | try |
| | | { |
| | | //如果已经登录则不需要再次登录,直接使用传入的token |
| | | if (input.IsLogin) |
| | | { |
| | | var u9CLoginResult = await HttpHelper.GetAsync<U9CLoginResult>($"{U9CAuthLoginUrl}userCode={input.userId}{secret}"); |
| | | if (u9CLoginResult.Success) |
| | | { |
| | | input.token = u9CLoginResult.Data; |
| | | Logger.Interface.Info($"U9C登录token: {input.token}"); |
| | | } |
| | | } |
| | | var response = await HttpHelper.PostAsync(TransferInSubmitUrl, JsonConvert.SerializeObject(input.TransferInSubmitParam), new Dictionary<string, string>() { { "token", input.token } }); |
| | | var result = JsonConvert.DeserializeObject<U9CResult2>(response.Message); |
| | | if (result != null) |
| | | { |
| | | if (result.Success && result.Data[0].IsSucess) |
| | | { |
| | | action.Data = result.Data; |
| | | Logger.Interface.Info($"调入单提交接口提交Json: {JsonConvert.SerializeObject(input.TransferInSubmitParam)},返回Json: {response.Message}"); |
| | | } |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"{action.Message}; {result.Data[0].ErrorMsg}"); |
| | | Logger.Interface.Info($"调入单提交接口失败:{result.Data[0].ErrorMsg}"); |
| | | } |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, "调入单提交异常"); |
| | | } |
| | | Logger.Interface.Info($"/* 调入单提交接口结束 */\r\n"); //固定写法 |
| | | return action; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调入单审核 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | private async Task<ApiAction<List<U9CReturnData2>>> Approve(TransferInSubmitInput input) |
| | | { |
| | | Logger.Interface.Info($"/**\r\n *进入调入单审核接口....\r\n */\r\n"); //固定写法 |
| | | var action = new ApiAction<List<U9CReturnData2>>(); |
| | | try |
| | | { |
| | | //如果已经登录则不需要再次登录,直接使用传入的token |
| | | if (input.IsLogin) |
| | | { |
| | | var u9CLoginResult = await HttpHelper.GetAsync<U9CLoginResult>($"{U9CAuthLoginUrl}userCode={input.userId}{secret}"); |
| | | if (u9CLoginResult.Success) |
| | | { |
| | | input.token = u9CLoginResult.Data; |
| | | Logger.Interface.Info($"U9C登录token: {input.token}"); |
| | | } |
| | | } |
| | | var response = await HttpHelper.PostAsync(TransferInApproveUrl, JsonConvert.SerializeObject(input.TransferInSubmitParam), new Dictionary<string, string>() { { "token", input.token } }); |
| | | var result = JsonConvert.DeserializeObject<U9CResult2>(response.Message); |
| | | if (result != null) |
| | | { |
| | | if (result.Success && result.Data[0].IsSucess) |
| | | { |
| | | action.Data = result.Data; |
| | | Logger.Interface.Info($"调入单审核接口提交Json: {JsonConvert.SerializeObject(input.TransferInSubmitParam)},返回Json: {response.Message}"); |
| | | } |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"{action.Message}; {result.Data[0].ErrorMsg}"); |
| | | Logger.Interface.Info($"调入单审核接口失败:{result.Data[0].ErrorMsg}"); |
| | | } |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, "调入单审核异常"); |
| | | } |
| | | Logger.Interface.Info($"/* 调入单审核接口结束 */\r\n"); //固定写法 |
| | | return action; |
| | | } |
| | | } |