private void AdjustSKUData(string data) { WMSHelper.SaveLog("AdjustSKUData", data, "调用方法", "info", "in"); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(data); if (xmlDocument == null) { result = ReturnXML("0001", "xml文档格式错误", "0", ""); WMSHelper.SaveLog("AdjustSKUData", data, "xml文档格式错误", "error", "in"); return; } XmlNode skulist = xmlDocument.SelectSingleNode("xmldata/skulist"); if (skulist == null) { result = ReturnXML("0001", "不包含入库信息", "0", ""); WMSHelper.SaveLog("AdjustSKUData", data, "xml不包含入库信息", "error", "in"); return; } try { List <SimpleSKUUpdateInfo> list = new List <SimpleSKUUpdateInfo>(); foreach (XmlNode skuNode in skulist.SelectNodes("item")) { SimpleSKUUpdateInfo info = new SimpleSKUUpdateInfo(); info.SkuId = skuNode.SelectSingleNode("skuid").InnerText; info.Amount = int.Parse(skuNode.SelectSingleNode("amount").InnerText); list.Add(info); } bool flag = false; if (list.Count > 0) { List <ErrorSimpleSKUUpdateInfo> errorlist; flag = ProductHelper.AdjustSkusStock(list, out errorlist); if (flag && errorlist.Count == 0) { result = ReturnXML("0000", "操作成功", "1", ""); WMSHelper.SaveLog("AdjustSKUData", data, "操作成功", "info", "in"); return; } else if (flag && errorlist.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (ErrorSimpleSKUUpdateInfo info in errorlist) { sb.Append("<resultInfo>"); sb.AppendFormat("<skuid>{0}</skuid>", info.SkuId); sb.AppendFormat("<amount>{0}</amount>", info.Amount); sb.AppendFormat("<errorcode>{0}</errorcode>", info.errorcode); sb.AppendFormat("<errordescr>{0}</errordescr>", info.errordescr); sb.Append("</resultInfo>"); } result = ReturnXML("0001", "部分操作成功", "2", sb.ToString()); WMSHelper.SaveLog("AdjustSKUData", data, "部分操作成功:" + sb.ToString(), "info", "in"); return; } else { result = ReturnXML("0001", "数据库操作异常", "0", ""); WMSHelper.SaveLog("AdjustSKUData", data, "数据库操作异常", "error", "in"); return; } } else { result = ReturnXML("0001", "不包含库存同步信息", "0", ""); WMSHelper.SaveLog("AdjustSKUData", data, "不包含库存同步信息", "error", "in"); return; } } catch (Exception ex) { result = ReturnXML("0001", ex.ToString(), "0", ""); WMSHelper.SaveLog("AdjustSKUData", data, ex.ToString(), "error", "in"); return; } }