From f2bc08e28dda7022202f07217f6a3c150f818af7 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期一, 20 一月 2025 08:32:16 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/liudongl/jc24-wms
---
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs | 129 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 115 insertions(+), 14 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index dfa78f2..90d2952 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -22,6 +22,7 @@
using System.Security.Policy;
using WMS.Entity.DataEntity;
using WMS.Entity.BllQualityEntity;
+using Microsoft.VisualBasic;
namespace WMS.BLL.BllAsnServer
{
@@ -344,6 +345,16 @@
continue;
}
}
+ if (!string.IsNullOrEmpty(detailModel.IsBale))
+ {
+ detailModel.IsBale = detailModel.IsBale == "鏄�" ? "1" : "0";
+ if (detailModel.IsBale != "1" && detailModel.IsBale != "0")
+ {
+ //鍒ゆ柇鏄惁瑁瑰寘
+ strMessage = "-1:瑁瑰寘瀛楁鍙兘褰曞叆鈥滄槸鈥濇垨鈥滃惁鈥�;";
+ continue;
+ }
+ }
if (model.Type != "7")
{
if (!TypeLot.Contains(model.Type))
@@ -399,6 +410,20 @@
if (model.Type == "0")//鎴愬搧鍏ュ簱鍗曚笅鍙慦CS淇℃伅
{
+ //璁$畻鍑烘�荤鏁�
+ var packmodel = Db.Queryable<SysPackag>().First(w=>w.PackagNo == detailModel.SkuNo);
+ int xqty = 0;
+ if (packmodel.L1Name == "绠�") {
+ xqty = (int)detailModel.Qty;
+ }
+ if (packmodel.L2Name == "绠�")
+ {
+ xqty = (int)(detailModel.Qty / packmodel.L2Num);
+ }
+ if (packmodel.L3Name == "绠�")
+ {
+ xqty = (int)(detailModel.Qty/ packmodel.L2Num / packmodel.L3Num);
+ }
addOder.Add(new ResponseOrderTaskModel()
{
OrderNo = model.ASNNo,
@@ -406,7 +431,7 @@
SkuNo = detailModel.SkuNo,
SkuName = detailModel.SkuName,
BoxType = detailModel.Standard,
- Qty = (int)detailModel.Qty,
+ Qty = xqty,
TaskType = 0
});
}
@@ -439,7 +464,7 @@
{
var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
//缁橶CS涓嬪彂鍏ュ簱鍗曚俊鎭�
- response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍑哄簱鍛戒护", "WCS");
+ response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍏ュ簱鍛戒护", "WCS");
//瑙f瀽杩斿洖鏁版嵁
var wcsModel = JsonConvert.DeserializeObject<WcsModel>(response);
@@ -498,6 +523,7 @@
return strMessage;
}
+
sqlString += $"select * from BllArrivalNotice where ASNNo = '{model.ASNNo}' and isDel = '0';";
var asnInfo = Db.Ado.SqlQuery<BllArrivalNotice>(sqlString).FirstOrDefault();
if (asnInfo.Status != "0")
@@ -550,6 +576,16 @@
{
strMessage = "-1:鎵规鍙蜂笉鍙负绌�;";
continue;
+ }
+ if (!string.IsNullOrEmpty(detailModel.IsBale))
+ {
+ detailModel.IsBale = detailModel.IsBale == "鏄�" ? "1" : "0";
+ if (detailModel.IsBale != "1" && detailModel.IsBale != "0")
+ {
+ //鍒ゆ柇鏄惁瑁瑰寘
+ strMessage = "-1:瑁瑰寘瀛楁鍙兘褰曞叆鈥滄槸鈥濇垨鈥滃惁鈥�;";
+ continue;
+ }
}
if (model.Type == "2") // 2锛氫腑闂村搧鍏ュ簱
@@ -987,21 +1023,22 @@
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
- public HttpReturnModel HttpCreateAsn(AsnInfo model)
+ public HttpReturnModel HttpCreateAsn(AsnInfo model, string url)
{
try
{
+ var addOder = new List<ResponseOrderTaskModel>();
var resultModel = new HttpReturnModel() { Success = "-1", Message = "" };
if (string.IsNullOrEmpty(model.AsnType))
{
resultModel.Message = "鍗曟嵁绫诲瀷涓嶅彲涓虹┖!";
return resultModel;
}
- if (string.IsNullOrEmpty(model.Customer))
- {
- resultModel.Message = "瀹㈡埛涓嶅彲涓虹┖!";
- return resultModel;
- }
+ //if (string.IsNullOrEmpty(model.Customer))
+ //{
+ // resultModel.Message = "瀹㈡埛涓嶅彲涓虹┖!";
+ // return resultModel;
+ //}
if (string.IsNullOrEmpty(model.OrderCode))
{
resultModel.Message = "涓婃父绯荤粺鍗曞彿涓嶅彲涓虹┖!";
@@ -1014,11 +1051,14 @@
}
// 鏍规嵁瀹㈡埛缂栧彿鑾峰彇瀹㈡埛鍚嶇О
+ var custname = "";
var CustomerModel = Db.Queryable<SysCustomer>().First(it => it.CustomerNo == model.Customer && it.IsDel == "0");
- if (CustomerModel == null)
+ if (CustomerModel != null)
{
- resultModel.Message = "瀹㈡埛缂栧彿涓嶅瓨鍦�!";
- return resultModel;
+ custname = CustomerModel.CustomerName;
+ //CustomerModel.CustomerName = "";
+ //resultModel.Message = "瀹㈡埛缂栧彿涓嶅瓨鍦�!";
+ //return resultModel;
}
// 鍏ュ簱鎬昏〃淇℃伅
@@ -1029,7 +1069,7 @@
Type = model.AsnType,
Origin = string.IsNullOrEmpty(model.Origin) ? "ERP" : model.Origin,
CustomerNo = model.Customer,
- CustomerName = CustomerModel.CustomerName,
+ CustomerName = custname,
OrderCode = model.OrderCode,
};
@@ -1080,7 +1120,37 @@
};
detailModels.Add(detailModel);
+
+ if (model.AsnType == "0")//鎴愬搧鍏ュ簱鍗曚笅鍙慦CS淇℃伅
+ {
+ //璁$畻鍑烘�荤鏁�
+ var packmodel = Db.Queryable<SysPackag>().First(w => w.PackagNo == detailModel.SkuNo);
+ int xqty = 0;
+ if (packmodel.L1Name == "绠�")
+ {
+ xqty = (int)detailModel.Qty;
+ }
+ if (packmodel.L2Name == "绠�")
+ {
+ xqty = (int)(detailModel.Qty / packmodel.L2Num);
+ }
+ if (packmodel.L3Name == "绠�")
+ {
+ xqty = (int)(detailModel.Qty / packmodel.L2Num / packmodel.L3Num);
+ }
+ addOder.Add(new ResponseOrderTaskModel()
+ {
+ OrderNo = asnNo,
+ LotNo = asnDetailModel.LotNo,
+ SkuNo = asnDetailModel.SkuNo,
+ SkuName = skuModel.SkuName,
+ BoxType = skuModel.Standard,
+ Qty = (int)asnDetailModel.Qty,
+ TaskType = 0
+ });
+ }
}
+
Db.BeginTran();
// 鎻掑叆鍏ュ簱鍗曟�昏〃
@@ -1089,6 +1159,36 @@
// 鎻掑叆鍏ュ簱鍗曟槑缁嗚〃
Db.Insertable(detailModels).ExecuteCommand();
Db.CommitTran();
+
+
+ if (addOder.Count > 0)
+ {
+ // 姝e紡杩愯绋嬪簭鏀惧紑
+ var jsonData = JsonConvert.SerializeObject(addOder);
+ string response = "";
+
+ try
+ {
+ var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+ //缁橶CS涓嬪彂鍏ュ簱鍗曚俊鎭�
+ response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍏ュ簱鍛戒护", "WCS");
+
+ //瑙f瀽杩斿洖鏁版嵁
+ var wcsModel = JsonConvert.DeserializeObject<WcsModel>(response);
+ if (wcsModel.StatusCode == 0)
+ {
+
+ }
+ if (wcsModel.StatusCode == -1)
+ {
+ throw new Exception($"涓嬪彂WCS澶辫触锛歿wcsModel.Msg}");
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ }
resultModel.Success = "0";
resultModel.Message = "鎴愬姛";
@@ -1177,7 +1277,8 @@
if (mesList.Contains(notice.Type)) // mes
{
//鑾峰彇浠ょ墝
- var token = new Token().GetMesToken(mesTokenUrl);
+ //var token = new Token().GetMesToken(mesTokenUrl); //娴嬭瘯涓嶄娇鐢═OKEN锛屾寮忚繍琛屾椂鏀惧紑
+ var token = "";
Dictionary<string, string> mesDic = new Dictionary<string, string>()
{
{"Authorization",token }
@@ -1192,7 +1293,7 @@
var response = HttpHelper.DoPost(mesUrl, jsonData, "鍏ュ簱鍗曞畬鎴愪笂浼�", "MES", mesDic);
var obj = JsonConvert.DeserializeObject<MesModel>(response);//瑙f瀽杩斿洖鏁版嵁
- if (obj.status != "0")
+ if (obj.status != "success")
{
throw new Exception("涓婁紶澶辫触" + obj.message);
}
--
Gitblit v1.8.0