using System.Net; using System.Runtime.CompilerServices; using System.Security.Policy; using System.Text; using Azure; using Azure.Core; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using WmsMobileServe.Annotation; using WmsMobileServe.ApiClient.Mes; using WmsMobileServe.ApiClient.Mes.Dto; using WmsMobileServe.ApiServe.Mobile.Dto; using WmsMobileServe.ApiServe.Mobile.Vo; using WmsMobileServe.DataBase.Base.Dao; using WmsMobileServe.DataBase.Base.Po; using WmsMobileServe.Utils; namespace WmsMobileServe.ApiServe.Mobile.Service; [Component] public class StockInService(MesApiClient mesApiClient, TOnGoodsShelfDao onGoodsShelfDao,TPickingGoodsDao pickingGoodsDao, TMiStockDao miStockDao, CuxWmsPoLinesItfDao cuxWmsPoLinesItfDao) { /// /// 空载具入库 /// /// /// public MobileApiResponse EmptyVehicleIn(EmptyVehicleInReq request) { if (string.IsNullOrEmpty(request.VehicleNo)) return MobileApiResponse.Fail("传入的载具号为空"); /* 检验载具是否有入库任务 */ var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo); if(stackInRasks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if(stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo)); /* 检验载具是否在库存中 */ var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo); if (stocks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo)); /* 构建空载具信息插入数据库 */ TOnGoodsShelf onGoodsShelf = new() { LotId = UUIDUtils.GetNewUUID2(), GoodsId = "000000", ProviderId = "景旺", LocationId = "", StoNum = 1, AccNum = 1, ShelfNum = 1, StockNum = 0, OnDate = DateTime.Now, OnShelfUserId = "Mobile_Android", StorageId = "", StorageAreaId = "", UpGoodsId = UUIDUtils.GetNewUUID2(), GoodsTypeId = "0", StorageMode = "空托入库", ProdictionDate = DateTime.Now, Ctl = request.VehicleNo, BarCode = "", CustomerId = "景旺", GoodsName = "空载具", Status = "0", Unit = "", TaskType = "1", GoodsMeasureId = UUIDUtils.GetNewUUID2(), PackingNum = 1, DamageNum = 1, Remark = "" }; var insertResult = onGoodsShelfDao.Insert(onGoodsShelf); if (insertResult > 0) return MobileApiResponse.Success(string.Format("空载具:{0} 产生入库任务成功", request.VehicleNo)); return MobileApiResponse.Fail(string.Format("空载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo)); } /// /// 获取箱子号对应的信息 /// /// /// public MobileApiResponse GetGoodsDetail(string? boxNo) { Log.WriteLog("获取箱子号对应的信息" + JsonConvert.SerializeObject(boxNo)); if (string.IsNullOrEmpty(boxNo)) return MobileApiResponse.Fail("无法识别的箱子号"); boxNo = boxNo.Trim(); var response = mesApiClient.GetOutBoxInfo(boxNo); if (!response.IsSend) return MobileApiResponse.Fail(string.Format("请求MES货物物料信息失败,异常信息:{0}", response.Exception?.Message)); var responseData = response.ResponseMsg; if (string.IsNullOrEmpty(responseData)) return MobileApiResponse.Fail(string.Format("MES返回的信息无法识别,信息:{0}", responseData)); var responseDto = XmlUtils.Deserialize(responseData); if (responseDto == null) return MobileApiResponse.Fail(string.Format("MES返回的信息无法解析,信息:{0}", responseData)); var mesData = responseDto.Data ?? ""; //var mesData = "Succ:|2|2|1|0|PL0125367A|11120240400183-2|BAG|2345||3031|"; var dataDetail = mesData.Split(':'); if (dataDetail.Length < 2) return MobileApiResponse.Fail(string.Format("MES返回的信息格式不正确,信息:{0}", responseData)); if (dataDetail[0] != "Succ") return MobileApiResponse.Fail(string.Format("MES返回箱子错误,信息:{0}", responseData)); var goodsInfo = dataDetail[1]; var goodsDetails = goodsInfo.Split("|"); if (goodsDetails.Length < 14) return MobileApiResponse.Fail(string.Format("MES返回的箱子信息参数数量不足,信息:{0}", goodsInfo)); //if(goodsDetails[0] != boxNo) return MobileApiResponse.Fail(string.Format("MES返回的箱子号和扫描的箱子号不一致,返回的箱号:{0}", goodsDetails[0])); var numPerBox = goodsDetails[1]; // 每包数量 var goodsNum = goodsDetails[2]; // 包装数量 var packetNum = goodsDetails[3]; // 包数量 var otherNum = goodsDetails[4]; // 零包数量 if(numPerBox.IsNotNumber() || goodsNum.IsNotNumber() || packetNum.IsNotNumber() || otherNum.IsNotNumber()) return MobileApiResponse.Fail(string.Format("MES返回的箱子信息内的数量存在不是数字情况,信息:{0}", goodsInfo)); if(numPerBox=="0"|| packetNum == "0") return MobileApiResponse.Fail(string.Format("MES返回的箱子信息内的数量为0的情况,信息:{0}", goodsInfo)); GetGoodsDetailResp mesGoodsDetail = new() { BoxNo = boxNo, NumPerBox = numPerBox.ToDecimal(), GoodsNum = goodsNum.ToDecimal(), PacketNum = packetNum.ToDecimal(), OtherNum = otherNum.ToDecimal(), GoodsId = goodsDetails[5], SaleOrderNo = goodsDetails[6], PacketLevel = goodsDetails[7], Cycle = goodsDetails[8], CustomSaleOrderNo = goodsDetails[9], MinorWarehouseId = goodsDetails[10], GoodsDesc = goodsDetails[11], CustomerId = goodsDetails[12], }; var procedure = goodsDetails[13]; return MobileApiResponse.Success(data: mesGoodsDetail); } /// /// 根据订单行和物料号 /// /// /// public MobileApiResponse GetCanUseGoods(GetCanUseGoodsRequest request) { Log.WriteLog("根据订单行和物料号" + JsonConvert.SerializeObject(request)); if (string.IsNullOrEmpty(request.OrderId) || string.IsNullOrEmpty(request.GoodsId) || !request.GoodsId.IsNumber()) return MobileApiResponse.Fail("传入的参数不正确"); var wareNoticeTabs = cuxWmsPoLinesItfDao.SelectCanUse(request.OrderId, Convert.ToInt64(request.GoodsId)); if(wareNoticeTabs == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if(wareNoticeTabs.Count < 1) return MobileApiResponse.Fail("该入库单行和物料无入库单数据"); foreach(var cus in wareNoticeTabs) { if(cus.Quantity - cus.QuantityReceives > 0) return MobileApiResponse.Success("查询成功", cus); } return MobileApiResponse.Fail("无可入库的数量或数量不足,请检查采购单可入库数量"); } /// /// 码盘入库 /// /// /// public MobileApiResponse BindingVehicleIn(BindingVehicleInRequest request) { Log.WriteLog("码盘入库" + JsonConvert.SerializeObject(request)); if (request.VehicleNo.Substring(0, 3) != "CPC") return MobileApiResponse.Fail("传入的箱号不是CPC成品仓箱子格式"); if (string.IsNullOrEmpty(request.VehicleNo)) return MobileApiResponse.Fail("载具号为空"); var goods = request.Goods; if (goods == null || goods.Count < 1) return MobileApiResponse.Fail("传入的数据为空"); List onGoodsShelfs = []; foreach (var item in goods) { var vehicleNo = item.Batch; if(string.IsNullOrEmpty(vehicleNo)) return MobileApiResponse.Fail("载具号不能为空"); /* 检验载具是否有入库任务 */ var stackInTasks = onGoodsShelfDao.SelectWithVehicleNo(vehicleNo); if(stackInTasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if(stackInTasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", vehicleNo)); /* 检验载具是否在库存中 */ var stocks = miStockDao.SelectWithVehicleNo(vehicleNo); if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", vehicleNo)); if (string.IsNullOrEmpty(item.ProductData)) item.ProductData = "19970102"; /* 构建码盘载具信息插入数据库 */ TOnGoodsShelf onGoodsShelf = new() { LotId = UUIDUtils.GetNewUUID2(), GoodsId = item.ItemId, ProviderId = item.Segment1, LocationId = "", StoNum = 1, AccNum = 1, ShelfNum = Convert.ToInt32(item.Quantity), StockNum = 0, OnDate = DateTime.Now, OnShelfUserId = "Mobile_Android", StorageId = "", StorageAreaId = item.Area, UpGoodsId = UUIDUtils.GetNewUUID2(), GoodsTypeId = item.GoodsTypeId, StorageMode = "码盘入库", ProdictionDate = new DateTime(Convert.ToInt32(item.ProductData.Substring(0, 4)), Convert.ToInt32(item.ProductData.Substring(4, 2)), Convert.ToInt32(item.ProductData.Substring(6, 2))), Ctl = request.VehicleNo, BarCode = item.SendOrderId, CustomerId = item.PruBatch, GoodsName = item.GoodsName, WGH = item.Weight, BAOZHIQI = "", //INSTAND=item.PORT, Status = "0", PRODUCLOTID = item.LineLocationId, Unit = item.Unit, TaskType = request.InArea, GoodsMeasureId = item.Batch, PackingNum = 1, DamageNum = 1, Remark = "" }; onGoodsShelfs.Add(onGoodsShelf); } //bool createTask = wareNoticeTabDao.UpdateStatusAndInsertInTask("1", onGoodsShelfs, request.VehicleNo); var insertResult = onGoodsShelfDao.Insert([.. onGoodsShelfs]); if (insertResult > 0) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo)); return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo)); } /// /// MES 码盘入库 /// /// /// public MobileApiResponse BindingVehicleInMes(BindingVehicleInReq request) { try { // 记录原始请求日志 Log.WriteLog("MES码盘入库 请求数据:" + JsonConvert.SerializeObject(request)); // 校验车辆编号格式 if (!string.IsNullOrEmpty(request.VehicleNo)) { if (request.VehicleNo.Substring(0, 3) != "CPC" || request.VehicleNo.Length != 8) return MobileApiResponse.Fail("传入的箱号不是正确的成品仓箱子格式"); } else { return MobileApiResponse.Fail("传入的数据无法识别"); } //检查是否是未下发的入库任务 var stackInTasks_empty = onGoodsShelfDao.SelectWithVehicleNo_Empty(request.VehicleNo); if(stackInTasks_empty.Count>0) { //清楚这个料箱的任务 bool isDeleted = onGoodsShelfDao.DeleteWithVehicleNo(request.VehicleNo); if (isDeleted) { Log.WriteLog("删除成功!"); } else { Log.WriteLog($"删除失败或没有匹配的记录。"); } } if (request.BindingGoodsDetails == null || request.BindingGoodsDetails.Count < 1 && request.InArea == "1") return MobileApiResponse.Fail("传入的数据为空"); // 检查是否存在入库任务 var stackInTasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo); if (stackInTasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stackInTasks.Count > 0) return MobileApiResponse.Fail($"该载具号:{request.VehicleNo} 存在入库任务,请核实后再试"); // 检查库存中是否存在该载具 var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo); if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stocks.Count > 0) return MobileApiResponse.Fail($"该载具号:{request.VehicleNo} 仍在库中,请核实后再试"); //// 构建入库任务列表 List onGoodsShelves = new(); #region //List errorList = new(); //string MesIpPort = "10.50.220.1:8099"; //var options = new ParallelOptions { MaxDegreeOfParallelism = 25 }; // 控制并发数 //Parallel.ForEach(request.BindingGoodsDetails, options, box => //{ // string BARCODE = box.BoxNo; // string STORAGE_ID = box.MinorWarehouseId; // string newLoc = box.MinorWarehouseId + "-WMS-00"; // try // { // string response = GetWmsData($"http://{MesIpPort}/Camstar/PackStock.asmx/PackStockIn?pkwPackLot={BARCODE}&pCustPackId=&pSubInventory={STORAGE_ID}&pLocation={newLoc}", ""); // lock (errorList) // { // if (string.IsNullOrWhiteSpace(response)) // { // Log.WriteLog($"MES返回空响应(箱号:{box.BoxNo})"); // errorList.Add(box.BoxNo); // return; // } // if (response.Contains("Error") && !response.Contains("当前工位 '成品仓'")) // { // Log.WriteLog($"MES返回错误(箱号:{box.BoxNo}): {response}"); // errorList.Add(box.BoxNo); // } // else // { // Log.WriteLog($"MES入库成功(箱号:{box.BoxNo}): {response}"); // } // } // } // catch (Exception ex) // { // lock (errorList) // { // Log.WriteLog($"请求失败(箱号:{box.BoxNo}): {ex}"); // errorList.Add(box.BoxNo); // } // } //}); //if(!errorList.IsNullOrEmpty()) //{ // return MobileApiResponse.Fail($"上报mes失败:{errorList}"); //} #endregion foreach (var item in request.BindingGoodsDetails) { //如果物料编码(GoodsId)或者周期(Cycle)有大于一种的 var distinctGoodsIds = request.BindingGoodsDetails.Select(x => x.GoodsId).Distinct().Count(); bool hasMultipleGoodsIds = distinctGoodsIds > 1; // 检查是否有多个不同的 Cycle var distinctCycles = request.BindingGoodsDetails.Select(x => x.Cycle).Distinct().Count(); bool hasMultipleCycles = distinctCycles > 1; if (hasMultipleGoodsIds || hasMultipleCycles) { // 处理 GoodsId 或 Cycle 有多种值的情况 return MobileApiResponse.Fail($"有周期或者物料编号大于一种的情况,请检查后重新绑定"); } } foreach (var item in request.BindingGoodsDetails) { string code_PLCID = request.VehicleNo.Substring(3, 5).Trim() ; if (string.IsNullOrEmpty(item.GoodsId)) continue; bool isToStorage = request.InArea == "1"; string goodsName = isToStorage ? item.GoodsDesc : "去包装线托盘"; string storageMode = isToStorage ? "MES码盘入库" : "MES码盘包装线"; onGoodsShelves.Add(new TOnGoodsShelf { LotId = UUIDUtils.GetNewUUID2(), GoodsId = item.GoodsId.Trim(), ProviderId = item.SaleOrderNo, LocationId = "", StoNum = item.OtherNum.ToDecimal(), AccNum = item.NumPerBox.ToDecimal(), ShelfNum = item.GoodsNum.ToDecimal(), StockNum = item.PacketNum.ToDecimal(), OnDate = DateTime.Now, OnShelfUserId = "Mobile_Android", StorageId = "", StorageAreaId = item.MinorWarehouseId, UpGoodsId = UUIDUtils.GetNewUUID2(), GoodsTypeId = item.PacketLevel, StorageMode = storageMode, ProdictionDate = DateTime.Now, Ctl = request.VehicleNo, BarCode = item.BoxNo, CustomerId = item.CustomerId, GoodsName = goodsName, Status = "0", PRODUCLOTID = item.MinorWarehouseId, Unit = "", TaskType = request.InArea, GoodsMeasureId = item.SaleOrderNo, PackingNum = 1, DamageNum = 1, ScaleUnit = item.Cycle, Remark = item.CustomSaleOrderNo, INSTAND = request.port, PLCID= code_PLCID }); } // 插入数据库 var insertResult = onGoodsShelfDao.Insert(onGoodsShelves.ToArray()); if (insertResult > 0) { Log.WriteLog($"{request.VehicleNo}入库任务生成成功"); return MobileApiResponse.Success($"载具:{request.VehicleNo} 产生入库任务成功"); } else { return MobileApiResponse.Fail($"载具:{request.VehicleNo} 产生入库任务失败,数据无法插入"); } } catch (Exception ex) { Log.WriteLog($"BindingVehicleInMes 发生异常: {ex.Message}\n{ex.StackTrace}"); return MobileApiResponse.Fail("系统内部错误,请稍后重试"); } } /// /// 获取EBS待码盘信息 /// /// public MobileApiResponse> GetCuxData() { List? cuxWmsPoLinesItfs = cuxWmsPoLinesItfDao.SelectWithStatus(0); if (cuxWmsPoLinesItfs == default) return MobileApiResponse>.Fail(); return MobileApiResponse>.Success(data: cuxWmsPoLinesItfs); } /// /// Ebs 码盘入库 /// /// /// public MobileApiResponse BindingVehicleInEbsOld(BindingVehicleInEbsOldReq request) { Log.WriteLog("Ebs 码盘入库" + JsonConvert.SerializeObject(request)); if (request.VehicleNo.Substring(0,3)!="CPC") return MobileApiResponse.Fail("传入的箱号不是CPC成品仓箱子格式"); if (string.IsNullOrEmpty(request.VehicleNo) || request.BindingGoodsDetails == null) return MobileApiResponse.Fail("传入的数据无法识别"); if (request.BindingGoodsDetails.Count < 1) return MobileApiResponse.Fail("传入的数据为空"); /* 检验载具是否有入库任务 */ var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo); if (stackInRasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo)); /* 检验载具是否在库存中 */ var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo); if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo)); var stockOutRasks = pickingGoodsDao.SelectPickTask_Empty(request.VehicleNo); if (stockOutRasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stockOutRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在出库任务,请核实后再试", request.VehicleNo)); /* 构建入库任务 */ List onGoodsShelves = []; // 需要入库的任务 List<(string? PoHeaderId, string? PoLineId, string? LineLocationId)> orders = []; foreach (var item in request.BindingGoodsDetails) { onGoodsShelves.Add(new() { LotId = UUIDUtils.GetNewUUID2(), GoodsId = item.GoodsId, ProviderId = item.SaleOrderNo, LocationId = "", StoNum = item.OtherNum, AccNum = item.NumPerBox, ShelfNum = item.GoodsNum, StockNum = item.PacketNum, OnDate = DateTime.Now, OnShelfUserId = "Mobile_Android", StorageId = "", StorageAreaId = item.MinorWarehouseId, UpGoodsId = UUIDUtils.GetNewUUID2(), GoodsTypeId = item.PacketLevel, StorageMode = "EBS码盘入库", ProdictionDate = DateTime.Now, Ctl = request.VehicleNo, BarCode = item.BoxNo, CustomerId = item.CustomSaleOrderNo, GoodsName = item.GoodsDesc, Status = "0", Unit = "", TaskType = request.TaskType.ToString(), GoodsMeasureId = item.SaleOrderNo, PackingNum = 1, DamageNum = 1, ScaleUnit = item.Cycle, Remark = "" }); orders.Add((item.PoHeaderId, item.PoLineId, item.LineLocationId)); } // 插入数据,更新状态 var insertResult = onGoodsShelfDao.InsertWithCux(onGoodsShelves, orders); if (insertResult) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo)); return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo)); } /// /// Ebs 码盘入库 /// /// /// public MobileApiResponse BindingVehicleInEbs(BindingVehicleInEbsReq request) { //Log.WriteLog("Ebs 码盘入库" + JsonConvert.SerializeObject(request)); if (string.IsNullOrEmpty(request.VehicleNo) || request.BindingGoodsDetails == default) return MobileApiResponse.Fail("传入的数据无法识别"); if (request.BindingGoodsDetails.Count < 1) return MobileApiResponse.Fail("传入的数据为空"); /* 检验载具是否有入库任务 */ var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo); if (stackInRasks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo)); /* 检验载具是否在库存中 */ var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo); if (stocks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试"); if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo)); /* 检查入库单中是否有该任务 */ //foreach (var item in request.BindingGoodsDetails) //{ // List cuxWmsPos = cuxWmsPoLinesItfDao. //} // /* 构建入库任务 */ // List onGoodsShelves = []; // 需要入库的任务 //List<(string? PoHeaderId, string? PoLineId, string? LineLocationId)> orders = []; //foreach (var item in request.BindingGoodsDetails) //{ // onGoodsShelves.Add(new() // { // LotId = UUIDUtils.GetNewUUID2(), // GoodsId = item.GoodsId, // ProviderId = item.SaleOrderNo, // LocationId = "", // StoNum = item.OtherNum, // AccNum = item.NumPerBox, // ShelfNum = item.GoodsNum, // StockNum = item.PacketNum, // OnDate = DateTime.Now, // OnShelfUserId = "Mobile_Android", // StorageId = "-", // StorageAreaId = item.MinorWarehouseId, // UpGoodsId = UUIDUtils.GetNewUUID2(), // GoodsTypeId = item.PacketLevel, // StorageMode = "EBS码盘入库", // ProdictionDate = DateTime.Now, // Ctl = request.VehicleNo, // BarCode = item.BoxNo, // CustomerId = item.CustomSaleOrderNo, // GoodsName = item.GoodsDesc, // Status = "0", // Unit = "-", // TaskType = request.TaskType.ToString(), // GoodsMeasureId = item.SaleOrderNo, // PackingNum = 1, // DamageNum = 1, // ScaleUnit = item.Cycle, // Remark = "" // }); // orders.Add((item.PoHeaderId, item.PoLineId, item.LineLocationId)); //} // 插入数据,更新状态 //var insertResult = onGoodsShelfDao.InsertWithCux(onGoodsShelves, orders); //if (insertResult) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo)); return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo)); } public string GetWmsData(string value, string sts) { string retJson = ""; try { Log.WriteLog("WCS调用MES 入库接口发送:" + value); string url = value; HttpWebRequest? req = WebRequest.Create(url) as HttpWebRequest; req.ContentType = "text/html"; req.Method = "GET"; req.Timeout = 2000; HttpWebResponse response = req.GetResponse() as HttpWebResponse; using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) { retJson = sr.ReadToEnd(); Log.WriteLog("WCS调用MES 入库接口返回:" + retJson); } } catch (Exception ex) { } return retJson; } }