From 950fac9fd7b9477fc2bbe3253d217f62ac7608e5 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 21 七月 2025 17:01:21 +0800
Subject: [PATCH] SAP接口开发
---
Wms/WMS.BLL/HttpServer.cs | 16
Wms/WMS.IBLL/IBllQualityServer/IQualityInspectServer.cs | 8
Wms/Wms/Controllers/UpApiController.cs | 24 +-
Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs | 123 ++++++++++++
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs | 99 +++++++--
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs | 44 ++-
Wms/Wms/Tools/ApiUrlConfig.cs | 4
HTML/views/QualityControl/QualityInformation.html | 2
Wms/WMS.IBLL/IBllSoServer/IExportNoticeServer.cs | 2
Wms/Model/InterFaceModel/HttpModel.cs | 231 +++++++++++++++++++++++
10 files changed, 493 insertions(+), 60 deletions(-)
diff --git a/HTML/views/QualityControl/QualityInformation.html b/HTML/views/QualityControl/QualityInformation.html
index 84661ad..15bf2aa 100644
--- a/HTML/views/QualityControl/QualityInformation.html
+++ b/HTML/views/QualityControl/QualityInformation.html
@@ -209,7 +209,7 @@
SkuNo: SkuNo,
SkuName: SkuName,
IsQualified: IsQualified,
- Origin: 'WMS'
+ Origin: ''
};
// console.log(param)
var url = "/BllQuality/GetBllQualityList";
diff --git a/Wms/Model/InterFaceModel/HttpModel.cs b/Wms/Model/InterFaceModel/HttpModel.cs
index 9aa5beb..078b54a 100644
--- a/Wms/Model/InterFaceModel/HttpModel.cs
+++ b/Wms/Model/InterFaceModel/HttpModel.cs
@@ -718,5 +718,236 @@
/// </summary>
public string lotNo { get; set; }
}
+
+ public class BackAsnVm
+ {
+ /// <summary>
+ /// 闃查噸鐮�
+ /// </summary>
+ public string ZUUID { get; set; }
+ /// <summary>
+ /// 鍏ュ簱鍗曞彿
+ /// </summary>
+ public string VBELN { get; set; }
+ /// <summary>
+ /// 璁㈠崟绫诲瀷锛�0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 3锛氶��璐у叆搴� 4锛氫綑鏂欓��鍥炲叆搴� 8 锛氱敓浜ч��鏂欏叆搴�
+ /// </summary>
+ public string LFART { get; set; }
+ /// <summary>
+ /// 鍏ュ簱瀹屾垚鏃堕棿
+ /// </summary>
+ public string WADAT_IST { get; set; }
+ /// <summary>
+ /// 鍏ュ簱鍗曟槑缁嗗垪琛�
+ /// </summary>
+ public List<BackAsnDetail> ITEM { get; set; }
+ }
+ public class BackAsnDetail
+ {
+ /// <summary>
+ /// 琛岀紪鐮�
+ /// </summary>
+ public string POSNR { get; set; }
+ /// <summary>
+ /// 鑽搧缂栫爜
+ /// </summary>
+ public string MATNR { get; set; }
+ /// <summary>
+ /// 鑽搧鍚嶇О
+ /// </summary>
+ public string MAKTX { get; set; }
+ /// <summary>
+ /// 瀹炴敹鏁伴噺
+ /// </summary>
+ public string LFIMG { get; set; }
+ /// <summary>
+ /// 鍗曚綅
+ /// </summary>
+ public string MEINS { get; set; }
+ /// <summary>
+ /// 鎵瑰彿
+ /// </summary>
+ public string CHARG { get; set; }
+ /// <summary>
+ /// 鐢熶骇鏃ユ湡
+ /// </summary>
+ public string HSDAT { get; set; }
+ /// <summary>
+ /// 鍒版湡鏃ユ湡
+ /// </summary>
+ public string VFDAT { get; set; }
+ }
+
+ public class BackSoVm
+ {
+ /// <summary>
+ /// 闃查噸鐮�
+ /// </summary>
+ public string ZUUID { get; set; }
+ /// <summary>
+ /// 鍑哄簱鍗曞彿
+ /// </summary>
+ public string VBELN { get; set; }
+ /// <summary>
+ /// 璐т富缂栫爜
+ /// </summary>
+ public string WERKS { get; set; }
+ /// <summary>
+ /// 鍑哄簱鍗曠被鍨�,鍗曟嵁绫诲瀷 0锛氭垚鍝佸嚭搴� 1锛氶鏂欏嚭搴� 4锛氫笉鍚堟牸鍝佸嚭搴� 7锛氬叾浠栧嚭搴� 9 锛氱敓浜ч鏂欏嚭搴�
+ /// </summary>
+ public string LFART { get; set; }
+ /// <summary>
+ /// 璁㈠崟瀹屾垚鏃堕棿
+ /// </summary>
+ public string WADAT_IST { get; set; }
+ /// <summary>
+ /// 璁㈠崟鏄庣粏
+ /// </summary>
+ public List<BackSoDetail> ITEM { get; set; }
+ }
+ public class BackSoDetail
+ {
+ /// <summary>
+ /// 琛屽彿
+ /// </summary>
+ public string POSNR { get; set; }
+ /// <summary>
+ /// 鑽搧缂栫爜
+ /// </summary>
+ public string MATNR { get; set; }
+ /// <summary>
+ /// 鎵规鍙�
+ /// </summary>
+ public string CHARG { get; set; }
+ /// <summary>
+ /// 鏁伴噺
+ /// </summary>
+ public string LFIMG { get; set; }
+ /// <summary>
+ /// 鍗曚綅
+ /// </summary>
+ public string MEINS { get; set; }
+ /// <summary>
+ /// 鐢熶骇鏃ユ湡
+ /// </summary>
+ public string HSDAT { get; set; }
+ /// <summary>
+ /// 鍒版湡鏃ユ湡
+ /// </summary>
+ public string VFDAT { get; set; }
+ }
+
+ public class SapQualityVm
+ {
+ public string @operator{ get; set; }
+ public SendQualityVm data { get; set; }
+ }
+ public class SendQualityVm
+ {
+ /// <summary>
+ /// 璋冩暣鍗曞彿
+ /// </summary>
+ public string orderNo { get; set; }
+ /// <summary>
+ /// 璋冩暣鍗曟槑缁嗗垪琛�
+ /// </summary>
+ public List<SendQualityDetailVm> adjustmentDList { get; set; }
+ }
+ public class SendQualityDetailVm
+ {
+ /// <summary>
+ /// 琛屽彿
+ /// </summary>
+ public string lineNo { get; set; }
+ /// <summary>
+ /// 璐т富缂栧彿
+ /// </summary>
+ public string ownerNo { get; set; }
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string skuNo { get; set; }
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string skuName { get; set; }
+ /// <summary>
+ /// 鎵瑰彿
+ /// </summary>
+ public string lotNo { get; set; }
+ /// <summary>
+ /// 璋冩暣鏁伴噺
+ /// </summary>
+ public decimal skuQty { get; set; }
+ /// <summary>
+ /// 鏄惁鍚堟牸
+ /// </summary>
+ public string IsQualified { get; set; }
+ }
+
+ public class SapSampleVm
+ {
+ public SendSampleVm data { get; set; }
+ }
+ public class SendSampleVm
+ {
+ public List<SendSampleSku> pallDataList { get; set; }
+ }
+ public class SendSampleSku
+ {
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string skuNo { get; set; }
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string skuName { get; set; }
+ /// <summary>
+ /// 鎵瑰彿
+ /// </summary>
+ public string lotNo { get; set; }
+ /// <summary>
+ /// 鎵i櫎鏁伴噺
+ /// </summary>
+ public decimal skuQty { get; set; }
+ }
+
+
+ public class SapQcVm
+ {
+ public SendSapQcVm data { get; set; }
+ }
+ public class SendSapQcVm
+ {
+ public List<SendSapQcDetailVm> pallDataList { get; set; }
+ }
+ public class SendSapQcDetailVm
+ {
+ /// <summary>
+ /// 璇烽獙缂栧彿
+ /// </summary>
+ public string QcNo { get; set; }
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string skuNo { get; set; }
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string skuName { get; set; }
+ /// <summary>
+ /// 鎵瑰彿
+ /// </summary>
+ public string lotNo { get; set; }
+ /// <summary>
+ /// 鍒拌揣鏁伴噺
+ /// </summary>
+ public decimal Qty { get; set; }
+ /// <summary>
+ /// 渚涜揣鎵规
+ /// </summary>
+ public string SupplierLot { get; set; }
+ }
#endregion
}
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 715a0b7..46d5205 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -4,12 +4,14 @@
using Model.ModelDto.SysDto;
using Model.ModelVm;
using Model.ModelVm.SysVm;
+using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
+using Utility.Tools;
using WMS.BLL.LogServer;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
@@ -1324,6 +1326,7 @@
var detailModel = new BllArrivalNoticeDetail()
{
+ OrderDetailCode = asnDetailModel.lineNo,
ASNNo = asnNo,
SkuNo = asnDetailModel.skuNo.ToString(),
SkuName = skuModel.SkuName,
@@ -1334,9 +1337,9 @@
FactQty = 0,
CompleteQty = 0,
PackagNo = skuModel.PackagNo,
- SupplierLot = asnDetailModel.supplyBatch,//鐢熶骇鏃ユ湡
- Lot1 = asnDetailModel.productionDate,//杩囨湡鏃ユ湡
- Lot2 = asnDetailModel.expireDate,
+ SupplierLot = asnDetailModel.supplyBatch,
+ Lot1 = asnDetailModel.productionDate,//鐢熶骇鏃ユ湡
+ Lot2 = asnDetailModel.expireDate,//杩囨湡鏃ユ湡
Status = "0",
IsSampling = "0",
InspectStatus = "0",
@@ -1389,28 +1392,39 @@
{
throw new Exception("澶嶆牳澶辫触锛屽鏍镐汉鍛樺拰鍏抽棴璁㈠崟浜哄憳涓嶈兘鐩稿悓锛�");
}
- var list = new List<AsnDetail>();
+ var list = new List<BackAsnDetail>();
foreach (var d in detail)
{
- var item = new AsnDetail()
+ var mater = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == d.SkuNo);
+ if (mater == null)
{
- SkuNo = d.SkuNo,
- LotNo = d.LotNo,
- Qty = d.CompleteQty,
- PackagNo = d.PackagNo,
- SupplierLot = d.SupplierLot
+ throw new Exception($"澶嶆牳澶辫触锛岀墿鏂欑紪鐮�:{d.SkuNo}鐨勭墿鏂欎俊鎭笉瀛樺湪");
+ }
+ var item = new BackAsnDetail()
+ {
+ POSNR=d.OrderDetailCode,
+ MATNR = d.SkuNo,
+ MAKTX=d.SkuName,
+ LFIMG = d.CompleteQty.ToString(),
+ MEINS= mater.UnitNo,
+ CHARG = d.LotNo,
+ HSDAT = d.Lot1,
+ VFDAT = d.Lot2
};
list.Add(item);
}
- var soInfo = new AsnInfo()
+ var soInfo = new BackAsnVm()
{
- OrderCode = notice.OrderCode,
- AsnDetails = list
+ ZUUID = Guid.NewGuid().ToString(),
+ VBELN = notice.OrderCode,
+ LFART = notice.Type,
+ WADAT_IST = Convert.ToDateTime(notice.CompleteTime).ToString("yyyy-MM-dd"),
+ ITEM = list
};
#region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
//绯荤粺瀵规帴鍚庢斁寮�
- /*var jsonData = JsonConvert.SerializeObject(soInfo);
+ var jsonData = JsonConvert.SerializeObject(soInfo);
var response = HttpHelper.DoPost(url, jsonData, "鍏ュ簱鍗曞畬鎴愪笂浼�", "ERP");
@@ -1418,7 +1432,7 @@
if (obj.Success != 0)
{
throw new Exception("涓婁紶澶辫触" + obj.Message);
- }*/
+ }
#endregion
notice.Status = "4";
diff --git a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
index 7bed1a0..0cc581b 100644
--- a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
+++ b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Data;
using System.Text;
+using System.Threading.Tasks;
+using Model.InterFaceModel;
using Model.ModelDto.BllQualityDto;
using Model.ModelVm;
using SqlSugar;
@@ -218,7 +220,128 @@
return isquality;
}
+ /// <summary>
+ /// SAP涓嬪彂搴撳瓨璋冩暣鍗�
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public string InsertQualitySap(SendQualityVm model)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(model.orderNo) || model.adjustmentDList.Count <= 0)
+ {
+ throw new Exception("鍙傛暟閿欒");
+ }
+ var asnInfo = Db.Queryable<BllArrivalNotice>().First(w => w.IsDel == "0" && w.OrderCode == model.orderNo);
+ if (asnInfo == null)
+ {
+ throw new Exception($"鏈煡璇㈠埌{model.orderNo}瀵瑰簲鐨勫叆搴撳崟淇℃伅");
+ }
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+ foreach (var item in model.adjustmentDList)
+ {
+ var asnDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.IsDel == "0" && w.ASNNo == asnInfo.ASNNo && w.OrderDetailCode == item.lineNo && w.SkuNo == item.skuNo && w.LotNo == item.lotNo);
+ if (asnDetail == null)
+ {
+ throw new Exception($"鏈煡璇㈠埌{item.lineNo}瀵瑰簲鐨勫叆搴撳崟鏄庣粏淇℃伅");
+ }
+ asnDetail.InspectStatus = item.IsQualified;
+ //鏇存柊鍏ュ簱鍗曟槑缁嗚川妫�鐘舵��
+ Db.Updateable(asnDetail).ExecuteCommand();
+
+ //鑾峰彇鐗╂枡淇℃伅
+ var sku = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.SkuNo == item.skuNo);
+ if (sku == null)
+ {
+ throw new Exception($"鐗╂枡缂栫爜涓簕item.skuNo}鐨勭墿鏂欎俊鎭笉瀛樺湪锛岃鏍告煡锛�");
+ }
+
+ string toDayTime = DateTime.Now.ToString("yyyyMMdd");
+ var maxInspectNo = Db.Queryable<BllQualityInspect>().Where(m => m.IsDel == "0" && m.InspectNo.Contains("SAP")).Max(m => m.InspectNo);
+ if (string.IsNullOrWhiteSpace(maxInspectNo))
+ {
+ maxInspectNo = "SAP" + toDayTime + "0001";
+ }
+ else
+ {
+ var lotStr = maxInspectNo.Substring(3, 8);
+ if (lotStr == toDayTime)
+ {
+ maxInspectNo = "SAP" + toDayTime + (int.Parse(maxInspectNo.Replace("SAP","").Substring(8, 4)) + 1).ToString().PadLeft(4, '0');
+ }
+ else
+ {
+ maxInspectNo = "SAP" + toDayTime + "0001";
+ }
+ }
+ var qualityModel = new BllQualityInspect
+ {
+ ASNNo = asnDetail.ASNNo,
+ InspectNo = maxInspectNo,
+ SkuNo = item.skuNo,
+ SkuName = item.skuName,
+ Standard = sku.Standard,
+ LotNo = item.lotNo,
+ IsQualified = item.IsQualified,
+ Origin = "SAP",
+ FailQty = 0,
+ PassQty = 0
+ };
+
+ //鏌ユ壘搴撳瓨淇℃伅
+ var stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == item.skuNo && w.LotNo == item.lotNo).ToList();
+ foreach(var datailItem in stockDetailList)
+ {
+ List<DataBoxInfo> boxList = Db.Queryable<DataBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == item.skuNo && a.LotNo == item.lotNo && a.PalletNo == datailItem.PalletNo).ToList();
+ foreach (var boxItem in boxList)
+ {
+ if (item.IsQualified == "0")//涓嶅悎鏍�
+ {
+ boxItem.InspectStatus = "2";
+ }
+ else//鍚堟牸
+ {
+ boxItem.InspectStatus = "1";
+ }
+ }
+ //鏇存柊绠辩爜鏄庣粏璐ㄦ鐘舵��
+ Db.Updateable(boxList).ExecuteCommand();
+
+ if (item.IsQualified == "0")//涓嶅悎鏍�
+ {
+ datailItem.InspectStatus = "2";
+ //涓嶅悎鏍兼暟閲�
+ qualityModel.FailQty += datailItem.Qty;
+ }
+ else//鍚堟牸
+ {
+ datailItem.InspectStatus = "1";
+ //鍚堟牸鏁伴噺
+ qualityModel.PassQty += datailItem.Qty;
+ }
+ //鏇存柊搴撳瓨鏄庣粏璐ㄦ鐘舵��
+ Db.Updateable(datailItem).ExecuteCommand();
+ }
+ //娣诲姞璐ㄦ鍙樻洿璁板綍
+ Db.Insertable(qualityModel).ExecuteCommand();
+ }
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+
+ return "0";
+ }
+ catch (Exception ex)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ //鎶涘嚭寮傚父
+ throw new Exception("鎺ユ敹SAP涓嬪彂搴撳瓨璋冩暣鍗曞紓甯�:", ex);
+ }
+ }
#endregion
}
diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index 3704120..b83a0fb 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -630,7 +630,7 @@
}
//鍥炰紶鍑哄簱鍗�
- public bool FinishSo(int id, string url, int userId)
+ public bool FinishSo(int id, string url, string url2, int userId)
{
try
{
@@ -652,34 +652,83 @@
{
throw new Exception("澶嶆牳澶辫触锛屽鏍镐汉鍛樺拰鍏抽棴璁㈠崟浜哄憳涓嶈兘鐩稿悓锛�");
}
- var list = new List<SoDetail>();
- foreach (var d in detail)
+ if (notice.Type == "2")//鎶芥鍑哄簱
{
- var item = new SoDetail()
+ var list = new List<SendSampleSku>();
+ foreach (var d in detail)
{
- SkuNo = d.SkuNo,
- LotNo = d.LotNo,
- Qty = (decimal)d.CompleteQty
- };
- list.Add(item);
- }
- var soInfo = new SoInfo()
- {
- OrderCode = notice.OrderCode,
- SoDetails = list
- };
- #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
- //绯荤粺瀵规帴鍚庢斁寮�
- /*var jsonData = JsonConvert.SerializeObject(soInfo);
+ var item = new SendSampleSku()
+ {
+ skuNo = d.SkuNo,
+ skuName = d.SkuName,
+ lotNo = d.LotNo,
+ skuQty = Convert.ToDecimal(d.CompleteQty)
+ };
+ list.Add(item);
+ }
+ SendSampleVm sendSampleVm = new SendSampleVm();
+ sendSampleVm.pallDataList = list;
- var response = HttpHelper.DoPost(url, jsonData, "鍑哄簱鍗曞畬鎴愪笂浼�", "ERP");
-
- var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
- if (obj.Success != 0)
+ SapSampleVm sapSampleVm = new SapSampleVm();
+ sapSampleVm.data = sendSampleVm;
+
+ #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
+ //绯荤粺瀵规帴鍚庢斁寮�
+ /*var jsonData = JsonConvert.SerializeObject(sapSampleVm);
+
+ var response = HttpHelper.DoPost(url2, jsonData, "鎶芥鍑哄簱瀹屾垚涓婁紶", "ERP");
+
+ var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
+ if (obj.Success != 0)
+ {
+ throw new Exception("涓婁紶澶辫触" + obj.Message);
+ }*/
+ #endregion
+ }
+ else
{
- throw new Exception("涓婁紶澶辫触" + obj.Message);
- }*/
- #endregion
+ var list = new List<BackSoDetail>();
+ foreach (var d in detail)
+ {
+ var mater = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == d.SkuNo);
+ if (mater == null)
+ {
+ throw new Exception($"澶嶆牳澶辫触锛岀墿鏂欑紪鐮�:{d.SkuNo}鐨勭墿鏂欎俊鎭笉瀛樺湪");
+ }
+ var item = new BackSoDetail()
+ {
+ POSNR = d.OrderDetailCode,
+ MATNR = d.SkuNo,
+ CHARG = d.LotNo,
+ LFIMG = d.CompleteQty.ToString(),
+ MEINS = mater.UnitNo,
+ HSDAT = "",
+ VFDAT = ""
+ };
+ list.Add(item);
+ }
+ var soInfo = new BackSoVm()
+ {
+ ZUUID = Guid.NewGuid().ToString(),
+ VBELN = notice.OrderCode,
+ WERKS = notice.CustomerNo,
+ LFART = notice.Type,
+ WADAT_IST = Convert.ToDateTime(notice.CompleteTime).ToString("yyyy-MM-dd"),
+ ITEM = list
+ };
+ #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
+ //绯荤粺瀵规帴鍚庢斁寮�
+ /*var jsonData = JsonConvert.SerializeObject(soInfo);
+
+ var response = HttpHelper.DoPost(url, jsonData, "鍑哄簱鍗曞畬鎴愪笂浼�", "ERP");
+
+ var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
+ if (obj.Success != 0)
+ {
+ throw new Exception("涓婁紶澶辫触" + obj.Message);
+ }*/
+ #endregion
+ }
notice.Status = "6";
notice.CheckTime = DateTime.Now;
diff --git a/Wms/WMS.BLL/HttpServer.cs b/Wms/WMS.BLL/HttpServer.cs
index 8672d8e..f7fbbc3 100644
--- a/Wms/WMS.BLL/HttpServer.cs
+++ b/Wms/WMS.BLL/HttpServer.cs
@@ -2027,15 +2027,15 @@
//Db.Insertable(exTask).ExecuteCommand();
- // 璋冪敤Limes鎺ュ彛鍙戣捣璇烽獙
- var sendModel = new SendLimesModel()
+ // 璋冪敤Sqp鎺ュ彛鍙戣捣璇烽獙
+ var sendModel = new SendSapQcDetailVm()
{
QcNo = data.QcNo,
- SkuNo = data.SkuNo,
- Qty = data.Qty.ToString(),
- LotNo = data.LotNo,
- SupplierLot = data.SupplierLot,
- RequestUser = userName, // 璇烽獙浜�
+ skuNo=data.SkuNo,
+ skuName = data.SkuNo,
+ lotNo = data.LotNo,
+ Qty = Convert.ToDecimal(data.Qty),
+ SupplierLot = data.SupplierLot
};
var jsonData = JsonConvert.SerializeObject(sendModel);
string response = "";
@@ -2043,7 +2043,7 @@
try
{
var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
- //response = HttpHelper.DoPost(url, jsonData, "涓婁紶Limes绯荤粺鍙戣捣璇烽獙", "Limes");
+ //response = HttpHelper.DoPost(url, jsonData, "涓婁紶Sap绯荤粺鍙戣捣璇烽獙", "Sap");
var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
////瑙f瀽杩斿洖鏁版嵁
diff --git a/Wms/WMS.IBLL/IBllQualityServer/IQualityInspectServer.cs b/Wms/WMS.IBLL/IBllQualityServer/IQualityInspectServer.cs
index 5b3e340..2faf7f6 100644
--- a/Wms/WMS.IBLL/IBllQualityServer/IQualityInspectServer.cs
+++ b/Wms/WMS.IBLL/IBllQualityServer/IQualityInspectServer.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using Model.InterFaceModel;
using Model.ModelDto.BllQualityDto;
using WMS.Entity.BllQualityEntity;
@@ -25,6 +26,13 @@
/// <returns></returns>
int InsertQuality(BllQualityInspect model);
+ /// <summary>
+ /// SAP涓嬪彂搴撳瓨璋冩暣鍗�
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ string InsertQualitySap(SendQualityVm model);
#endregion
}
}
diff --git a/Wms/WMS.IBLL/IBllSoServer/IExportNoticeServer.cs b/Wms/WMS.IBLL/IBllSoServer/IExportNoticeServer.cs
index d3f1f72..80ac280 100644
--- a/Wms/WMS.IBLL/IBllSoServer/IExportNoticeServer.cs
+++ b/Wms/WMS.IBLL/IBllSoServer/IExportNoticeServer.cs
@@ -25,7 +25,7 @@
/// <param name="url">涓婁紶璺緞</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool FinishSo(int id, string url, int userId);
+ bool FinishSo(int id, string url, string url2, int userId);
/// <summary>
/// 鎺ュ彈鐢熶骇鍙枡淇″彿鎺ュ彛
/// </summary>
diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs
index 637e32f..bc1297e 100644
--- a/Wms/Wms/Controllers/UpApiController.cs
+++ b/Wms/Wms/Controllers/UpApiController.cs
@@ -30,6 +30,7 @@
using System.Xml.Linq;
using WMS.IBLL.ISysServer;
using ZXing;
+using WMS.IBLL.IBllQualityServer;
namespace Wms.Controllers
{
@@ -49,12 +50,13 @@
private readonly IPdaAsnServer _pdaAsnServer;// PDA
private readonly IMaterialsServer _materialSvc;//鐗╂枡Svc
private readonly ICustomerServer _customerSvc;//瀹㈡埛Svc
+ private readonly IQualityInspectServer _inspectSvc;//璐ㄩ噺Svc
private readonly IHttpServer _http;
private string logStr = $@".\log\SAP璧嬬爜\Sap涓嬪彂鎶ユ枃" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
- public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc, IHttpServer http)
+ public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc,IQualityInspectServer inspectSvc, IHttpServer http)
{
_config = setting.Value;
_exNoticeSvc = exNoticeSvc;
@@ -64,6 +66,7 @@
_pdaAsnServer = pdaAsnServer;
_materialSvc = materialSvc;
_customerSvc = customerSvc;
+ _inspectSvc = inspectSvc;
_http = http;
}
#endregion
@@ -154,21 +157,21 @@
try
{
var jsonData = JsonConvert.SerializeObject(model);
- LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戯細( {jsonData} ),", logStr);
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曟暟鎹細( {jsonData} ),", logStr);
var _result = _arrivalNoticeSvc.CreateAsn(model.data, model.@operator);
var list = new { Success = 0, Message = "涓嬪彂鎴愬姛" };
if (_result.Success == 0)
{
- LogFile.SaveLogToFile($"瀹㈡埛渚涘簲鍟嗕富鏁版嵁鍚屾锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戞垚鍔燂細( {JsonConvert.SerializeObject(list)} ),", logStr);
return Ok(new { result = true, code = "1", message = "success" });
}
else
{
list = new { Success = -1, Message = _result.Message };
- LogFile.SaveLogToFile($"瀹㈡埛渚涘簲鍟嗕富鏁版嵁鍚屾锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戝け璐ワ細( {JsonConvert.SerializeObject(list)} ),", logStr);
return Ok(new { result = false, code = "400", message = _result.Message });
}
}
@@ -211,14 +214,15 @@
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
- public IActionResult UpQuality(object model)
+ public IActionResult UpQuality(SapQualityVm model)
{
-
+ var logStr = $@".\log\SAP\搴撳瓨璐ㄩ噺鐘舵�佹帴鏀�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
try
{
- // var sd = JsonConvert.SerializeObject(model);
- // var sd2 = JsonConvert.DeserializeObject<BoxPalletBindVm>(sd);
- LogFile.SaveLogToFile($"Sap璐ㄩ噺鐘舵�佸彉鏇达細( {model} ),", logStr);
+ var jsonData = JsonConvert.SerializeObject(model);
+ LogFile.SaveLogToFile($"Sap搴撳瓨璐ㄩ噺鐘舵�佷笅鍙戯細( {jsonData} ),", logStr);
+
+ _inspectSvc.InsertQualitySap(model.data);
return Ok(new { result = true, code = "1", message = "success" });
}
catch (Exception e)
@@ -375,7 +379,7 @@
{
return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
+ _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, _config.ErpHost + _config.SoFinishUrl2, int.Parse(userId));
return Ok(new { code = 0, count = 0, msg = "鍑哄簱鍗曞鏍稿苟涓婁紶鎴愬姛" });
}
catch (Exception e)
diff --git a/Wms/Wms/Tools/ApiUrlConfig.cs b/Wms/Wms/Tools/ApiUrlConfig.cs
index 657d61d..c1e7398 100644
--- a/Wms/Wms/Tools/ApiUrlConfig.cs
+++ b/Wms/Wms/Tools/ApiUrlConfig.cs
@@ -36,6 +36,10 @@
/// 鍑哄簱璁㈠崟鍏抽棴涓婁紶
/// </summary>
public string SoFinishUrl { get; set; }
+ /// <summary>
+ /// 鎶芥鍑哄簱璁㈠崟鍏抽棴涓婁紶
+ /// </summary>
+ public string SoFinishUrl2 { get; set; }
/// <summary>
/// 搴撳瓨鍙樻洿涓婁紶(鐩樺簱璋冩暣鍚�)
--
Gitblit v1.8.0