From 1293aeec722e06dc11b657455941abbc1c274090 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期日, 16 二月 2025 11:23:46 +0800
Subject: [PATCH] 修改与小车接口
---
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 579 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 508 insertions(+), 71 deletions(-)
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index a64eb06..b38fcf2 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -22,12 +22,98 @@
using Utility.Tools;
using System.Reflection;
using System.IO;
+using System.Security.Cryptography.X509Certificates;
+using System.Net.WebSockets;
+using WMS.BLL.SysServer;
namespace WMS.BLL.BllPdaServer
{
public class PdaAsnServer : IPdaAsnServer
{
private static readonly SqlSugarScope Db = DataContext.Db;
+
+ #region 淇敼鎵樼洏缁戝畾鏃跺叆搴撳崟鍘婚櫎鍙樹负鐗╂枡+鏁伴噺
+
+ /// <summary>
+ /// 鑾峰彇鍗曟嵁鏄庣粏鏄剧ず鐨勭墿鏂�
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ public List<ArrivalNoticeDetailDto> GetArrivalNoticesInfo(ArrivalNoticeVm model)
+ {
+ try
+ {
+ //model.Type锛氬崟鎹被鍨� 鍦ㄨ繖閲屼唬琛ㄥ墠绔〉绛剧被鍨嬶細鍗虫爣绛鹃〉绛撅細璐存爣鐗╂枡锛� 鏁伴噺椤电锛氫笉璐磋〃鐗╂枡锛屽師鍥狅細鎳掑緱鍔犲弬鏁�
+ var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status != "3" && m.Status != "4").Select(m => m.ASNNo).ToList();
+ var list = new List<ArrivalNoticeDetailDto>();
+ if (model.Type.Contains("0"))//0璐存爣
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && !string.IsNullOrWhiteSpace(m.PackagNo)).Select(m => new ArrivalNoticeDetailDto()).ToList();
+ }
+ else if (model.Type.Contains("1"))//1涓嶈创鏍�
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && string.IsNullOrWhiteSpace(m.PackagNo)).Select(m=>new ArrivalNoticeDetailDto()).ToList();
+ }
+ else
+ {
+ throw new Exception("椤电绫诲瀷鍙傛暟閿欒");
+ }
+
+ List<ArrivalNoticeDetailDto> noticeList = new List<ArrivalNoticeDetailDto>();
+ foreach (var item in list)
+ {
+ if (string.IsNullOrEmpty(item.LotNo))
+ {
+ noticeList.Add(item);
+ }
+ else
+ {
+ string[] LotNoList = item.LotNo.Split(';');
+ foreach (var item2 in LotNoList)
+ {
+ ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto()
+ {
+ Id = item.Id,
+ ASNNo = item.ASNNo,
+ CompleteQty = item.CompleteQty,
+ CompleteTime = item.CompleteTime,
+ CreateTime = item.CreateTime,
+ Qty = item.Qty,
+ FactQty = item.FactQty,
+ LotNo = item2,
+ Money = item.Money,
+ PackagNo = item.PackagNo,
+ PackagName = item.PackagName,
+ Status = item.Status,
+ SkuNo = item.SkuNo,
+ SkuName = item.SkuName,
+ };
+
+
+ noticeList.Add(entry);
+ }
+ }
+ }
+ //List<ArrivalNoticeDetailDto> list = new List<ArrivalNoticeDetailDto>();
+ //foreach (var item in noticeList)
+ //{
+ // string str = BySkuNoGetPackInfo(item.SkuNo);
+ // if (str == "瀛樺湪")
+ // {
+ // list.Add(item);
+ // }
+ //}
+
+ return noticeList;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+
+ #endregion
// 鑾峰彇鍗曟嵁鍒楄〃
public List<string> GetArrivalNotices(ArrivalNoticeVm model)
@@ -42,11 +128,11 @@
//model.Type锛氬崟鎹被鍨� 鍦ㄨ繖閲屼唬琛ㄥ墠绔〉绛剧被鍨嬶細鍗虫爣绛鹃〉绛撅細璐存爣鐗╂枡锛� 鏁伴噺椤电锛氫笉璐磋〃鐗╂枡锛屽師鍥狅細鎳掑緱鍔犲弬鏁�
var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status != "3" && m.Status != "4").Select(m=>m.ASNNo).ToList();
var list = new List<string>();
- if (model.Type == "0")//0璐存爣
+ if (model.Type.Contains("0"))//0璐存爣
{
list = Db.Queryable<BllArrivalNoticeDetail>().Where(m =>m.IsDel == "0" && data.Contains(m.ASNNo) && !string.IsNullOrWhiteSpace(m.PackagNo)).Select(m => m.ASNNo).Distinct().ToList();
}
- else if(model.Type == "1")//1涓嶈创鏍�
+ else if(model.Type.Contains("1"))//1涓嶈创鏍�
{
list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && string.IsNullOrWhiteSpace(m.PackagNo)).Select(m=>m.ASNNo).Distinct().ToList();
}
@@ -124,6 +210,8 @@
if (modelList.Count > 0)
{
+ var notice = Db.Queryable<BllArrivalNotice>().First(m=>m.IsDel == "0" && m.ASNNo == modelList[0].ASNNo);
+ modelList[0].UDF5 = notice.Demo;
return modelList[0];
}
@@ -246,6 +334,7 @@
public string BindNullPallet(PalletBindVm model)
{
string strMsg = "";
+ string type = model.BindType == "0" ? "PDA" : "鍙犳墭鏈�";
try
{
var datetime = Db.GetDate();
@@ -353,7 +442,7 @@
LotText = "",
SupplierLot = "",
InspectStatus = "1",
- Origin = "PDA",
+ Origin = type,
BoxNo = "",
BoxNo2 = "",
BoxNo3 = "",
@@ -374,6 +463,120 @@
// 鎻掑叆鎿嶄綔鏃ュ織
new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "绌烘墭鍏ュ簱", model.PalletNo, "娣诲姞", $"鍦≒DA涓婃坊鍔犱簡绌烘墭鐩樿泛", (int)model.CreateUser);
+
+ return strMsg;
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ throw ex;
+ }
+ }
+
+ // 鍙犳墭鏈虹粦瀹氱┖鎵樼洏
+ public string BindNullPallets(PalletsBind model)
+ {
+ string strMsg = "";
+ string type = model.BindType == "0" ? "PDA" : "鍙犳墭鏈�";
+ try
+ {
+ var datetime = Db.GetDate();
+
+ //鑾峰彇鎵樼洏缁戝畾淇℃伅
+ string str = "select * from BllPalletBind where IsDel = '0' and PalletNo = @palletno and Status = '0' ";
+ List<PalletBindVm> list = Db.Ado.SqlQuery<PalletBindVm>(str, new
+ {
+ palletno = model.PalletNo //鎵樼洏鍙�
+ });
+ //鍒ゆ柇鏄惁宸茬粦瀹氳鎵樼洏
+ if (list.Count > 0)
+ {
+ strMsg = "-1:璇ユ墭鐩樺凡琚粦瀹�!";
+ return strMsg;
+ }
+ if (string.IsNullOrEmpty(model.PalletNo))
+ {
+ strMsg = "-1:鎵樼洏鍙蜂笉鍙负绌�!";
+ return strMsg;
+ }
+ if (model.Qty == null || model.Qty == 0)
+ {
+ strMsg = "-1:绌烘墭鐩樻暟閲忎笉鍙负绌�!";
+ return strMsg;
+ }
+ //鑾峰彇鎵樼洏淇℃伅
+ var pallet = Db.Queryable<SysPallets>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo);
+
+ if (pallet == null)
+ {
+ strMsg = "-1:鎵樼洏淇℃伅涓虹┖!";
+ return strMsg;
+ }
+ if (pallet.Status != "0")
+ {
+ strMsg = "-1:璇ユ墭鐩樻鍦ㄤ娇鐢�!";
+ return strMsg;
+ }
+
+ Db.BeginTran();
+
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ var modelpb = new BllPalletBind
+ {
+ ASNNo = "",
+ ASNDetailNo = 0,
+ TaskNo = "", //浠诲姟鍙�
+ PalletNo = model.PalletNo,
+ Qty = (int)model.Qty,
+ Status = "0", //绛夊緟鎵ц
+ Type = "1", //0 鐗╂枡鎵� 1 绌烘墭
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ InspectMark = "0", //0 鍚� 1 鏄�
+ BitPalletMark = "0",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateTime = Db.GetDate()
+ };
+ var id = Db.Insertable(modelpb).ExecuteReturnIdentity();
+
+ var modelbb = new BllBoxInfo
+ {
+ ASNNo = "",
+ ASNDetailNo = null,
+ BindNo = id,
+ PalletNo = model.PalletNo,
+ Status = "1",
+ CompleteTime = DateTime.Now,
+ Qty = (int)model.Qty,
+ FullQty = null,
+ SkuNo = "100099",
+ SkuName = "鎵樼洏",
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ InspectStatus = "1",
+ Origin = type,
+ BoxNo = "",
+ BoxNo2 = "",
+ BoxNo3 = "",
+ InspectMark = "",
+ BitBoxMark = "0",
+
+ CreateTime = datetime
+ };
+ Db.Insertable(modelbb).ExecuteCommand();
+
+
+ // 鏇存敼鎵樼洏浣跨敤鐘舵��
+ string sqlStr = string.Empty;
+ sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
+ Db.Ado.ExecuteCommand(sqlStr);
+ Db.CommitTran();
+
+ // 鎻掑叆鎿嶄綔鏃ュ織
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "绌烘墭鍏ュ簱", model.PalletNo, "娣诲姞", $"鍦≒DA涓婃坊鍔犱簡绌烘墭鐩樿泛", 1);
return strMsg;
}
@@ -1559,8 +1762,8 @@
SupplierLot = "",
InspectMark = "0",
BitPalletMark = "1",
- IsBale = "0",
- IsBelt = "0",
+ IsBale = arrivalnotice.IsBale,
+ IsBelt = arrivalnotice.IsBelt,
CreateUser = userId
};
// 鎻掑叆鎵樼洏缁戝畾琛�
@@ -1633,8 +1836,8 @@
BitPalletMark = "1",
InspectStatus = sku.IsInspect,// 缁勭洏鐨勬椂鍊欏氨瑕侀粯璁よ瀹氬ソ鏄惁鍚堟牸
PackagNo = sku.PackagNo,
- IsBale = null,
- IsBelt = null,
+ IsBale = arrivalnotice.IsBale,
+ IsBelt = arrivalnotice.IsBelt,
CreateUser = userId,
CreateTime = serverTime
};
@@ -1707,7 +1910,7 @@
#region 浜у搧缁勬墭
- public void GetBoxInfoByFuMa(string boxNo,string url)
+ public void GetBoxInfoByFuMa(string boxNo,string url,string fuMaTokenUrl,string levelType)
{
try
{
@@ -1778,23 +1981,86 @@
#endregion
#region 姝e紡鐗堟湰
+ var token = new Token().GetFuMaToken(fuMaTokenUrl);
+ var getParentVal = levelType == "1" ? "true" : "false";
+ var getChildrenVal = levelType == "3" ? "true" : "false";
+ Dictionary<string, string> paramDic = new Dictionary<string, string>
+ {
+ { "Token", token }, //鍒嗛厤鐨勪护鐗岋紙鍙橀噺锛�
+ { "Barcode", boxNo },//瑕佹煡璇㈢殑鏉$爜
+ { "getParent", getParentVal },//鏄惁鏌ヨ鐖剁爜
+ { "getChildren", getChildrenVal } //鏄惁鏌ヨ瀛愮爜
+ };
+ //绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
+ var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+ var response = HttpHelper.DoGet(url, "璧嬬爜", "鑾峰彇绠辩爜淇℃伅", paramDic);
+ var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
- ////绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
- //var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
- //var response = HttpHelper.DoPost(url, jsonData, "鑾峰彇绠辩爜淇℃伅", "璧嬬爜");
- //var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+ //瑙f瀽杩斿洖鏁版嵁
+ var fuMaModel = JsonConvert.DeserializeObject<FuMaGetBoxModel>(response);
+ if (fuMaModel.IsSuccess)
+ {
+ //璧嬬爜杩斿洖淇℃伅鎴愬姛鐘舵��
+ if (fuMaModel.Product == null || fuMaModel.Barcodes.Count == 0)
+ {
+ throw new Exception("浜у搧淇℃伅鎴栫鏀俊鎭负绌�");
+ }
- ////瑙f瀽杩斿洖鏁版嵁
- //var fuMaModel = JsonConvert.DeserializeObject<FuMaModel>(response);
- //if (fuMaModel.Success == 0)
- //{
+ foreach (var item in fuMaModel.Barcodes)
+ {
+ if (item.Barcode != boxNo)
+ {
+ throw new Exception("鑾峰彇淇℃伅涓嶄竴鑷�");
+ }
- //}
- //if (fuMaModel.Success == -1)
- //{
- // throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
- //}
+ var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == fuMaModel.Product.ProductCode);
+ if (sku == null)
+ {
+ throw new Exception("鏈煡璇㈠埌绠辩爜涓殑鐗╂枡淇℃伅");
+ }
+ var boxInfo = new BllBoxInfo()
+ {
+ ASNNo = "",
+ //ASNDetailNo = 0,
+ OrderCode = "",
+ //BindNo = 0,
+ BoxNo = item.Barcode,
+ BoxNo2 = item.Barcode,
+ BoxNo3 = item.Barcode,
+ PalletNo = "",
+ Qty = item.BoxItemQty,
+ FullQty = fuMaModel.BoxItemQty,
+ Status = "0",
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ LotNo = item.BatchNo,
+ //LotText = "",
+ //SupplierLot = item.SupplierLot,
+ ProductionTime = DateTime.Parse(item.ProductionDate),
+ ExpirationTime = DateTime.Parse(item.ExpirationDate),
+ //CompleteTime = comTime,
+ InspectMark = "0",
+ BitBoxMark = item.Status == "闆剁"? "1":"0",
+ InspectStatus = "0",
+ Origin = "璧嬬爜",
+ Standard = fuMaModel.Product.Spec,
+ PackageStandard = fuMaModel.Product.PackageSpec,
+ //StoreTime = item.StoreTime,
+ //QtyOrd = item.QtyOrd,
+ //QtyCount = item.QtyCount,
+ CreateUser = 0,
+ CreateTime = comTime,
+ };
+ list.Add(boxInfo);
+ }
+ Db.Insertable(list).ExecuteCommand();
+ }
+ else
+ {
+ //璧嬬爜杩斿洖淇℃伅澶辫触鐘舵��
+ throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
+ }
#endregion
}
@@ -1809,7 +2075,7 @@
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
- public List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model)
+ public List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model, string url, string fuMaTokenUrl)
{
try
{
@@ -1819,16 +2085,22 @@
}
if (!string.IsNullOrWhiteSpace(model.ASNNo))
{
- var asnData = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo);
- if (asnData != null && (asnData.Type == "0" || asnData.Type == "3"))
+ var detailId = model.ASNNo.Split("-")[0];
+ var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m=>m.IsDel =="0" && m.Id == int.Parse(detailId));
+ if (detail != null)
{
- var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
- if (count == 0)
+ var asnData = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo);
+ if (asnData != null && (asnData.Type == "0" || asnData.Type == "3"))
{
- GetBoxInfoByFuMa(model.BoxNo, ""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
+ if (count == 0)
+ {
+ GetBoxInfoByFuMa(model.BoxNo, url, fuMaTokenUrl,"1"); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ }
}
}
+
}
string sqlString = $@"SELECT
ASNNo,
@@ -1854,6 +2126,111 @@
throw ex;
}
}
+
+ /// <summary>
+ /// 鏍规嵁绠辩爜鑾峰彇鏍囩鏈�灏忚拷婧爜淇℃伅
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ public List<BoxInfoDto> GetBindBoxInfo2s(BoxInfoVm model, string url, string fuMaTokenUrl)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(model.BoxNo3))
+ {
+ throw new Exception("璇锋壂鎻忔渶灏忚拷婧潯鐮�!");
+ }
+ if (!string.IsNullOrWhiteSpace(model.ASNNo))
+ {
+ var detailId = model.ASNNo.Split("-")[0];
+ var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == int.Parse(detailId));
+ if (detail != null)
+ {
+ var asnData = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo);
+ if (asnData != null)
+ {
+ if (asnData.Type != "3")
+ {
+ throw new Exception("鍗曟嵁璇烽�夋嫨閫�璐у叆搴撳崟!");
+ }
+ var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo3 == model.BoxNo3);
+ if (count == 0)
+ {
+ //浼樺厛WMS鏌ユ壘
+
+ var comDetail = Db.Queryable<BllBoxInfo>().First(m=>m.BoxNo3 == model.BoxNo3 && m.IsDel =="0" && m.Status =="2");
+ if (comDetail!= null)
+ {
+ var boxInfo = new BllBoxInfo()
+ {
+ ASNNo = "",
+ //ASNDetailNo = 0,
+ OrderCode = "",
+ //BindNo = 0,
+ BoxNo = comDetail.BoxNo,
+ BoxNo2 = comDetail.BoxNo2,
+ BoxNo3 = comDetail.BoxNo3,
+ PalletNo = "",
+ Qty = comDetail.Qty,
+ FullQty = comDetail.FullQty,
+ Status = "0",
+ SkuNo = comDetail.SkuNo,
+ SkuName = comDetail.SkuName,
+ LotNo = comDetail.LotNo,
+ LotText = comDetail.LotText,
+ SupplierLot = comDetail.SupplierLot,
+ ProductionTime = comDetail.ProductionTime,
+ ExpirationTime = comDetail.ExpirationTime,
+ //CompleteTime = comTime,
+ InspectMark = comDetail.InspectMark,
+ BitBoxMark = "1",
+ InspectStatus = comDetail.InspectStatus,
+ Origin = "璧嬬爜",
+ Standard = comDetail.Standard,
+ PackageStandard = comDetail.PackageStandard,
+ StoreTime = comDetail.StoreTime,
+ QtyOrd = comDetail.QtyOrd,
+ QtyCount = comDetail.QtyCount,
+ CreateUser = 0,
+ CreateTime = DateTime.Now,
+ };
+ Db.Insertable(boxInfo).ExecuteCommand();
+ }
+ else
+ {
+ GetBoxInfoByFuMa(model.BoxNo3, url, fuMaTokenUrl,"3"); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ }
+ }
+ }
+ }
+
+
+ }
+ string sqlString = $@"SELECT
+ ASNNo,
+ BoxNo,
+ SkuNo,
+ SkuName,
+ LotNo,
+ SUM(Qty) as Qty
+ FROM BllBoxInfo
+ WHERE IsDel = '0'
+ AND Status='0'
+ AND BoxNo3 = '{model.BoxNo3}'
+ GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo; ";
+ var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString);
+ if (models.Count == 0)
+ {
+ throw new Exception("鏈�灏忚拷婧爜淇℃伅涓嶅瓨鍦�!");
+ }
+ return models;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
// 鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
public List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
{
@@ -1955,18 +2332,27 @@
if (string.IsNullOrEmpty(model.AsnNo))
{
- throw new Exception("-1:鍗曟嵁鍙蜂笉鍙负绌�!");
+ throw new Exception("-1:鐗╂枡鏄庣粏涓嶅彲涓虹┖!");
}
- if (model.AsnDetailId == null || model.AsnDetailId == 0)
- {
- throw new Exception("-1:鐗╂枡涓嶅彲涓虹┖!");
- }
+ //if (model.AsnDetailId == null || model.AsnDetailId == 0)
+ //{
+ // throw new Exception("-1:鐗╂枡鏄庣粏涓嶅彲涓虹┖!");
+ //}
if (string.IsNullOrEmpty(model.PalletNo))
{
throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!");
}
+ var detailId = model.AsnNo.Split("-");
+ model.AsnDetailId = int.Parse(detailId[0]);
+ // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
+ var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId);
+ if (detail == null)
+ {
+ throw new Exception("-1:褰撳墠鐗╂枡鏈煡璇㈠埌鍗曟嵁锛岃鏍稿疄!");
+ }
+ model.AsnNo = detail.ASNNo;
//鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
- var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
+ var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo);
if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
{
throw new Exception("-1:璇ュ崟鎹凡鍏冲崟!");
@@ -1983,10 +2369,11 @@
else
{
//浠庣墿鏂欏悕绉�-鎵规涓彇鍑烘壒娆�
- int indexOfDash = model.LotNo.IndexOf("-");
- if (indexOfDash != -1)
+ var indexOfDash = model.LotNo.Split("-");
+ var len = indexOfDash.Length;
+ if (len == 3)
{
- model.LotNo = model.LotNo.Substring(indexOfDash + 1);
+ model.LotNo =indexOfDash[len-1];
}
else
{
@@ -1996,19 +2383,35 @@
//鍒ゆ柇鐗╂枡鏁伴噺鏄惁涓�0 涓�0鍒ゆ柇绠辩爜淇℃伅 涓嶄负0缁х画
if (model.TableType == 0)
{
- if (string.IsNullOrEmpty(model.BoxNo))
+ if (notice.Type != "3")
{
- throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!");
- }
-
- if (model.IsContinue == "1")
- {
- if (string.IsNullOrWhiteSpace(model.TailBoxNo))
+ if (string.IsNullOrEmpty(model.BoxNo))
{
- throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!");
+ throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!");
}
+ if (model.IsContinue == "1")
+ {
+ if (string.IsNullOrWhiteSpace(model.TailBoxNo))
+ {
+ throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!");
+ }
+ }
}
+ else
+ {
+ if (string.IsNullOrEmpty(model.BoxNo01))
+ {
+ throw new Exception("-1:杩芥函鐮佷俊鎭笉鍙负绌�!");
+ }
+ if (model.IsContinue == "1")
+ {
+ throw new Exception("-1:杩芥函鐮佷笉鍙繛缁粍鎵橈紒");
+ }
+ }
+
+
+
}
int isTextTable = model.TableType;
int isDeposit = 0;
@@ -2073,12 +2476,7 @@
{
throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁淇℃伅锛岃鏍稿疄锛�");
}
- // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
- var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
- if (detail == null)
- {
- throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
- }
+
#region 鍖呰
var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0");
var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
@@ -2145,6 +2543,21 @@
var bindId = 0;
if (bind == null)
{
+
+ DateTime proTime;
+ DateTime expTime;
+ var bl1 = DateTime.TryParse(detail.Lot1, out proTime);
+ var bl2 = DateTime.TryParse(detail.Lot2, out expTime);
+
+ if (!bl1 && !string.IsNullOrWhiteSpace(detail.Lot1))
+ {
+ throw new Exception("鐢熶骇鏃ユ湡杞崲澶辫触");
+ }
+
+ if (!bl2 && !string.IsNullOrWhiteSpace(detail.Lot2))
+ {
+ throw new Exception("鏈夋晥鏈熻浆鎹㈠け璐�");
+ }
bind = new BllPalletBind
{
ASNNo = model.AsnNo,
@@ -2161,12 +2574,21 @@
SupplierLot = detail.SupplierLot,
InspectMark = "0",
BitPalletMark = "1",
- IsBale = "0",
- IsBelt = "0",
+ IsBale = detail.IsBale,
+ IsBelt = detail.IsBelt,
CreateUser = userId,
Demo = model.Demo,
};
+
+ if (bl1)
+ {
+ bind.ProductionTime = proTime;
+ }
+ if (bl2)
+ {
+ bind.ExpirationTime = expTime;
+ }
//if (model.TableType == 0 && isDeposit == 0 && isTextTable == 0) 涓嶅お鐞嗚В杩欐浠g爜鐨勫惈涔�
//{
// throw new Exception($"缁戝畾澶辫触锛寋model.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
@@ -2189,27 +2611,40 @@
var boxInfoList = new List<BllBoxInfo>();
if (model.SkuQty == 0)
{
- //棣栫
- var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo && m.Status == "0").ToList();
- if (boxInfo.Count == 0)
+ if (notice.Type == "3")
{
- throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!");
- }
- boxInfoList.AddRange(boxInfo);
- //鏄惁杩炵画缁勬墭
- if (model.IsContinue == "1")
- {
- //灏剧
- var boxInfo2 = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo && m.Status == "0").ToList();
- if (boxInfo2.Count == 0)
+ //棣栫
+ var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo3 == model.BoxNo01 && m.Status == "0").ToList();
+ if (boxInfo.Count == 0)
{
- throw new Exception("-1:灏剧鐮佷俊鎭笉瀛樺湪!");
+ throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!");
}
- boxInfoList.AddRange(boxInfo2);
- var sql = $"select * from BllBoxInfo where IsDel = '0' and Status = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}'; ";
- var list = Db.Ado.SqlQuery<BllBoxInfo>(sql);
- boxInfoList.AddRange(list);
- msgStr += $"灏剧鍙蜂负{model.TailBoxNo}";
+ boxInfoList.AddRange(boxInfo);
+ }
+ else
+ {
+ //棣栫
+ var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo && m.Status == "0").ToList();
+ if (boxInfo.Count == 0)
+ {
+ throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!");
+ }
+ boxInfoList.AddRange(boxInfo);
+ //鏄惁杩炵画缁勬墭
+ if (model.IsContinue == "1")
+ {
+ //灏剧
+ var boxInfo2 = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo && m.Status == "0").ToList();
+ if (boxInfo2.Count == 0)
+ {
+ throw new Exception("-1:灏剧鐮佷俊鎭笉瀛樺湪!");
+ }
+ boxInfoList.AddRange(boxInfo2);
+ var sql = $"select * from BllBoxInfo where IsDel = '0' and Status = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}'; ";
+ var list = Db.Ado.SqlQuery<BllBoxInfo>(sql);
+ boxInfoList.AddRange(list);
+ msgStr += $"灏剧鍙蜂负{model.TailBoxNo}";
+ }
}
}
#endregion
@@ -2650,11 +3085,13 @@
SkuName = item.SkuName,
Standard = sku.Standard,
ProductionTime = item.ProductionTime,
+ ExpirationTime = item.ExpirationTime,
SupplierLot = item.SupplierLot,
InspectMark = item.InspectMark,
BitBoxMark = item.BitBoxMark,
InspectStatus = item.InspectStatus,
- //InspectTime = item.,
+ UDF1 = item.StoreTime == null? "":((DateTime)item.StoreTime).ToString("yyyy-MM-dd"),
+ //InspectTime = item.StoreTime,
IsDel = "0",
CreateUser = 0,
--
Gitblit v1.8.0