1.OA接口字段调整。
2.SRM新增条码未全部打印,无法扫描限制。
3.新增携客云确认到货流程
| | |
| | | public string? erpCode { get; set; } |
| | | } |
| | | |
| | | //到货单明细json 和 到货单条码 |
| | | public class XKYGetDhdHwsdRequest |
| | | { |
| | | public string? dnXkNo { get; set; } |
| | | public string? erpCode { get; set; } |
| | | } |
| | | |
| | | MesXkyService m = new MesXkyService(); |
| | | |
| | | [HttpPost("GetXkyDhd")] |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | [HttpPost("GetXkyHwsd")] |
| | | public ResponseResult GetXkyHwsd(XKYGetDhdHwsdRequest request) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos = m.GetXkyHwsd(request); |
| | | var tbBillList = resultInfos; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = "" |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | // 字段映射配置(字段名 -> 数据库列名) |
| | | var fieldMappings = new Dictionary<string, (string Field, string Default)> |
| | | { |
| | | ["sqr"] = ("sqr", "0"), // 默认值改为数字 |
| | | ["sqrq"] = ("sqrq", ""), // 空字符串用于日期格式化 |
| | | ["szbm"] = ("szbm", "0"), // 默认值改为数字 |
| | | ["szdw"] = ("szdw", "0"), // 默认值改为数字 |
| | | ["ycczdh"] = ("ycczdh", "N/A"), |
| | | ["wlbm"] = ("wlbm", "N/A"), |
| | | ["lh"] = ("lh", "N/A"), |
| | | ["khgys"] = ("khgys", "N/A"), |
| | | ["jzmcwlmc"] = ("jzmcwlmc", "N/A"), |
| | | ["dhdhmes"] = ("dhdhmes", "N/A"), |
| | | ["dhdhtxt"] = ("dhdhtxt", "N/A"), |
| | | ["bhgpqxms"] = ("bhgpqxms", "无缺陷描述") |
| | | }; |
| | | |
| | |
| | | var result = new JArray(); |
| | | foreach (var mapping in fieldMappings) |
| | | { |
| | | var value = GetDynamicValue(firstRecord, mapping.Value.Field, mapping.Value.Default); |
| | | var value = mapping.Key switch |
| | | { |
| | | "sqr" or "szbm" or "szdw" => |
| | | int.TryParse(GetDynamicValue(firstRecord, mapping.Value.Field, mapping.Value.Default), out int num) |
| | | ? num : 0, |
| | | "sqrq" => DateTime.TryParse(GetDynamicValue(firstRecord, mapping.Value.Field, ""), out DateTime date) |
| | | ? date.ToString("yyyy-MM-dd") |
| | | : DateTime.Now.ToString("yyyy-MM-dd"), |
| | | _ => GetDynamicValue(firstRecord, mapping.Value.Field, mapping.Value.Default) |
| | | }; |
| | | result.Add(new JObject |
| | | { |
| | | ["fieldName"] = mapping.Key, |
| | |
| | | public class MesXkyService : RepositoryNoEntity |
| | | { |
| | | /// <summary> |
| | | /// 系统自动日志模板(用于携客云接口调用记录) |
| | | /// 送货单日志模板(用于携客云接口调用记录) |
| | | /// </summary> |
| | | private string _logMessageDHD = ""; |
| | | |
| | | /// <summary> |
| | | /// 系统自动日志模板(用于携客云接口调用记录) |
| | | /// 送货单明细日志模板(用于携客云接口调用记录) |
| | | /// </summary> |
| | | private string _logMessageDhdDetail = ""; |
| | | |
| | | /// <summary> |
| | | /// 系统自动日志模板(用于携客云接口调用记录) |
| | | /// 送货单条码日志模板(用于携客云接口调用记录) |
| | | /// </summary> |
| | | private string _logMessageDhdBar = ""; |
| | | |
| | | /// <summary> |
| | | /// 送货单货物送达日志模板(用于携客云接口调用记录) |
| | | /// </summary> |
| | | private string _logMessageDhdHwsd = ""; |
| | | |
| | | //获取携客云到货单 |
| | | public dynamic GetXkyDhd(XKYGetDhdRequest entity) |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | public dynamic GetXkyHwsd(XKYGetDhdHwsdRequest entity) |
| | | { |
| | | _logMessageDhdHwsd = "【SysAuto】携客云送货单货物送达。"; |
| | | /// <summary> |
| | | /// 请求报文缓存(存储序列化后的JSON请求内容) |
| | | /// </summary> |
| | | string _requestJson = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 动态响应对象(存储反序列化的携客云接口响应) |
| | | /// </summary> |
| | | dynamic _responseData = new System.Dynamic.ExpandoObject(); |
| | | |
| | | /// <summary> |
| | | /// 接口执行时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | /// </summary> |
| | | string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | /// <summary> |
| | | /// 接口调用状态(0-失败 1-成功) |
| | | /// </summary> |
| | | int sendStatus = 0; |
| | | |
| | | try |
| | | { |
| | | string ErrorMsg = ""; |
| | | ApiCommonParam Apiparam = ApiCommonParam.NewApiCommon(); |
| | | |
| | | _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string sendJson = JsonConvert.SerializeObject(entity); |
| | | ArrayList SQLStringList = new ArrayList(); |
| | | var url = "https://openapi.xiekeyun.com/delivery/updateDeliveryStatus.json"; |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
| | | |
| | | _requestJson = "{\"commonParam\":" + JsonConvert.SerializeObject(Apiparam) + ",\"body\":" + sendJson + "}"; |
| | | byte[] postData = Encoding.UTF8.GetBytes(_requestJson); |
| | | |
| | | // 创建请求对象 |
| | | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); |
| | | request.Method = "POST"; |
| | | request.ContentType = "application/json"; |
| | | request.ContentLength = postData.Length; |
| | | |
| | | // 发送请求数据 |
| | | using (Stream stream = request.GetRequestStream()) |
| | | { |
| | | stream.Write(postData, 0, postData.Length); |
| | | } |
| | | |
| | | // 发送请求并获取响应 |
| | | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); |
| | | using (Stream stream = response.GetResponseStream()) |
| | | using (StreamReader reader = new StreamReader(stream)) |
| | | { |
| | | string result2 = reader.ReadToEnd(); |
| | | |
| | | _responseData = JsonConvert.DeserializeObject(result2); |
| | | } |
| | | |
| | | if (_responseData.result != 1) |
| | | throw new ApplicationException(_responseData.errorMsg); |
| | | |
| | | sendStatus = _responseData.result; |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: Db, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "MES_INV_ITEM_ARN", |
| | | detail: _logMessageDhdBar, |
| | | orderNo: "", |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: "", |
| | | xkyEndTime: "", |
| | | sendStatus: sendStatus, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | return _responseData; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: Db, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "MES_INV_ITEM_ARN", |
| | | detail: _logMessageDhdBar + $"系统异常错误:{e.Message}\n跟踪:{e.StackTrace}", |
| | | orderNo: "", |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: "", |
| | | xkyEndTime: "", |
| | | sendStatus: 0, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | throw new Exception(e.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | if (shdh.Count < 1) |
| | | throw new Exception($"送货单号【{unity.shdh}】不存在或未同步!"); |
| | | |
| | | // var sql3 = @"SELECT ISNULL((SELECT SUM(delivery_qty) FROM DELIVERY_NOTICE_DETAIL WHERE delivery_no = @shdh), 0) - |
| | | //ISNULL((SELECT SUM(include_qty) FROM TBL_BARCODE_INFORMATION WHERE delivery_no = @shdh), 0) AS Diffnum "; |
| | | |
| | | // var diffNum = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams).First(); |
| | | |
| | | // if (diffNum.Diffnum != 0) |
| | | // throw new Exception($"送货单号【{unity.shdh}】条码未全部打印或未同步,无法收货!"); |
| | | |
| | | var sql2 = @"select D.item_no, |
| | | D.item_name, |