79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Channels;
|
|
using System.Text;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
using HHWMS.Web;
|
|
using HHWMS.Web.Models;
|
|
using Newtonsoft.Json;
|
|
using WalkingTec.Mvvm.Core;
|
|
using WalkingTec.Mvvm.Mvc;
|
|
|
|
namespace WebService
|
|
{
|
|
public class WmsMesService : IContract
|
|
{
|
|
private readonly IUnitWork _unitwork;
|
|
private readonly WTMContext _wtm;
|
|
public WmsMesService(IUnitWork unitwork, WTMContext wtm)
|
|
{
|
|
_unitwork = unitwork;
|
|
_wtm = wtm;
|
|
}
|
|
public Result MesInWms(string materails)
|
|
{
|
|
try
|
|
{
|
|
_wtm.DoLog("", ActionLogTypesEnum.Normal,"mes", request: materails);
|
|
var data = JsonConvert.DeserializeObject<MesMaterials>(materails);
|
|
// 插入物料信息表
|
|
var materialList = new List<Material>();
|
|
foreach (var item in data.ISSUEMATERIALS.ISSUEITEM)
|
|
{
|
|
var material = new Material
|
|
{
|
|
MaterialCode = item.MATNR,
|
|
MaterialName = item.MAKTX,
|
|
MaterialType = item.BWART,
|
|
MaterialUnit = item.ERFME,
|
|
MaterialSpec = item.ZZXHGG,
|
|
Batch = item.LICHA,
|
|
QRCode = item.ZMBLNR,
|
|
Qty = decimal.Parse(item.MENGE),
|
|
SourceCode = item.AUFNR,
|
|
SupplierCode = item.ZZSCCJ,
|
|
CreateTime = DateTime.Now,
|
|
CreateBy = "mes"
|
|
};
|
|
materialList.Add(material);
|
|
}
|
|
_unitwork.BatchAdd<Material>(materialList.ToArray());
|
|
return new Result();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: materails, result: "error");
|
|
return new Result { Status = "N", Message = ex.Message};
|
|
}
|
|
}
|
|
|
|
public Result MesOutWms(string outOrder)
|
|
{
|
|
try
|
|
{
|
|
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: outOrder);
|
|
|
|
return new Result();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: outOrder, result: "error");
|
|
return new Result { Status = "N", Message = ex.Message };
|
|
}
|
|
}
|
|
}
|
|
}
|