|
@@ -8,12 +8,14 @@ using UFIDA.U9.CBO.SCM.Warehouse;
|
|
|
using UFSoft.UBF.Business;
|
|
|
using UFSoft.UBF.PL;
|
|
|
using UFSoft.UBF.PL.Engine.Cache;
|
|
|
+using UFSoft.UBF.Services.Session;
|
|
|
+using UFSoft.UBF.Util.Log;
|
|
|
|
|
|
namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
{
|
|
|
public partial class CreateDocByQuickTransInPlug : UFSoft.UBF.Service.BPSVExtendBase
|
|
|
{
|
|
|
- private Dictionary<string, BinWhMsg> dictionary;
|
|
|
+ //private Dictionary<string, BinWhMsg> dictionary;
|
|
|
|
|
|
public override void AfterDo(object bp, ref object result)
|
|
|
{
|
|
@@ -26,7 +28,6 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
UFIDA.U9.BC.QuickTransIn.CreateDocByQuickTransIn strongBP = bp as UFIDA.U9.BC.QuickTransIn.CreateDocByQuickTransIn;
|
|
|
if (strongBP == null)
|
|
|
return;
|
|
|
-
|
|
|
foreach (var createDocParamDTOData in strongBP.ParamInList)
|
|
|
{
|
|
|
if (createDocParamDTOData.TransferInType == 0)//一步式,直接生成调入单,插入库位
|
|
@@ -52,19 +53,43 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
PLCacheManager.ObjectCache.FlushCache();
|
|
|
using (ISession session = Session.Open())
|
|
|
{
|
|
|
+ ILogger logger = LoggerManager.GetLogger("BPSVPlug_CreateDocByQuickTransIn_AfterDo------");
|
|
|
foreach (var rtnDTOData in rtnDTODatas)
|
|
|
{
|
|
|
if (TransferInType == 0)
|
|
|
{
|
|
|
- UFIDA.U9.InvDoc.TransferIn.TransInLine transInLine = UFIDA.U9.InvDoc.TransferIn.TransInLine.Finder.FindByID(rtnDTOData.DocLineID);
|
|
|
- if (transInLine == null || transInLine.TransInWh == null)
|
|
|
+ try
|
|
|
{
|
|
|
- continue;
|
|
|
+ logger.Error(string.Format("------- 1 开始 {0}", rtnDTOData.BarCode));
|
|
|
+ UFIDA.U9.InvDoc.TransferIn.TransInLine transInLine = UFIDA.U9.InvDoc.TransferIn.TransInLine.Finder.FindByID(rtnDTOData.DocLineID);
|
|
|
+ if (transInLine == null || transInLine.TransInWh == null)
|
|
|
+ {
|
|
|
+ logger.Error(string.Format("------- 1a 找不到对应的调入单行 Code:{0},ID:{1}", rtnDTOData.BarCode, rtnDTOData.DocLineID));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((ServiceSession.ThreadStorage["Dic"] as Dictionary<string, BinWhMsg>).ContainsKey(rtnDTOData.BarCode))
|
|
|
+ {
|
|
|
+ logger.Error(string.Format("------- 2 集合包含条码 {0}", rtnDTOData.BarCode));
|
|
|
+
|
|
|
+ BinWhMsg binWhMsg = (ServiceSession.ThreadStorage["Dic"] as Dictionary<string, BinWhMsg>)[rtnDTOData.BarCode];
|
|
|
+ UpdateBarCodeNew.Update(rtnDTOData.DocLineID, "UFIDA.U9.InvDoc.TransferIn.TransInLine", "", binWhMsg.binid, binWhMsg.bincode, binWhMsg.binname, transInLine.TransInWh.ID, transInLine.TransInWh.Code, transInLine.TransInWh.Name);
|
|
|
+ logger.Error(string.Format("------- 3 更新完毕 {0}", rtnDTOData.BarCode));
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ logger.Error(string.Format("------- 1b 当前条码不包含在集合中 {0}", rtnDTOData.BarCode));
|
|
|
+ foreach (var vTmp in ServiceSession.ThreadStorage["Dic"] as Dictionary<string, BinWhMsg>)
|
|
|
+ {
|
|
|
+ logger.Error(string.Format("------- 1bb {0} 当前集合包含条码:{1}", rtnDTOData.BarCode, vTmp.Key));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if (dictionary.ContainsKey(rtnDTOData.BarCode))
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- BinWhMsg binWhMsg = dictionary[rtnDTOData.BarCode];
|
|
|
- UpdateBarCodeNew.Update(rtnDTOData.DocLineID, "UFIDA.U9.InvDoc.TransferIn.TransInLine", "", binWhMsg.binid, binWhMsg.bincode, binWhMsg.binname, transInLine.TransInWh.ID, transInLine.TransInWh.Code, transInLine.TransInWh.Name);
|
|
|
+ logger.Error(string.Format("------- xx 捕获异常 {0},{1}", rtnDTOData.BarCode,ex.Message));
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
else if (TransferInType == 1)
|
|
@@ -81,8 +106,12 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
|
|
|
public override void BeforeDo(object bp)
|
|
|
{
|
|
|
- dictionary = new Dictionary<string, BinWhMsg>();
|
|
|
+ Dictionary<string, BinWhMsg> dictionary = new Dictionary<string, BinWhMsg>();
|
|
|
+
|
|
|
+
|
|
|
BC.QuickTransIn.CreateDocByQuickTransIn bpObj = (BC.QuickTransIn.CreateDocByQuickTransIn)bp;
|
|
|
+ ILogger logger = LoggerManager.GetLogger("BPSVPlug_CreateDocByQuickTransIn_BeforeDo------");
|
|
|
+
|
|
|
foreach (var paramDTO in bpObj.ParamInList)
|
|
|
{
|
|
|
Warehouse outWh = Warehouse.Finder.FindByID(paramDTO.OutWh);
|
|
@@ -92,28 +121,34 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
{
|
|
|
foreach (var barCodeDTO in docDTO.BarCodes)
|
|
|
{
|
|
|
- BarCode barCode = BarCode.Finder.Find("Code=@Code",
|
|
|
- new OqlParam[]
|
|
|
- {
|
|
|
- new OqlParam(barCodeDTO.BarCode)
|
|
|
- });
|
|
|
+ //BarCode barCode = BarCode.Finder.Find("Code=@Code",
|
|
|
+ // new OqlParam[]
|
|
|
+ // {
|
|
|
+ // new OqlParam(barCodeDTO.BarCode)
|
|
|
+ // });
|
|
|
+ BarCode barCode = BarCode.Finder.Find(string.Format("Code='{0}'", barCodeDTO.BarCode));
|
|
|
if (barCode != null)
|
|
|
{
|
|
|
+ logger.Error(string.Format("-------1能找到条码主档 {0}", barCodeDTO.BarCode));
|
|
|
if (barCode["Cust4Whid"] == null)
|
|
|
{
|
|
|
throw new Exception(string.Format("条码{0}当前存储地点为空,不允许进行调拨", barCode.Code));
|
|
|
}
|
|
|
+ logger.Error(string.Format("------- 2 条码主档中有Cust4Whid {0}", barCodeDTO.BarCode));
|
|
|
Warehouse currentWh = Warehouse.Finder.FindByID(barCode["Cust4Whid"]);
|
|
|
if (currentWh == null)
|
|
|
{
|
|
|
throw new Exception(string.Format("条码{0}当前存储地点为空,不允许进行调拨", barCode.Code));
|
|
|
}
|
|
|
+ logger.Error(string.Format("-------3 能找到条码主档存储地点 {0}", barCodeDTO.BarCode));
|
|
|
if (outWh.ID != currentWh.ID)
|
|
|
{
|
|
|
throw new Exception(string.Format("调出存储地点{0}与条码{1}当前存储地点{2}不一致,不允许进行调拨", outWh.Name, barCode.Code, currentWh.Name));
|
|
|
}
|
|
|
if (outWh.IsBin)
|
|
|
{
|
|
|
+ logger.Error(string.Format("-------3a outWh.IsBin {0}", barCodeDTO.BarCode));
|
|
|
+
|
|
|
if (barCode["Cust4Binid"] != null)
|
|
|
{
|
|
|
UFIDA.U9.CBO.SCM.Bin.Bin currentBin = UFIDA.U9.CBO.SCM.Bin.Bin.Finder.FindByID(barCode["Cust4Binid"]);
|
|
@@ -157,6 +192,7 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
if (!dictionary.ContainsKey(barCodeDTO.BarCode))
|
|
|
{
|
|
|
dictionary.Add(barCodeDTO.BarCode, binWhMsg);
|
|
|
+ logger.Error(string.Format("-------4 {0}成功添加集合BINID{1},{2},{3},{4}", barCodeDTO.BarCode, barCodeDTO.TransInBin, binid.ToString(), bincode, binname));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -167,6 +203,10 @@ namespace UFIDA.U9.Cust.KuSi.zhangky.BPSVPlug.CreateDocByQuickTransIn
|
|
|
throw new Exception("调出仓库不能为空");
|
|
|
}
|
|
|
}
|
|
|
+ if (dictionary.Count>0)
|
|
|
+ {
|
|
|
+ ServiceSession.ThreadStorage["Dic"] = dictionary;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class BinWhMsg
|