| | |
| | | { |
| | | public partial class MES_U9C : IMES_U9C |
| | | { |
| | | public static string U9CAuthLoginUrl { get; set; } = Cache.SysParam["U9CAuthLoginUrl_Test", "U9CUrl"].PARAM_VALUE; // "http://172.16.80.20/U9C/webapi/OAuth2/AuthLogin?"; 测试 |
| | | public static string U9CAuthLoginUrl { get; set; } = ApiConfig.IsTestServer ? Cache.SysParam["U9CAuthLoginUrl_Test", "U9CUrl"].PARAM_VALUE : Cache.SysParam["U9CAuthLoginUrl", "U9CUrl"].PARAM_VALUE; // "http://172.16.80.20/U9C/webapi/OAuth2/AuthLogin?"; 测试 |
| | | //public static string U9CAuthLoginUrl { get; set; } = Cache.SysParam["U9CAuthLoginUrl", "U9CUrl"].PARAM_VALUE; //正式 |
| | | public static string secret = "&entcode=02&orgcode=101&clientid=mes&clientsecret=12c8ee7e9bb74ad2a6a0fb3315c8af20"; |
| | | public static string RcvRptDocCreateUrl |
| | | { get; set; } = Cache.SysParam["RcvRptDocCreateUrl_Test", "U9CUrl"].PARAM_VALUE; //"http://172.16.80.20/u9C/webapi/RcvRptDoc/Create"; 测试 |
| | | { get; set; } = ApiConfig.IsTestServer ? Cache.SysParam["RcvRptDocCreateUrl_Test", "U9CUrl"].PARAM_VALUE : Cache.SysParam["RcvRptDocCreateUrl", "U9CUrl"].PARAM_VALUE; //"http://172.16.80.20/u9C/webapi/RcvRptDoc/Create"; 测试 |
| | | //public static string RcvRptDocCreateUrl |
| | | //{ get; set; } = Cache.SysParam["RcvRptDocCreateUrl", "U9CUrl"].PARAM_VALUE; //正式 |
| | | |
| | | public static string U9CBarcodeCreateUrl |
| | | { get; set; } = ApiConfig.IsTestServer ? Cache.SysParam["U9CBarcodeCreateUrl_Test", "U9CUrl"].PARAM_VALUE : Cache.SysParam["U9CBarcodeCreateUrl", "U9CUrl"].PARAM_VALUE; |
| | | |
| | | /// <summary> |
| | | /// 入库单接口 |
| | |
| | | } |
| | | } |
| | | Logger.Interface.Info($"生成入库单成功"); |
| | | |
| | | //条码主档 |
| | | BarcodeCreateInput barcodeCreateInput = new() { |
| | | RevDocId = result.Data[0].m_iD, |
| | | userId = input.userId, |
| | | token = token, |
| | | IsLogin = false, |
| | | }; |
| | | U9CBarcodeCreate(barcodeCreateInput); |
| | | } |
| | | else |
| | | { |
| | |
| | | return action; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 入库单条码主档接口 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<BarcodeCreateInput>> U9CBarcodeCreate(BarcodeCreateInput input) |
| | | { |
| | | Logger.Interface.Info($"/**\r\n *进入入库单条码主档接口....\r\n */\r\n"); //固定写法 |
| | | var action = new ApiAction<BarcodeCreateInput>(); |
| | | try |
| | | { |
| | | 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}"); |
| | | } |
| | | } |
| | | List<BarcodeCreateParam> param = new() { |
| | | new() { |
| | | CreateEntityKeys = new(){ |
| | | new CreateEntityKeys |
| | | { |
| | | ID = input.RevDocId, //入库单ID |
| | | EntityType="UFIDA.U9.Complete.RCVRpt.RcvRptDoc" |
| | | } |
| | | }, |
| | | IsCreateHeadBarCode = true, |
| | | BarCodeRuleCode = "DJCPRK01", |
| | | GenerateCount = 1, |
| | | BCQty = 1, |
| | | } |
| | | }; |
| | | var response = await HttpHelper.PostAsync(U9CBarcodeCreateUrl, JsonConvert.SerializeObject(param), new Dictionary<string, string>() { { "token", input.token } }); |
| | | var result = JsonConvert.DeserializeObject<U9CResult>(response.Message); |
| | | if (result != null) |
| | | { |
| | | if (result.Success && result.Data[0].m_isSucess) |
| | | { |
| | | Logger.Interface.Info($"生成入库单条码主档接口提交Json: {JsonConvert.SerializeObject(param)},返回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}"); |
| | | } |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, "生成入库单条码主档异常"); |
| | | } |
| | | Logger.Interface.Info($"/* 入库单条码主档接口结束 */\r\n"); //固定写法 |
| | | return action; |
| | | } |
| | | |
| | | private List<BAS_LABEL_TEMP> GetLabels(List<InStorePrintJson> printJsons) |
| | | { |
| | | List<BAS_LABEL_TEMP> labels = new List<BAS_LABEL_TEMP>(); |