diff --git a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingListDto.cs b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingListDto.cs
index 2237265..63362f8 100644
--- a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingListDto.cs
+++ b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingListDto.cs
@@ -30,7 +30,7 @@ namespace WY.NewJit.Extends
///
/// 左或右
///
- public string BillLocation { get; set; }
+ public string VehicleModel { get; set; }
///
diff --git a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingRecDto.cs b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingRecDto.cs
index 98deb0b..ba07fbc 100644
--- a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingRecDto.cs
+++ b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/Extends/MenBanReports/MenBanPackingRecDto.cs
@@ -15,6 +15,9 @@ namespace WY.NewJit.Extends
///
public class MenBanPackingRecDto
{
+
+ public Guid M100BillId { get; set; }
+
///
/// 装箱单号(对应主表)
///
@@ -39,49 +42,40 @@ namespace WY.NewJit.Extends
///
/// 车型门板代码 门板代号:是零件关键件,从汇总excel中取
///
- public virtual string VehicleModel_DoorPlankCode { get; set; }
+ public virtual string PartCode1 { get; set; }
- ///
- /// 上箱位号
- ///
- public virtual string TopBoxPositionNum { get; set; }
///
/// 上箱位 SAP物料号
///
- public string TopSAPMaterialNum { get; set; }
+ public string PartCode2 { get; set; }
///
/// 上箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
///
- public string TopMaterialDescription { get; set; }
-
-
-
- ///
- /// 下箱位号
- ///
- //public virtual string BelowBoxPositionNum { get; set; }
+ public string PartCode3 { get; set; }
///
/// 下箱位 SAP物料号
///
- public string BelowSAPMaterialNum { get; set; }
+ public string PartCode4 { get; set; }
///
/// 下箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
///
- public string BelowMaterialDescription { get; set; }
+ public string PartCode5 { get; set; }
///
/// 用于报表排序
///
- public int sn { get; set; }
+ //public int sn { get; set; }
- public Guid M100BillId { get; set; }
+ ///
+ /// 上箱位号
+ ///
+ public virtual string SN { get; set; }
-
}
diff --git a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs
index a4b691f..87b7b74 100644
--- a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs
+++ b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs
@@ -81,21 +81,21 @@ namespace WY.NewJit.MsgCheck
///
///
/// 断号时Item不为空
- Task> CheckZHBHostSNBreakNum(ZhuHuBanPrintInputDto input);
+ //Task> CheckZHBHostSNBreakNum(ZhuHuBanPrintInputDto input);
///
/// 打印门板装箱单
///
///
/// 执行成功返回真
- Task> PrintMenBanPackingList(MenBanPrintInputDto input);
+ //Task> PrintMenBanPackingList(MenBanPrintInputDto input);
///
/// 打印柱护板装箱单
///
///
/// 执行成功返回真
- Task> PrintZhuHuBanPackingList(ZhuHuBanPrintInputDto input);
+ //Task> PrintZhuHuBanPackingList(ZhuHuBanPrintInputDto input);
#endregion
@@ -107,7 +107,7 @@ namespace WY.NewJit.MsgCheck
/// 生产线超时情况
Task> ProductLineTimeoutRemind(TimeOutRemindInputDto input);
- Task> GetReplenishPrintListAsync(QueryBillM100Dto input);
+ //Task> GetReplenishPrintListAsync(QueryBillM100Dto input);
diff --git a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
index 096cb7e..c18958b 100644
--- a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
+++ b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
@@ -19,7 +19,7 @@
-
+
左或右
@@ -149,39 +149,34 @@
大众顺序号
-
+
车型门板代码 门板代号:是零件关键件,从汇总excel中取
-
-
- 上箱位号
-
-
-
+
上箱位 SAP物料号
-
+
上箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
-
+
下箱位 SAP物料号
-
+
下箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
-
+
- 用于报表排序
+ 上箱位号
@@ -1929,27 +1924,6 @@
断号时Item不为空
-
-
- 打印前检查柱护板大众顺序号是否断号
-
-
- 断号时Item不为空
-
-
-
- 打印门板装箱单
-
-
- 执行成功返回真
-
-
-
- 打印柱护板装箱单
-
-
- 执行成功返回真
-
生产线超时提醒
diff --git a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
index 6c8d86a..17c828c 100644
--- a/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
+++ b/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
@@ -131,6 +131,8 @@ namespace WY.NewJit.MsgCheck
private readonly IRepository _tbBillHisRepository;
private readonly IRepository _tsSortDetailHisRepository;
+ private readonly IRepository _dicItemRepository;
+
///
/// 错误信息前缀
///
@@ -182,7 +184,8 @@ namespace WY.NewJit.MsgCheck
IRepository tbBillHisRepository,
IRepository tsSortDetailHisRepository,
IRepository printTemplateConfigurationRepository,
- IRepository zHBPrintStatusRepository
+ IRepository zHBPrintStatusRepository,
+ IRepository dicItemRepository
)
@@ -212,6 +215,7 @@ namespace WY.NewJit.MsgCheck
_printTemplateConfigurationRepository = printTemplateConfigurationRepository;
_zHBPrintStatusRepository = zHBPrintStatusRepository;
_topBoxPositionNumPrefix = _configuration["ConfigDic:TopBoxPositionNumPrefix"];
+ _dicItemRepository = dicItemRepository;
}
#endregion
@@ -395,7 +399,11 @@ select * from
}
-
+ ///
+ /// 从M100中取当前产线、已经打印的最大大众顺序号
+ ///
+ ///
+ ///
private async Task GetMenBanLastPrintNum(MenBanPrintInputDto input)
{
string sql = @" select top(1) HostSN from FisBillM100 where ProductLine = '{0}' and BillStatus = 3 order by SerialNumStr desc";
@@ -403,25 +411,26 @@ select * from
var lastNum = await _newJitDapperRepository.GetSingleBySqlAsync(sql);
return lastNum;
}
- private async Task GetZhuHuBanLastPrintNum(ZhuHuBanPrintInputDto input)
- {
- string sql = @" with d as
-(
- select *from [dbo].[FisZHBPrintStatus] where groupName='{0}'
-)
-select top(1) HostSN from
-(
- select d.CreationTime as ptime,
- b.*
- from FisBillM100 b
- join d on b.VIN=d.VIN
- where 1=1 and ProductLine='{1}' and ( b.PrintBillNum is not null or d.BillStatus=1)
-) t order by SerialNumStr desc ";
- sql = string.Format(sql, input.GroupName,input.ProductLine);
- var lastNum = await _newJitDapperRepository.GetSingleBySqlAsync(sql);
- return lastNum;
- }
+// private async Task GetZhuHuBanLastPrintNum(ZhuHuBanPrintInputDto input)
+// {
+// string sql = @" with d as
+//(
+// select *from [dbo].[FisZHBPrintStatus] where groupName='{0}'
+//)
+
+//select top(1) HostSN from
+//(
+// select d.CreationTime as ptime,
+// b.*
+// from FisBillM100 b
+// join d on b.VIN=d.VIN
+// where 1=1 and ProductLine='{1}' and ( b.PrintBillNum is not null or d.BillStatus=1)
+//) t order by SerialNumStr desc ";
+// sql = string.Format(sql, input.GroupName,input.ProductLine);
+// var lastNum = await _newJitDapperRepository.GetSingleBySqlAsync(sql);
+// return lastNum;
+// }
///
/// 根据筛选条件获取实体列表
@@ -601,24 +610,24 @@ select * from
///
///
///
- private List GetErpAssemblyListByBill(Guid vehicleAssemblyId)
- {
- List retLst = new List();
- AssemblyCfgVehicle vobj = _assemblyCfgVehicleRepository.GetAsync(vehicleAssemblyId).GetAwaiter().GetResult(); //取单据对应的整车总成
- if (vobj != null && vobj.AssemblyCfgVehicleChilds != null && vobj.AssemblyCfgVehicleChilds.Count > 0)
- {
- List vehicleChildLst = vobj.AssemblyCfgVehicleChilds;
- foreach (AssemblyCfgVehicleChild vehicleChildItm in vehicleChildLst)
- {
- AssemblyCfgErp erpObj = _assemblyCfgErpRepository.GetAsync(vehicleChildItm.ErpAssemblyId).GetAwaiter().GetResult();
- if (erpObj != null)
- {
- retLst.Add(erpObj);
- }
- }
- }
- return retLst;
- }
+ //private List GetErpAssemblyListByBill(Guid vehicleAssemblyId)
+ //{
+ // List retLst = new List();
+ // AssemblyCfgVehicle vobj = _assemblyCfgVehicleRepository.GetAsync(vehicleAssemblyId).GetAwaiter().GetResult(); //取单据对应的整车总成
+ // if (vobj != null && vobj.AssemblyCfgVehicleChilds != null && vobj.AssemblyCfgVehicleChilds.Count > 0)
+ // {
+ // List vehicleChildLst = vobj.AssemblyCfgVehicleChilds;
+ // foreach (AssemblyCfgVehicleChild vehicleChildItm in vehicleChildLst)
+ // {
+ // AssemblyCfgErp erpObj = _assemblyCfgErpRepository.GetAsync(vehicleChildItm.ErpAssemblyId).GetAwaiter().GetResult();
+ // if (erpObj != null)
+ // {
+ // retLst.Add(erpObj);
+ // }
+ // }
+ // }
+ // return retLst;
+ //}
#endregion
@@ -664,8 +673,9 @@ select * from
if ((input.EndHostSN % 10000) > 1999) //存在大众顺序号1999、0001的情况
{
string firstSNStr = firstObj.SerialNumStr;
- var tempLst = await _billM100Repository.Where(itm =>
- itm.ProductLine == input.ProductLine //指定生产线
+ var tempLst = await _billM100Repository
+ .Include(itm => itm.BillM100Parts)
+ .Where(itm => itm.ProductLine == input.ProductLine //指定生产线
&& itm.CanNotPrint != true //能打印
&& itm.BillStatus != BillStatusEnum.Publish //不等于 已打印
&& itm.SerialNumStr.CompareTo(firstSNStr) >= 0)
@@ -683,8 +693,9 @@ select * from
else //起止大众顺序号都小于等于1999
{
string firstSNStr2 = firstObj.SerialNumStr;
- billLst = await _billM100Repository.Where(itm =>
- itm.ProductLine == input.ProductLine //指定生产线
+ billLst = await _billM100Repository
+ .Include(itm => itm.BillM100Parts)
+ .Where(itm => itm.ProductLine == input.ProductLine //指定生产线
&& itm.CanNotPrint != true //能打印
&& itm.BillStatus != BillStatusEnum.Publish //不等于 已打印
&& itm.SerialNumStr.CompareTo(firstSNStr2) >= 0
@@ -864,186 +875,111 @@ select * from
///
/// 加1后的序号
///
- private string GetBillNum(long newSN)
- {
- string newSNStr = newSN.ToString();
- //装箱单号规则 1开头,11位,自增顺序号
- if (newSNStr.Length < 11)
- {
- return "F" + newSNStr.PadLeft(10, '0');
- }
- return newSNStr;
- }
+ //private string GetBillNum(long newSN)
+ //{
+ // string newSNStr = newSN.ToString();
+ // //装箱单号规则 1开头,11位,自增顺序号
+ // if (newSNStr.Length < 11)
+ // {
+ // return "F" + newSNStr.PadLeft(10, '0');
+ // }
+ // return newSNStr;
+ //}
///
/// 打印左侧或右侧门板
///
///
- ///
+ ///
///
///
///
///
- ///
+ ///
///
- private List DoMBPrint(MenBanPrintInputDto input, int pageIdx, ref double maxBillNum, double maxSN, DateTime printTime, List billLst, string rightOrLeft)
+ private MenBanPackingList DoMBPrint(MenBanPrintInputDto input, int pageIdx, double maxSN, List billLst, string reportSort, string[] partLargeType)
{
const int _colNumberPerPage = 12;
- List retLst = new List();
//取当前页内容
List curPageLst = billLst.Skip(pageIdx * _colNumberPerPage).Take(_colNumberPerPage).ToList();
- //取车型 C8,Q5
- var vmLst = curPageLst.Select(itm => itm.VehicleModelCode).Distinct().ToList();
- string vmStr = "";
- foreach (var item in vmLst)
- {
- vmStr += item + ",";
- }
- if (vmStr.Length >0)
- {
- vmStr = vmStr.Substring(0, vmStr.Length - 1);
- }
-
- //填充门板装箱单主实体
- MenBanPackingList mbObj = new MenBanPackingList();
- mbObj.SetId(GuidGenerator.Create());
-
- long maxBillNum2 = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- mbObj.BillNum = GetBillNum(maxBillNum2);
- mbObj.BillSerialNum = maxSN.ToString().PadLeft(2, '0');
+ var vmLst = curPageLst.Select(itm => itm.VehicleModelCode).Distinct().JoinAsString(","); //取车型
+ string ymd = ServerHelper.CurrentDateTime.ToString("yyyyMMdd");
+ string serialNum = maxSN.ToString().PadLeft(3, '0'); //075
- mbObj.BillLocation = rightOrLeft; //右或左
- mbObj.ProviderCode = _providerCode; //供应商厂家代码
- mbObj.PartType = vmStr + " DP"; //零件类型
- mbObj.Capacity = curPageLst.Count(itm => itm.BillStatus == BillStatusEnum.Match || itm.BillStatus == BillStatusEnum.Publish).ToString(); //器具容量
- mbObj.PrintDate = printTime; //打印日期
- mbObj.PrintType = input.PrintType;
- mbObj.ProductLine = input.ProductLine;
+ MenBanPackingList packingMain = new MenBanPackingList();
+ packingMain.SetId(GuidGenerator.Create());
+ packingMain.BillNum = $"C{ymd}{serialNum}{reportSort}";
+ packingMain.VehicleModel = vmLst;
+ packingMain.BillSerialNum = serialNum;
+ packingMain.PrintDate = ServerHelper.CurrentDateTime;
+ packingMain.ProductLine = billLst[0].ProductLine;
var tempLst = curPageLst.Where(itm => string.IsNullOrEmpty(itm.VIN) == false).OrderBy(itm => itm.OnlineTime).ThenBy(itm => itm.HostSN).ToList();
if (tempLst.Count > 0)
{
- mbObj.BeginVin = tempLst[0].VIN;
- mbObj.EndVin = tempLst[tempLst.Count - 1].VIN;
- mbObj.BeginHostSN = tempLst[0].HostSN.ToString();
- mbObj.EndHostSN = tempLst[tempLst.Count - 1].HostSN.ToString();
+ packingMain.BeginVin = tempLst[0].VIN;
+ packingMain.EndVin = tempLst[tempLst.Count - 1].VIN;
+ packingMain.BeginHostSN = tempLst[0].HostSN.ToString();
+ packingMain.EndHostSN = tempLst[tempLst.Count - 1].HostSN.ToString();
}
- mbObj.MinOnlineTime = tempLst.Min(itm => itm.OnlineTime); //本单据最早的上线时间
-
- int posNum = 0;
- string promMsg; //报表数据异常提示信息
+ packingMain.MinOnlineTime = tempLst.Min(itm => itm.OnlineTime); //本单据最早的上线时间
+ //明细
+ int sn = 1;
foreach (BillM100 billObj in curPageLst)
{
- posNum++;
- promMsg = "";
- //取物料信息
- MaterialExt leftObj = null;
- MaterialExt rightObj = null;
- if (billObj.AssemblyID != null)
- {
- //取单据包含的ERP总成列表
- List erpAssemblyLst = GetErpAssemblyListByBill((Guid)billObj.AssemblyID);
- List erpCodeLst = erpAssemblyLst.Select(itm => itm.ErpAssemblyCode).ToList();
- //根据ERP总成编码取对应的物料扩展信息
- List materialExtLst = _materialExtRepository.Where(itm => erpCodeLst.Contains(itm.RelationKey)).ToList();
- if (erpCodeLst.Count != 4)
- {
- promMsg += $"*总成数量是{erpCodeLst.Count}*";
- }
- if (erpCodeLst.Count == 4 && materialExtLst.Count == 0)
- {
- promMsg += $"*物料表没数据*";
- }
-
- //车型C8的第一二页分为左后, 右前,第三四页分为右后、左前;其它车型 第一二页分为左后、左前,第三四页分为右后、右前
- if (curPageLst[0].VehicleModelCode == "C8")
- {
- //C8 分为左前、右后 一组 右前、左后 一组,以前门为主,前门是右, 单子是右
- if (rightOrLeft == "右")
- {
- rightObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains("右前"));
- leftObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains("左后"));
- }
- else //左
- {
- rightObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains("左前"));
- leftObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains("右后"));
- }
- }
- else
- {
- leftObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains(rightOrLeft + "后"));
- rightObj = materialExtLst.FirstOrDefault(itm => itm.MaterialDescription.Contains(rightOrLeft + "前"));
- }
- }
-
- //填充门板装箱单明细
- MenBanPackingRec mbRec = new MenBanPackingRec();
- mbRec.SetId(GuidGenerator.Create());
- mbRec.M100BillId = billObj.Id;
- mbRec.KNR = billObj.KNR; //KNR订单号
- mbRec.VIN = billObj.VIN; //底牌号
- mbRec.HostSN = billObj.HostSN.ToString(); //大众顺序号
- mbRec.TopBoxPositionNum = GetTopBoxPositionNumPrefix(billObj.KNR) + posNum.ToString().PadLeft(2, '0'); //上箱位号
- if (leftObj != null) //右后
+ MenBanPackingRec packingDetail = new MenBanPackingRec();
+ packingDetail.SetId(GuidGenerator.Create());
+ packingDetail.M100BillId = billObj.Id;
+ packingDetail.KNR = billObj.KNR;
+ packingDetail.VIN = billObj.VIN;
+ packingDetail.HostSN = billObj.HostSN?.ToString();
+ if (billObj.VIN == null)
{
- mbRec.VehicleModel_DoorPlankCode = leftObj.MaterialMemo; //车型门板代码
- mbRec.TopSAPMaterialNum = leftObj.MaterialNum; //上箱位 SAP物料号
- mbRec.TopMaterialDescription = leftObj.MaterialDescription2.IsNullOrEmpty() ? leftObj.MaterialDescription : leftObj.MaterialDescription2; //上箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
+ packingDetail.VIN += "*断号*";
}
- else
+ //第一个零件
+ if (partLargeType.Length >= 1)
{
- if (billObj.VIN == null)
- {
- mbRec.TopMaterialDescription += "*断号*";
- }
- else if (billObj.AssemblyID == null)
- {
- mbRec.TopMaterialDescription += "*未知总成*";
- }
- else
+ var partObj = billObj.BillM100Parts.FirstOrDefault(itm => itm.PartType3 == partLargeType[0]);
+ if (partObj != null)
{
- mbRec.TopMaterialDescription += "*leftObj为空*";
+ packingDetail.PartCode1 = partObj.PartCode;
}
}
-
- if (rightObj != null) //右前
- {
- mbRec.BelowSAPMaterialNum = rightObj.MaterialNum; //下箱位 SAP物料号
- mbRec.BelowMaterialDescription = rightObj.MaterialDescription2.IsNullOrEmpty() ? rightObj.MaterialDescription : rightObj.MaterialDescription2; //下箱位 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
- }
- else
+ //第二个零件
+ if (partLargeType.Length >= 2)
{
- if (billObj.VIN == null)
- {
- mbRec.TopMaterialDescription += "*断号*";
- }
- else if (billObj.AssemblyID == null)
- {
- mbRec.BelowMaterialDescription += "*未知总成*";
- }
- else
+ var partObj = billObj.BillM100Parts.FirstOrDefault(itm => itm.PartType3 == partLargeType[1]);
+ if (partObj != null)
{
- mbRec.BelowMaterialDescription += "*rightObj为空*";
+ packingDetail.PartCode2 = partObj.PartCode;
}
}
-
- if (string.IsNullOrEmpty(mbRec.KNR) == false && mbRec.KNR.Length == 10 && mbRec.KNR.Substring(4, 1) == "7" && string.IsNullOrEmpty(mbRec.VehicleModel_DoorPlankCode) == true)
+ //第三个零件
+ if (partLargeType.Length >= 3)
{
- mbRec.VehicleModel_DoorPlankCode += "*预批量*";
+ var partObj = billObj.BillM100Parts.FirstOrDefault(itm => itm.PartType3 == partLargeType[2]);
+ if (partObj != null)
+ {
+ packingDetail.PartCode3 = partObj.PartCode;
+ }
}
-
- if (!String.IsNullOrEmpty(promMsg))
+ //第四个零件
+ if (partLargeType.Length >= 4)
{
- mbRec.VehicleModel_DoorPlankCode += promMsg;
+ var partObj = billObj.BillM100Parts.FirstOrDefault(itm => itm.PartType3 == partLargeType[3]);
+ if (partObj != null)
+ {
+ packingDetail.PartCode4 = partObj.PartCode;
+ }
}
- mbObj.Details.Add(mbRec);
- } //foreach
-
- retLst.Add(mbObj); //有用
- return retLst;
+ packingDetail.SN = sn.ToString();
+ packingMain.Details.Add(packingDetail);
+ sn++;
+ }
+ return packingMain;
}
///
@@ -1054,305 +990,306 @@ select * from
///
///
///
- private string GetTopBoxPositionNumPrefix(string knr)
- {
- if (knr.IsNullOrEmpty() || knr.Length < 4)
- {
- return "";
- }
- string knrPrefix = knr.Substring(0, 4);
+ //private string GetTopBoxPositionNumPrefix(string knr)
+ //{
+ // if (knr.IsNullOrEmpty() || knr.Length < 4)
+ // {
+ // return "";
+ // }
+ // string knrPrefix = knr.Substring(0, 4);
- int res = string.Compare(knrPrefix, "2402");
- if (res >= 0)
- {
- return "";
- }
- else
- {
- return _topBoxPositionNumPrefix ?? "";
- }
+ // int res = string.Compare(knrPrefix, "2402");
+ // if (res >= 0)
+ // {
+ // return "";
+ // }
+ // else
+ // {
+ // return _topBoxPositionNumPrefix ?? "";
+ // }
- }
+ //}
///
/// 打印门板装箱单时调用库存系统接口
///
///
- private void CallWMSInterface_MB(List input)
- {
+ //private void CallWMSInterface_MB(List input)
+ //{
- List targetMainLst = new List();
- List targetDetailLst = new List();
- List cxLst = new List();
- foreach (MenBanPackingList sourceObj in input)
- {
- TB_BILL targetMain = new TB_BILL();
- targetMain.BillNum = sourceObj.BillNum; //单据编号
- targetMain.State = 0;
- targetMain.BillType = 206; //单据类型
- targetMain.SubBillType = 21004; //单据子类型
- targetMain.BillTime = sourceObj.PrintDate; //单据时间
- targetMain.OperName = sourceObj.CreatorId.ToString(); //操作员
- targetMain.DetailQty = 0; //明细数量
- targetMain.CustId = _providerCode; //供应商编号
- //targetMain.ProjectId = sourceObj.PartType == null ? null : sourceObj.PartType.Replace(" DP", ""); //添加车型
- //targetMain.DockCode = sourceObj.BillLocation;
+ // List targetMainLst = new List();
+ // List targetDetailLst = new List();
+ // List cxLst = new List();
+ // foreach (MenBanPackingList sourceObj in input)
+ // {
+ // TB_BILL targetMain = new TB_BILL();
+ // targetMain.BillNum = sourceObj.BillNum; //单据编号
+ // targetMain.State = 0;
+ // targetMain.BillType = 206; //单据类型
+ // targetMain.SubBillType = 21004; //单据子类型
+ // targetMain.BillTime = sourceObj.PrintDate; //单据时间
+ // targetMain.OperName = sourceObj.CreatorId.ToString(); //操作员
+ // targetMain.DetailQty = 0; //明细数量
+ // targetMain.CustId = _providerCode; //供应商编号
+ // //targetMain.ProjectId = sourceObj.PartType == null ? null : sourceObj.PartType.Replace(" DP", ""); //添加车型
+ // //targetMain.DockCode = sourceObj.BillLocation;
+
+ // targetMain.GateCode = sourceObj.PartType; //B柱下
+ // targetMain.GateName = sourceObj.BillSerialNum; //顺序号
+ // targetMain.DockCode = sourceObj.VehicleModel; //左或右
+ // targetMain.Remark = sourceObj.MinOnlineTime == null ? null : ((DateTime)sourceObj.MinOnlineTime).ToString("yyyy-MM-dd HH:mm"); //最早上线时间(预计到达时间)
+ // targetMain.TransportType = sourceObj.BillSerialNum; //顺序号
+ // targetMain.SourceBillNum3 = sourceObj.ProductLine; //2022-10-13加生产线
+ // targetMainLst.Add(targetMain);
+ // int idx = 0;
+ // int idx2 = 0;
+ // foreach (MenBanPackingRec sourceRec in sourceObj.Details)
+ // {
+ // idx2++;
+ // if (sourceRec.PartCode2.IsNullOrEmpty() == false)
+ // {
+ // var materialObj = _materialExtRepository.FirstOrDefault(itm => itm.MaterialNum == sourceRec.PartCode2 && itm.MaterialType == "1");
+ // idx++;
+ // TS_SORT_DETAIL targetDetail = new TS_SORT_DETAIL();
+ // targetDetail.BillNum = sourceObj.BillNum; //单据编号 通过该字段和主表弱连接
+ // targetDetail.LineNum = idx2; //行号
+ // targetDetail.VinCode = sourceRec.VIN; //VIN码
+ // targetDetail.SeqNum = idx2.ToString(); //顺序号sourceRec.HostSN.ToString()
+ // targetDetail.PartCode = sourceRec.PartCode2; //物料号
+ // //targetDetail.BarCode = sourceRec.TopBoxPositionNum; //箱码
+ // targetDetail.ProjectId = ""; //车型
+ // targetDetail.PlanQty = 1; //计划数量
+ // targetDetail.State = "0"; //状态
+ // targetDetail.CustPartCode = materialObj == null ? null : materialObj.RelationKey;
+ // targetDetail.FullBarCode = null;
+ // targetDetail.VendId = sourceRec.KNR;
+
+ // //targetDetail.BarCode = sourceRec.HostSN.ToString(); //2022-10-13加
+
+ // targetDetailLst.Add(targetDetail);
+ // if (materialObj != null && materialObj.VehicleModel != null)
+ // {
+ // cxLst.Add(materialObj.VehicleModel);
+ // }
+ // }
+ // if (sourceRec.PartCode4.IsNullOrEmpty() == false)
+ // {
+ // var materialObj = _materialExtRepository.FirstOrDefault(itm => itm.MaterialNum == sourceRec.PartCode4 && itm.MaterialType == "1");
+
+ // idx++;
+ // TS_SORT_DETAIL targetDetail = new TS_SORT_DETAIL();
+ // targetDetail.BillNum = sourceObj.BillNum; //单据编号 通过该字段和主表弱连接
+ // targetDetail.VinCode = sourceRec.VIN; //VIN码
+ // targetDetail.PartCode = sourceRec.PartCode4; //物料号
+ // targetDetail.LineNum = (idx2 + 12); //行号
+ // targetDetail.SeqNum = (idx2 + 12).ToString(); //顺序号sourceRec.HostSN.ToString()
+ // //targetDetail.BarCode = sourceRec.TopBoxPositionNum; //箱码
+ // targetDetail.ProjectId = ""; //车型
+ // targetDetail.State = "0"; //状态
+ // targetDetail.PlanQty = 1; //计划数量
+ // targetDetail.CustPartCode = materialObj == null ? null : materialObj.RelationKey;
+ // targetDetail.FullBarCode = null;
+ // targetDetail.VendId = sourceRec.KNR;
+
+ // //targetDetail.BarCode = sourceRec.HostSN.ToString(); //2022-10-13加
+
+ // targetDetailLst.Add(targetDetail);
+ // if (materialObj != null && materialObj.VehicleModel != null)
+ // {
+ // cxLst.Add(materialObj.VehicleModel);
+ // }
+ // }
+ // }
+ // //生成车型
+ // string cxStr = "";
+ // foreach (string cxObj in cxLst.Distinct())
+ // {
+ // cxStr += cxObj + "、";
+ // }
+ // if (cxStr.Length > 0)
+ // {
+ // cxStr = cxStr.Substring(0, cxStr.Length - 1);
+ // }
+ // targetMain.ProjectId = cxStr; //添加车型
- targetMain.GateCode = sourceObj.PartType; //B柱下
- targetMain.GateName = sourceObj.BillSerialNum; //顺序号
- targetMain.DockCode = sourceObj.BillLocation; //左或右
- targetMain.Remark = sourceObj.MinOnlineTime == null ? null : ((DateTime)sourceObj.MinOnlineTime).ToString("yyyy-MM-dd HH:mm"); //最早上线时间(预计到达时间)
- targetMain.TransportType = sourceObj.BillSerialNum; //顺序号
- targetMain.SourceBillNum3 = sourceObj.ProductLine; //2022-10-13加生产线
- targetMainLst.Add(targetMain);
- int idx = 0;
- int idx2 = 0;
- foreach (MenBanPackingRec sourceRec in sourceObj.Details)
- {
- idx2++;
- if (sourceRec.TopSAPMaterialNum.IsNullOrEmpty() == false)
- {
- var materialObj = _materialExtRepository.FirstOrDefault(itm => itm.MaterialNum == sourceRec.TopSAPMaterialNum && itm.MaterialType == "1");
- idx++;
- TS_SORT_DETAIL targetDetail = new TS_SORT_DETAIL();
- targetDetail.BillNum = sourceObj.BillNum; //单据编号 通过该字段和主表弱连接
- targetDetail.LineNum = idx2; //行号
- targetDetail.VinCode = sourceRec.VIN; //VIN码
- targetDetail.SeqNum = idx2.ToString(); //顺序号sourceRec.HostSN.ToString()
- targetDetail.PartCode = sourceRec.TopSAPMaterialNum; //物料号
- //targetDetail.BarCode = sourceRec.TopBoxPositionNum; //箱码
- targetDetail.ProjectId = ""; //车型
- targetDetail.PlanQty = 1; //计划数量
- targetDetail.State = "0"; //状态
- targetDetail.CustPartCode = materialObj == null ? null : materialObj.RelationKey;
- targetDetail.FullBarCode = null;
- targetDetail.VendId = sourceRec.KNR;
+ // if (string.IsNullOrEmpty(cxStr))
+ // {
+ // targetMain.ProjectId = sourceObj.PartType == null ? null : sourceObj.PartType.Replace(" DP", ""); //添加车型
+ // }
+
+ // }
+ // foreach (TB_BILL targetMain in targetMainLst)
+ // {
+ // //明细数量
+ // targetMain.DetailQty = targetDetailLst.Where(p=>p.BillNum== targetMain.BillNum).Count();
+ // int cnt = InsertOrUpdateWMSMain(targetMain);
+ // if (cnt == 0)
+ // {
+ // throw new Exception("插入或更新库存系统接口表记录数为零!");
+ // }
+ // }
+ // foreach (TS_SORT_DETAIL targetDetail in targetDetailLst)
+ // {
+ // int cnt = InsertOrUpdateWMSDetail(targetDetail);
+ // if (cnt == 0)
+ // {
+ // throw new Exception("插入或更新库存系统接口表记录数为零!");
+ // }
+ // }
+
+ //}
+ //private int InsertOrUpdateWMSMain(TB_BILL targetMain)
+ //{
+ // int ret = 0;
+ // string sqlSelMain = string.Format("select * from TB_BILL where BillNum = '{0}'", targetMain.BillNum);
+ // TB_BILL wmsMain = _wmsDapperRepository.GetSingleBySql(sqlSelMain, true);
+ // if (wmsMain == null)
+ // {
+ // string sqlInsertMain = @"
+ // insert into TB_BILL (BillNum, [State], BillType, SubBillType, BillTime, OperName, DetailQty, CustId, ProjectId, DockCode, GateCode, GateName, Remark)
+ // values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}')";
+ // sqlInsertMain = string.Format(sqlInsertMain,
+ // targetMain.BillNum, targetMain.State, targetMain.BillType, targetMain.SubBillType, targetMain.BillTime,
+ // targetMain.OperName, targetMain.DetailQty, targetMain.CustId, targetMain.ProjectId, targetMain.DockCode, targetMain.GateCode, targetMain.GateName, targetMain.Remark);
+ // try
+ // {
+ // ret = _wmsDapperRepository.ExecuteSql(sqlInsertMain, null, true);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception("调用InsertOrUpdateWMSMain方法时报错:" + ex.Message + "SQL:" + sqlInsertMain + "单据号:" + targetMain.BillNum);
+ // }
+ // }
+ // else
+ // {
+ // if (wmsMain.State != 0)
+ // {
+ // throw new Exception("库存系统接口主表中已经存在该单据,并且已经排序,不能重新打印,单据号" + wmsMain.BillNum);
+ // }
+ // string sqlUpdateMain = @"
+ // update TB_BILL set
+ // [State] = '{1}',
+ // BillType = '{2}',
+ // SubBillType = '{3}',
+ // BillTime = '{4}',
+ // OperName = '{5}',
+ // DetailQty = '{6}',
+ // CustId = '{7}',
+ // ProjectId = '{8}',
+ // DockCode = '{9}',
+ // GateCode = '{10}',
+ // GateName = '{11}',
+ // Remark = '{12}'
+ // where BillNum = '{0}'
+ // ";
+ // sqlUpdateMain = string.Format(sqlUpdateMain,
+ // targetMain.BillNum, targetMain.State, targetMain.BillType, targetMain.SubBillType, targetMain.BillTime,
+ // targetMain.OperName, targetMain.DetailQty, targetMain.CustId, targetMain.ProjectId, targetMain.DockCode, targetMain.GateCode, targetMain.GateName, targetMain.Remark);
+ // try
+ // {
+ // ret = _wmsDapperRepository.ExecuteSql(sqlUpdateMain, null, true);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception("调用InsertOrUpdateWMSMain方法时报错:" + ex.Message + "SQL:" + sqlUpdateMain + "单据号:" + targetMain.BillNum);
+ // }
- //targetDetail.BarCode = sourceRec.HostSN.ToString(); //2022-10-13加
+ // }
+ // return ret;
+ //}
+
+ //private int InsertOrUpdateWMSDetail(TS_SORT_DETAIL targetDetail)
+ //{
+ // int ret = 0;
+ // string sqlSelDetail = string.Format("select * from TS_SORT_DETAIL where BillNum = '{0}' and VinCode = '{1}' and PartCode = '{2}'", targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode);
+ // TS_SORT_DETAIL wmsDetail = _wmsDapperRepository.GetSingleBySql(sqlSelDetail, true);
+ // if (wmsDetail == null)
+ // {
+ // string sqlInsertDetail = @"
+ // insert into TS_SORT_DETAIL (
+ // BillNum, VinCode, PartCode, LineNum, SeqNum,
+ // ProjectId, [State], BarCode, PlanQty, CustPartCode,
+ // FullBarCode, VendId)
+ // values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}')";
+ // sqlInsertDetail = string.Format(sqlInsertDetail,
+ // targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode, targetDetail.LineNum, targetDetail.SeqNum,
+ // targetDetail.ProjectId, targetDetail.State, targetDetail.BarCode, targetDetail.PlanQty, targetDetail.CustPartCode,
+ // targetDetail.FullBarCode, targetDetail.VendId);
+ // try
+ // {
+ // ret = _wmsDapperRepository.ExecuteSql(sqlInsertDetail, null, true);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception("调用InsertOrUpdateWMSDetail方法时报错:" + ex.Message + "SQL:" + sqlInsertDetail);
+ // }
+ // }
+ // else
+ // {
+ // string sqlUpdateDetail = @"
+ // update TS_SORT_DETAIL set
+ // LineNum = '{3}',
+ // SeqNum = '{4}',
+ // ProjectId = '{5}',
+ // [State] = '{6}',
+ // BarCode = '{7}',
+ // PlanQty = '{8}',
+ // CustPartCode = '{9}',
+ // FullBarCode = '{10}'
+ // VendId = '{11}'
+ // where BillNum = '{0}' and VinCode = '{1}' and PartCode = '{2}'
+ // ";
+ // sqlUpdateDetail = string.Format(sqlUpdateDetail,
+ // targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode, targetDetail.LineNum, targetDetail.SeqNum,
+ // targetDetail.ProjectId, targetDetail.State, targetDetail.BarCode, targetDetail.PlanQty, targetDetail.CustPartCode,
+ // targetDetail.FullBarCode, targetDetail.VendId);
+ // try
+ // {
+ // ret = _wmsDapperRepository.ExecuteSql(sqlUpdateDetail, null, true);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception("调用InsertOrUpdateWMSDetail方法时报错:" + ex.Message + "SQL:" + sqlUpdateDetail);
+ // }
+ // }
+ // return ret;
+ //}
- targetDetailLst.Add(targetDetail);
- if (materialObj != null && materialObj.VehicleModel != null)
- {
- cxLst.Add(materialObj.VehicleModel);
- }
- }
- if (sourceRec.BelowSAPMaterialNum.IsNullOrEmpty() == false)
- {
- var materialObj = _materialExtRepository.FirstOrDefault(itm => itm.MaterialNum == sourceRec.BelowSAPMaterialNum && itm.MaterialType == "1");
+ #endregion
+ /*
+ #region 柱护板装箱单
+ //private void DelOrScrapWMSInterface(string billNum)
+ //{
+ // //重新打印时,库存系统接口如果存在已发运的正常打印单据,则不允许重新打印;如果存在未发运的正常打印单据则删除该单据
+ // string oldBillNum = billNum;
+ // TB_BILL oldBillObj = _wmsDapperRepository.GetSingleBySql($"select top 1 * from TB_BILL where BillNum = '{oldBillNum}'", true);
+ // if (oldBillObj != null)
+ // {
+ // if (oldBillObj.State == 0)
+ // {
+ // string sqlMain = $"delete from TS_SORT_DETAIL where BillNum = '{oldBillNum}'";
+ // _wmsDapperRepository.ExecuteSql(sqlMain, null, true);
- idx++;
- TS_SORT_DETAIL targetDetail = new TS_SORT_DETAIL();
- targetDetail.BillNum = sourceObj.BillNum; //单据编号 通过该字段和主表弱连接
- targetDetail.VinCode = sourceRec.VIN; //VIN码
- targetDetail.PartCode = sourceRec.BelowSAPMaterialNum; //物料号
- targetDetail.LineNum = (idx2 + 12); //行号
- targetDetail.SeqNum = (idx2 + 12).ToString(); //顺序号sourceRec.HostSN.ToString()
- //targetDetail.BarCode = sourceRec.TopBoxPositionNum; //箱码
- targetDetail.ProjectId = ""; //车型
- targetDetail.State = "0"; //状态
- targetDetail.PlanQty = 1; //计划数量
- targetDetail.CustPartCode = materialObj == null ? null : materialObj.RelationKey;
- targetDetail.FullBarCode = null;
- targetDetail.VendId = sourceRec.KNR;
+ // string sqlDetail = $"delete from TB_BILL where BillNum = '{oldBillNum}'";
+ // _wmsDapperRepository.ExecuteSql(sqlDetail, null, true);
+ // }
+ // else
+ // {
+ // throw new BusinessException("1001", $"该单据{oldBillNum}在库存系统中已经排序或发运,不允许删除!");
+ // }
+ // }
+ //}
- //targetDetail.BarCode = sourceRec.HostSN.ToString(); //2022-10-13加
-
- targetDetailLst.Add(targetDetail);
- if (materialObj != null && materialObj.VehicleModel != null)
- {
- cxLst.Add(materialObj.VehicleModel);
- }
- }
- }
- //生成车型
- string cxStr = "";
- foreach (string cxObj in cxLst.Distinct())
- {
- cxStr += cxObj + "、";
- }
- if (cxStr.Length > 0)
- {
- cxStr = cxStr.Substring(0, cxStr.Length - 1);
- }
- targetMain.ProjectId = cxStr; //添加车型
-
- if (string.IsNullOrEmpty(cxStr))
- {
- targetMain.ProjectId = sourceObj.PartType == null ? null : sourceObj.PartType.Replace(" DP", ""); //添加车型
- }
-
- }
- foreach (TB_BILL targetMain in targetMainLst)
- {
- //明细数量
- targetMain.DetailQty = targetDetailLst.Where(p=>p.BillNum== targetMain.BillNum).Count();
- int cnt = InsertOrUpdateWMSMain(targetMain);
- if (cnt == 0)
- {
- throw new Exception("插入或更新库存系统接口表记录数为零!");
- }
- }
- foreach (TS_SORT_DETAIL targetDetail in targetDetailLst)
- {
- int cnt = InsertOrUpdateWMSDetail(targetDetail);
- if (cnt == 0)
- {
- throw new Exception("插入或更新库存系统接口表记录数为零!");
- }
- }
-
- }
- private int InsertOrUpdateWMSMain(TB_BILL targetMain)
- {
- int ret = 0;
- string sqlSelMain = string.Format("select * from TB_BILL where BillNum = '{0}'", targetMain.BillNum);
- TB_BILL wmsMain = _wmsDapperRepository.GetSingleBySql(sqlSelMain, true);
- if (wmsMain == null)
- {
- string sqlInsertMain = @"
- insert into TB_BILL (BillNum, [State], BillType, SubBillType, BillTime, OperName, DetailQty, CustId, ProjectId, DockCode, GateCode, GateName, Remark)
- values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}')";
- sqlInsertMain = string.Format(sqlInsertMain,
- targetMain.BillNum, targetMain.State, targetMain.BillType, targetMain.SubBillType, targetMain.BillTime,
- targetMain.OperName, targetMain.DetailQty, targetMain.CustId, targetMain.ProjectId, targetMain.DockCode, targetMain.GateCode, targetMain.GateName, targetMain.Remark);
- try
- {
- ret = _wmsDapperRepository.ExecuteSql(sqlInsertMain, null, true);
- }
- catch (Exception ex)
- {
- throw new Exception("调用InsertOrUpdateWMSMain方法时报错:" + ex.Message + "SQL:" + sqlInsertMain + "单据号:" + targetMain.BillNum);
- }
- }
- else
- {
- if (wmsMain.State != 0)
- {
- throw new Exception("库存系统接口主表中已经存在该单据,并且已经排序,不能重新打印,单据号" + wmsMain.BillNum);
- }
- string sqlUpdateMain = @"
- update TB_BILL set
- [State] = '{1}',
- BillType = '{2}',
- SubBillType = '{3}',
- BillTime = '{4}',
- OperName = '{5}',
- DetailQty = '{6}',
- CustId = '{7}',
- ProjectId = '{8}',
- DockCode = '{9}',
- GateCode = '{10}',
- GateName = '{11}',
- Remark = '{12}'
- where BillNum = '{0}'
- ";
- sqlUpdateMain = string.Format(sqlUpdateMain,
- targetMain.BillNum, targetMain.State, targetMain.BillType, targetMain.SubBillType, targetMain.BillTime,
- targetMain.OperName, targetMain.DetailQty, targetMain.CustId, targetMain.ProjectId, targetMain.DockCode, targetMain.GateCode, targetMain.GateName, targetMain.Remark);
- try
- {
- ret = _wmsDapperRepository.ExecuteSql(sqlUpdateMain, null, true);
- }
- catch (Exception ex)
- {
- throw new Exception("调用InsertOrUpdateWMSMain方法时报错:" + ex.Message + "SQL:" + sqlUpdateMain + "单据号:" + targetMain.BillNum);
- }
-
- }
- return ret;
- }
- private int InsertOrUpdateWMSDetail(TS_SORT_DETAIL targetDetail)
- {
- int ret = 0;
- string sqlSelDetail = string.Format("select * from TS_SORT_DETAIL where BillNum = '{0}' and VinCode = '{1}' and PartCode = '{2}'", targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode);
- TS_SORT_DETAIL wmsDetail = _wmsDapperRepository.GetSingleBySql(sqlSelDetail, true);
- if (wmsDetail == null)
- {
- string sqlInsertDetail = @"
- insert into TS_SORT_DETAIL (
- BillNum, VinCode, PartCode, LineNum, SeqNum,
- ProjectId, [State], BarCode, PlanQty, CustPartCode,
- FullBarCode, VendId)
- values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}')";
- sqlInsertDetail = string.Format(sqlInsertDetail,
- targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode, targetDetail.LineNum, targetDetail.SeqNum,
- targetDetail.ProjectId, targetDetail.State, targetDetail.BarCode, targetDetail.PlanQty, targetDetail.CustPartCode,
- targetDetail.FullBarCode, targetDetail.VendId);
- try
- {
- ret = _wmsDapperRepository.ExecuteSql(sqlInsertDetail, null, true);
- }
- catch (Exception ex)
- {
- throw new Exception("调用InsertOrUpdateWMSDetail方法时报错:" + ex.Message + "SQL:" + sqlInsertDetail);
- }
- }
- else
- {
- string sqlUpdateDetail = @"
- update TS_SORT_DETAIL set
- LineNum = '{3}',
- SeqNum = '{4}',
- ProjectId = '{5}',
- [State] = '{6}',
- BarCode = '{7}',
- PlanQty = '{8}',
- CustPartCode = '{9}',
- FullBarCode = '{10}'
- VendId = '{11}'
- where BillNum = '{0}' and VinCode = '{1}' and PartCode = '{2}'
- ";
- sqlUpdateDetail = string.Format(sqlUpdateDetail,
- targetDetail.BillNum, targetDetail.VinCode, targetDetail.PartCode, targetDetail.LineNum, targetDetail.SeqNum,
- targetDetail.ProjectId, targetDetail.State, targetDetail.BarCode, targetDetail.PlanQty, targetDetail.CustPartCode,
- targetDetail.FullBarCode, targetDetail.VendId);
- try
- {
- ret = _wmsDapperRepository.ExecuteSql(sqlUpdateDetail, null, true);
- }
- catch (Exception ex)
- {
- throw new Exception("调用InsertOrUpdateWMSDetail方法时报错:" + ex.Message + "SQL:" + sqlUpdateDetail);
- }
- }
- return ret;
- }
-
- #endregion
-
- #region 柱护板装箱单
- //private void DelOrScrapWMSInterface(string billNum)
- //{
- // //重新打印时,库存系统接口如果存在已发运的正常打印单据,则不允许重新打印;如果存在未发运的正常打印单据则删除该单据
- // string oldBillNum = billNum;
- // TB_BILL oldBillObj = _wmsDapperRepository.GetSingleBySql($"select top 1 * from TB_BILL where BillNum = '{oldBillNum}'", true);
- // if (oldBillObj != null)
- // {
- // if (oldBillObj.State == 0)
- // {
- // string sqlMain = $"delete from TS_SORT_DETAIL where BillNum = '{oldBillNum}'";
- // _wmsDapperRepository.ExecuteSql(sqlMain, null, true);
-
- // string sqlDetail = $"delete from TB_BILL where BillNum = '{oldBillNum}'";
- // _wmsDapperRepository.ExecuteSql(sqlDetail, null, true);
- // }
- // else
- // {
- // throw new BusinessException("1001", $"该单据{oldBillNum}在库存系统中已经排序或发运,不允许删除!");
- // }
- // }
- //}
-
- ///
- /// 根据条件取用于打印的柱护板单据列表
- ///
- ///
- ///
- ///
- private async Task> GetZHBReportDetailList(ZhuHuBanPrintInputDto input, bool isFillBreakNum = false)
- {
- List billLst = new List();
- ListResultDto ret = new ListResultDto(billLst);
+ ///
+ /// 根据条件取用于打印的柱护板单据列表
+ ///
+ ///
+ ///
+ ///
+ private async Task> GetZHBReportDetailList(ZhuHuBanPrintInputDto input, bool isFillBreakNum = false)
+ {
+ List billLst = new List();
+ ListResultDto ret = new ListResultDto(billLst);
int printBillCnt = 0;
if (input.PrintType == PrintTypeEnum.正常打印)
@@ -2053,7 +1990,7 @@ select * from
return null;
}
#endregion
-
+ */
#region 报表公共方法
///
@@ -2069,27 +2006,30 @@ select * from
List retLst = new List();
try
{
- int lastNum = await GetMenBanLastPrintNum(input);
- int newNum = lastNum + 1;
- if ((lastNum % 10000) == 1999)
+ int lastNum = await GetMenBanLastPrintNum(input); //从M100中取当前产线、已经打印的最大大众顺序号
+ if (lastNum > 0)
{
- if ((input.BeginHostSN % 10000) != 1)
+ if ((lastNum % 10000) == 1999)
{
- string msg = $"单据之间断号,上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!";
- retLst.Add(msg);
- _logger.LogDebug(msg);
+ if ((input.BeginHostSN % 10000) != 1)
+ {
+ string msg = $"单据之间断号,上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!";
+ retLst.Add(msg);
+ _logger.LogDebug(msg);
+ }
}
- }
- else
- {
- if(newNum!= input.BeginHostSN)
+ else
{
- string msg = $"单据之间断号,上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!";
- retLst.Add(msg);
- _logger.LogDebug(msg);
+ if (lastNum + 1 != input.BeginHostSN)
+ {
+ string msg = $"单据之间断号,上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!";
+ retLst.Add(msg);
+ _logger.LogDebug(msg);
+ }
}
}
+
ListResultDto tempLst = await GetMBReportDetailList(input, false);
List billLst = tempLst.Item;
if (billLst.Count < 2)
@@ -2142,134 +2082,71 @@ select * from
///
/// 是否柱护板
/// 断号时Item不为空
- [UnitOfWork(false)]
- [HttpPost]
- [Route("check-zhb-hostsn-break-num")]
- public virtual async Task> CheckZHBHostSNBreakNum(ZhuHuBanPrintInputDto input)
- {
- List retLst = new List();
- try
- {
- int lastNum = await GetZhuHuBanLastPrintNum(input);
- int newNum = lastNum + 1;
- if ((lastNum % 10000) == 1999)
- {
- if ((input.BeginHostSN % 10000) != 1)
- {
- retLst.Add($"上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!");
- }
- }
- else
- {
- if (newNum != input.BeginHostSN)
- {
- retLst.Add($"上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!");
- }
- }
- ListResultDto tempLst = await GetZHBReportDetailList(input, false);
- List billLst = tempLst.Item;
- if (billLst.Count < 2)
- {
- return new ListResultDto(retLst);
- }
- for (int i = 1; i < billLst.Count; i++)
- {
- BillM100 priorObj = billLst[i - 1];
- BillM100 curObj = billLst[i];
- int priorHostSN = (int)billLst[i - 1].HostSN;
- int curHostSN = (int)billLst[i].HostSN;
-
- if (curHostSN > priorHostSN) //0005、0006
- {
- if (curHostSN > priorHostSN + 1) //0005、0008时,补号 0006、0007
- {
- retLst.Add($"大众顺序号{priorObj.HostSN}与{curObj.HostSN}之间存在断号情况!");
- }
- }
- else if (curHostSN < priorHostSN) //1999到0001的情况
- {
- if (curHostSN + _hostSNMaxVal > priorHostSN + 1) //0005、0008时,补号 0006、0007
- {
- retLst.Add($"大众顺序号{priorObj.HostSN}与{curObj.HostSN}之间存在断号情况!");
- }
- }
- }
- return new ListResultDto(retLst);
- }
- catch (Exception ex)
- {
- ListResultDto ret = new ListResultDto();
- ret.Status = false;
- ret.Message = _errorMessagePrefix + "打印前检查大众顺序号是否断号CheckZHBHostSNBreakNum 执行出错:" + ex.Message;
- _logger.LogError(ret.Message);
- return ret;
- }
- }
-
- ///
- /// 根据生产线获取正常打印单据的起始大众顺序号
- ///
- /// 生产线
- /// 起始大众顺序号
- //[UnitOfWork]
- //[HttpGet]
- //[Route("get-print-start-hostsn")]
- //public virtual async Task> GetPrintStartHostSN(string productLine)
+ //[UnitOfWork(false)]
+ //[HttpPost]
+ //[Route("check-zhb-hostsn-break-num")]
+ //public virtual async Task> CheckZHBHostSNBreakNum(ZhuHuBanPrintInputDto input)
//{
- // int? beginHostSN = null;
+ // List retLst = new List();
// try
// {
- // //存在已打印单据
- // var publishQry = _billM100Repository.Where(itm => itm.ProductLine == productLine && itm.BillStatus == BillStatusEnum.Publish);
- // if (publishQry.Any() == true)
+ // int lastNum = await GetZhuHuBanLastPrintNum(input);
+ // int newNum = lastNum + 1;
+ // if ((lastNum % 10000) == 1999)
// {
- // //取已打印最后一个单据
- // DateTime publishMaxCreateTime = publishQry.Max(itm => itm.CreationTime);
- // //取指定生产线、不等于已打印状态、大于已打印最后一个单据、最小的CreationTime
- // var query = _billM100Repository.Where(itm =>
- // itm.ProductLine == productLine
- // && (itm.BillStatus != BillStatusEnum.Publish)
- // && itm.CreationTime > publishMaxCreateTime);
- // if (query.Any())
+ // if ((input.BeginHostSN % 10000) != 1)
// {
- // DateTime minCreateTime = query.Min(itm => itm.CreationTime);
- // //根据CreationTime取大众顺序号
- // var obj = await _billM100Repository.FirstOrDefaultAsync(itm => itm.ProductLine == productLine && itm.CreationTime == minCreateTime);
- // if (obj != null)
- // {
- // beginHostSN = obj.HostSN;
- // }
+ // retLst.Add($"上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!");
// }
// }
// else
// {
- // //取指定生产线、不等于已打印状态、最小的CreationTime
- // var query2 = _billM100Repository.Where(itm =>
- // itm.ProductLine == productLine
- // && itm.BillStatus != BillStatusEnum.Publish);
- // if (query2.Any())
+ // if (newNum != input.BeginHostSN)
+ // {
+ // retLst.Add($"上次打印的最后大众顺序号为【{lastNum}】,与本次打印开始号【{input.BeginHostSN}】中间存在断号!");
+ // }
+ // }
+ // ListResultDto tempLst = await GetZHBReportDetailList(input, false);
+ // List billLst = tempLst.Item;
+ // if (billLst.Count < 2)
+ // {
+ // return new ListResultDto(retLst);
+ // }
+ // for (int i = 1; i < billLst.Count; i++)
+ // {
+ // BillM100 priorObj = billLst[i - 1];
+ // BillM100 curObj = billLst[i];
+ // int priorHostSN = (int)billLst[i - 1].HostSN;
+ // int curHostSN = (int)billLst[i].HostSN;
+
+ // if (curHostSN > priorHostSN) //0005、0006
+ // {
+ // if (curHostSN > priorHostSN + 1) //0005、0008时,补号 0006、0007
+ // {
+ // retLst.Add($"大众顺序号{priorObj.HostSN}与{curObj.HostSN}之间存在断号情况!");
+ // }
+ // }
+ // else if (curHostSN < priorHostSN) //1999到0001的情况
// {
- // DateTime minCreateTime2 = query2.Min(itm => itm.CreationTime);
- // //根据流水号取大众顺序号
- // var obj = await _billM100Repository.FirstOrDefaultAsync(itm => itm.ProductLine == productLine && itm.CreationTime == minCreateTime2);
- // if (obj != null)
+ // if (curHostSN + _hostSNMaxVal > priorHostSN + 1) //0005、0008时,补号 0006、0007
// {
- // beginHostSN = obj.HostSN;
+ // retLst.Add($"大众顺序号{priorObj.HostSN}与{curObj.HostSN}之间存在断号情况!");
// }
// }
// }
- // return new ObjectResultDto(beginHostSN);
+ // return new ListResultDto(retLst);
// }
// catch (Exception ex)
// {
- // ObjectResultDto ret = new ObjectResultDto();
+ // ListResultDto ret = new ListResultDto();
// ret.Status = false;
- // ret.Message = _errorMessagePrefix + "GetPrintStartHostSN 执行出错:" + ex.Message;
+ // ret.Message = _errorMessagePrefix + "打印前检查大众顺序号是否断号CheckZHBHostSNBreakNum 执行出错:" + ex.Message;
// _logger.LogError(ret.Message);
// return ret;
// }
//}
+
///
/// 根据生产线获取正常打印单据的起始大众顺序号2
///
@@ -2349,284 +2226,284 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
///
///
/// 执行成功返回真
- [UnitOfWork]
- [HttpPost]
- [Route("print-menban-packing-list")]
- public virtual async Task> PrintMenBanPackingList(MenBanPrintInputDto input)
- {
- /*
- 1、 一次打印24辆车,分为4页纸张,四个纸张的装箱单号不是一样
- 2、 按大众顺序号过滤打印,一次打印12套(不是24辆车),到1999后按2000、2001顺序排,下次打印按3延续排列右前
- 5、 物料描述字体尽量大
- 6、 右上角的“01 左” 字体尽量大
- 7、 零件类别: C8是车型, DP表示门板
- 8、 器具容量: 24表示当页包含24个门板
- 9、 车型门板代码: 从物料汇总文件- 补充备注 字段中取 Q5-DV OQ N5K 3L4 QQ2 6XE 7HB 9VS 7X1 3Y4
- 3、 根据物料描述字段区分左后、左前、右后、右前
- 4、 车型C8的第一二页分为左后, 右前,第三四页分为右后、左前;其它车型 第一二页分为左后、左前,第三四页分为右后、
- 10、 物料描述: 从物料汇总文件-物料描述 字段中取
- */
- MenBanPrintResultDto retObj = new MenBanPrintResultDto();
- ObjectResultDto ret = new ObjectResultDto(retObj);
- ret.Status = false;
- try
- {
- List reportMainLst = new List();
+ //[UnitOfWork]
+ //[HttpPost]
+ //[Route("print-menban-packing-list")]
+ //public virtual async Task> PrintMenBanPackingList(MenBanPrintInputDto input)
+ //{
+ // /*
+ // 1、 一次打印24辆车,分为4页纸张,四个纸张的装箱单号不是一样
+ // 2、 按大众顺序号过滤打印,一次打印12套(不是24辆车),到1999后按2000、2001顺序排,下次打印按3延续排列右前
+ // 5、 物料描述字体尽量大
+ // 6、 右上角的“01 左” 字体尽量大
+ // 7、 零件类别: C8是车型, DP表示门板
+ // 8、 器具容量: 24表示当页包含24个门板
+ // 9、 车型门板代码: 从物料汇总文件- 补充备注 字段中取 Q5-DV OQ N5K 3L4 QQ2 6XE 7HB 9VS 7X1 3Y4
+ // 3、 根据物料描述字段区分左后、左前、右后、右前
+ // 4、 车型C8的第一二页分为左后, 右前,第三四页分为右后、左前;其它车型 第一二页分为左后、左前,第三四页分为右后、
+ // 10、 物料描述: 从物料汇总文件-物料描述 字段中取
+ // */
+ // MenBanPrintResultDto retObj = new MenBanPrintResultDto();
+ // ObjectResultDto ret = new ObjectResultDto(retObj);
+ // ret.Status = false;
+ // try
+ // {
+ // List reportMainLst = new List();
- if (input.PrintType == PrintTypeEnum.正常打印)
- {
- if (input.BeginHostSN != 0 && input.EndHostSN != 0)
- {
- if (input.BeginHostSN > input.EndHostSN)
- {
- ret.Message = "止大众顺序号必须大于等于起大众顺序号!";
- ret.Status = false;
- return ret;
- }
- }
- ListResultDto tempLst = await GetMBReportDetailList(input, true); //-----------------------------
- List billLst = tempLst.Item;
- if (tempLst.Status == false)
- {
- ret.Message = tempLst.Message;
- ret.Status = false;
- return ret;
- }
+ // if (input.PrintType == PrintTypeEnum.正常打印)
+ // {
+ // if (input.BeginHostSN != 0 && input.EndHostSN != 0)
+ // {
+ // if (input.BeginHostSN > input.EndHostSN)
+ // {
+ // ret.Message = "止大众顺序号必须大于等于起大众顺序号!";
+ // ret.Status = false;
+ // return ret;
+ // }
+ // }
+ // ListResultDto tempLst = await GetMBReportDetailList(input, true); //-----------------------------
+ // List billLst = tempLst.Item;
+ // if (tempLst.Status == false)
+ // {
+ // ret.Message = tempLst.Message;
+ // ret.Status = false;
+ // return ret;
+ // }
- int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
+ // int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
- double maxBillNum = 0;
+ // double maxBillNum = 0;
- DateTime printTime = ServerHelper.CurrentDateTime;
+ // DateTime printTime = ServerHelper.CurrentDateTime;
- for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
- {
- //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
- double maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
- // 先打印两张:左后左前,再打印两张:右后右前
- List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
- List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
-
- //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
- Guid sortId = GuidGenerator.Create();
- foreach (var leftItm in leftLst)
- {
- leftItm.SortId = sortId;
- }
- foreach (var rightItm in rightLst)
- {
- rightItm.SortId = sortId;
- }
+ // for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
+ // {
+ // //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
+ // double maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
+ // // 先打印两张:左后左前,再打印两张:右后右前
+ // List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
+ // List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
+
+ // //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var leftItm in leftLst)
+ // {
+ // leftItm.SortId = sortId;
+ // }
+ // foreach (var rightItm in rightLst)
+ // {
+ // rightItm.SortId = sortId;
+ // }
- reportMainLst.AddRange(rightLst);
- reportMainLst.AddRange(leftLst);
- }
+ // reportMainLst.AddRange(rightLst);
+ // reportMainLst.AddRange(leftLst);
+ // }
- //调用派格版库存接口
- CallWMSInterface_MB(reportMainLst);
+ // //调用派格版库存接口
+ // CallWMSInterface_MB(reportMainLst);
- //插入门板打印记录表
- await _menBanPackingListRepository.InsertManyAsync(reportMainLst, true);
+ // //插入门板打印记录表
+ // await _menBanPackingListRepository.InsertManyAsync(reportMainLst, true);
- //更新M100的门板打印标志:BillStatus=3
- foreach (BillM100 billObj in billLst)
- {
- if (billObj.BillStatus == BillStatusEnum.Match)
- {
- billObj.SetBillStatus(BillStatusEnum.Publish);
- billObj.PrintTime = ServerHelper.CurrentDateTime;
- billObj.NeedReplenishPrint = 0; //不需要补打
- await _billM100Repository.UpdateAsync(billObj, true);
- }
- else if (billObj.BillStatus == BillStatusEnum.NotMatch)
- {
- //billObj.PrintTime = ServerHelper.CurrentDateTime;
- billObj.NeedReplenishPrint = 1; //需要补打
- await _billM100Repository.UpdateAsync(billObj, true);
- }
- }
- }
- else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
- {
- reportMainLst = await _menBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
- //按大众顺序号排序
- foreach (var reportMainObj in reportMainLst)
- {
- List recLst = reportMainObj.Details;
- if (recLst == null)
- continue;
- //bool has1999 = recLst.Any(itm => itm.HostSN.Contains("1999") || itm.HostSN.Contains("1998") || itm.HostSN.Contains("1997"));
- //bool has0001 = recLst.Any(itm => itm.HostSN.Contains("0001") || itm.HostSN.Contains("0002") || itm.HostSN.Contains("0003"));
- bool has1999 = recLst.Any(itm => itm.HostSN.Contains("1999") || itm.HostSN.Contains("1998") || itm.HostSN.Contains("1997")
- || itm.HostSN.Contains("1996") || itm.HostSN.Contains("1995") || itm.HostSN.Contains("1994")
- || itm.HostSN.Contains("1993") || itm.HostSN.Contains("1992") || itm.HostSN.Contains("1991")
- || itm.HostSN.Contains("1990") || itm.HostSN.Contains("1989") || itm.HostSN.Contains("1988")
- || itm.HostSN.Contains("1987") || itm.HostSN.Contains("1986") || itm.HostSN.Contains("1985")
- || itm.HostSN.Contains("1984") || itm.HostSN.Contains("1983") || itm.HostSN.Contains("1982")
- || itm.HostSN.Contains("1981") || itm.HostSN.Contains("1980") || itm.HostSN.Contains("1979")
- || itm.HostSN.Contains("1978") || itm.HostSN.Contains("1977") || itm.HostSN.Contains("1976")
- );
- bool has0001 = recLst.Any(itm => itm.HostSN.Contains("0001") || itm.HostSN.Contains("0002") || itm.HostSN.Contains("0003")
- || itm.HostSN.Contains("0004") || itm.HostSN.Contains("0005") || itm.HostSN.Contains("0006")
- || itm.HostSN.Contains("0007") || itm.HostSN.Contains("0008") || itm.HostSN.Contains("0009")
- || itm.HostSN.Contains("0010") || itm.HostSN.Contains("0011") || itm.HostSN.Contains("0012")
- || itm.HostSN.Contains("0013") || itm.HostSN.Contains("0014") || itm.HostSN.Contains("0015")
- || itm.HostSN.Contains("0016") || itm.HostSN.Contains("0017") || itm.HostSN.Contains("0018")
- || itm.HostSN.Contains("0019") || itm.HostSN.Contains("0020") || itm.HostSN.Contains("0021")
- || itm.HostSN.Contains("0022") || itm.HostSN.Contains("0023") || itm.HostSN.Contains("0024")
- );
- if (has1999 && has0001)
- {
- reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN.TryToIntZero() % 10000) < 240 ? (itm.HostSN.TryToIntZero() % 10000 + 1999) : (itm.HostSN.TryToIntZero() % 10000)).ToList();
- }
- else
- {
- reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
- }
- }
- }
- else if (input.PrintType == PrintTypeEnum.补打)
- {
- List billLst = _billM100Repository.Where(itm => input.M100IdList.Contains(itm.Id)).OrderBy(itm => itm.SerialNumStr).ToList();
- if (billLst.Count == 0)
- {
- ret.Message = "没有补打的单据,请先选择要补打的单据!";
- ret.Status = false;
- return ret;
- }
-
- int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
+ // //更新M100的门板打印标志:BillStatus=3
+ // foreach (BillM100 billObj in billLst)
+ // {
+ // if (billObj.BillStatus == BillStatusEnum.Match)
+ // {
+ // billObj.SetBillStatus(BillStatusEnum.Publish);
+ // billObj.PrintTime = ServerHelper.CurrentDateTime;
+ // billObj.NeedReplenishPrint = 0; //不需要补打
+ // await _billM100Repository.UpdateAsync(billObj, true);
+ // }
+ // else if (billObj.BillStatus == BillStatusEnum.NotMatch)
+ // {
+ // //billObj.PrintTime = ServerHelper.CurrentDateTime;
+ // billObj.NeedReplenishPrint = 1; //需要补打
+ // await _billM100Repository.UpdateAsync(billObj, true);
+ // }
+ // }
+ // }
+ // else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
+ // {
+ // reportMainLst = await _menBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
+ // //按大众顺序号排序
+ // foreach (var reportMainObj in reportMainLst)
+ // {
+ // List recLst = reportMainObj.Details;
+ // if (recLst == null)
+ // continue;
+ // //bool has1999 = recLst.Any(itm => itm.HostSN.Contains("1999") || itm.HostSN.Contains("1998") || itm.HostSN.Contains("1997"));
+ // //bool has0001 = recLst.Any(itm => itm.HostSN.Contains("0001") || itm.HostSN.Contains("0002") || itm.HostSN.Contains("0003"));
+ // bool has1999 = recLst.Any(itm => itm.HostSN.Contains("1999") || itm.HostSN.Contains("1998") || itm.HostSN.Contains("1997")
+ // || itm.HostSN.Contains("1996") || itm.HostSN.Contains("1995") || itm.HostSN.Contains("1994")
+ // || itm.HostSN.Contains("1993") || itm.HostSN.Contains("1992") || itm.HostSN.Contains("1991")
+ // || itm.HostSN.Contains("1990") || itm.HostSN.Contains("1989") || itm.HostSN.Contains("1988")
+ // || itm.HostSN.Contains("1987") || itm.HostSN.Contains("1986") || itm.HostSN.Contains("1985")
+ // || itm.HostSN.Contains("1984") || itm.HostSN.Contains("1983") || itm.HostSN.Contains("1982")
+ // || itm.HostSN.Contains("1981") || itm.HostSN.Contains("1980") || itm.HostSN.Contains("1979")
+ // || itm.HostSN.Contains("1978") || itm.HostSN.Contains("1977") || itm.HostSN.Contains("1976")
+ // );
+ // bool has0001 = recLst.Any(itm => itm.HostSN.Contains("0001") || itm.HostSN.Contains("0002") || itm.HostSN.Contains("0003")
+ // || itm.HostSN.Contains("0004") || itm.HostSN.Contains("0005") || itm.HostSN.Contains("0006")
+ // || itm.HostSN.Contains("0007") || itm.HostSN.Contains("0008") || itm.HostSN.Contains("0009")
+ // || itm.HostSN.Contains("0010") || itm.HostSN.Contains("0011") || itm.HostSN.Contains("0012")
+ // || itm.HostSN.Contains("0013") || itm.HostSN.Contains("0014") || itm.HostSN.Contains("0015")
+ // || itm.HostSN.Contains("0016") || itm.HostSN.Contains("0017") || itm.HostSN.Contains("0018")
+ // || itm.HostSN.Contains("0019") || itm.HostSN.Contains("0020") || itm.HostSN.Contains("0021")
+ // || itm.HostSN.Contains("0022") || itm.HostSN.Contains("0023") || itm.HostSN.Contains("0024")
+ // );
+ // if (has1999 && has0001)
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN.TryToIntZero() % 10000) < 240 ? (itm.HostSN.TryToIntZero() % 10000 + 1999) : (itm.HostSN.TryToIntZero() % 10000)).ToList();
+ // }
+ // else
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
+ // }
+ // }
+ // }
+ // else if (input.PrintType == PrintTypeEnum.补打)
+ // {
+ // List billLst = _billM100Repository.Where(itm => input.M100IdList.Contains(itm.Id)).OrderBy(itm => itm.SerialNumStr).ToList();
+ // if (billLst.Count == 0)
+ // {
+ // ret.Message = "没有补打的单据,请先选择要补打的单据!";
+ // ret.Status = false;
+ // return ret;
+ // }
- double maxBillNum = 0;
+ // int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
- DateTime printTime = ServerHelper.CurrentDateTime;
+ // double maxBillNum = 0;
- for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
- {
- //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
- double maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
- // 先打印两张:左后左前,再打印两张:右后右前
- List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
- List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
-
- //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
- Guid sortId = GuidGenerator.Create();
- foreach (var leftItm in leftLst)
- {
- leftItm.SortId = sortId;
- }
- foreach (var rightItm in rightLst)
- {
- rightItm.SortId = sortId;
- }
+ // DateTime printTime = ServerHelper.CurrentDateTime;
- reportMainLst.AddRange(rightLst);
- reportMainLst.AddRange(leftLst);
- }
- //校验底盘号、零件是否重复打印
- string checkVinPartRepeatSql = @"
- select top 1 a.BillNum from FisMenBanPackingList a join FisMenBanPackingRec b
- on a.Id = b.MenBanPackingListId
- where a.ReportStatus = 0
- and b.VIN = '{0}' and (TopSAPMaterialNum = '{1}' or BelowSAPMaterialNum = '{1}')
- ";
- foreach (MenBanPackingList reportMainObj in reportMainLst)
- {
- foreach (MenBanPackingRec reportRecObj in reportMainObj.Details)
- {
- string sql1 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.TopSAPMaterialNum);
- string checkVinPartRepeatBillNum1 = _newJitDapperRepository.GetSingleBySql(sql1, true);
- if (string.IsNullOrEmpty(checkVinPartRepeatBillNum1) == false)
- {
- throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum1}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.TopSAPMaterialNum}之间重复!");
- }
+ // for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
+ // {
+ // //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
+ // double maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
+ // // 先打印两张:左后左前,再打印两张:右后右前
+ // List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
+ // List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
+
+ // //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var leftItm in leftLst)
+ // {
+ // leftItm.SortId = sortId;
+ // }
+ // foreach (var rightItm in rightLst)
+ // {
+ // rightItm.SortId = sortId;
+ // }
- string sql2 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.BelowSAPMaterialNum);
- string checkVinPartRepeatBillNum2 = _newJitDapperRepository.GetSingleBySql(sql2, true);
- if (string.IsNullOrEmpty(checkVinPartRepeatBillNum2) == false)
- {
- throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum2}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.BelowSAPMaterialNum}之间重复!");
- }
- }
- }
+ // reportMainLst.AddRange(rightLst);
+ // reportMainLst.AddRange(leftLst);
+ // }
+ // //校验底盘号、零件是否重复打印
+ // string checkVinPartRepeatSql = @"
+ // select top 1 a.BillNum from FisMenBanPackingList a join FisMenBanPackingRec b
+ // on a.Id = b.MenBanPackingListId
+ // where a.ReportStatus = 0
+ // and b.VIN = '{0}' and (TopSAPMaterialNum = '{1}' or BelowSAPMaterialNum = '{1}')
+ // ";
+ // foreach (MenBanPackingList reportMainObj in reportMainLst)
+ // {
+ // foreach (MenBanPackingRec reportRecObj in reportMainObj.Details)
+ // {
+ // string sql1 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.PartCode2);
+ // string checkVinPartRepeatBillNum1 = _newJitDapperRepository.GetSingleBySql(sql1, true);
+ // if (string.IsNullOrEmpty(checkVinPartRepeatBillNum1) == false)
+ // {
+ // throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum1}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.PartCode2}之间重复!");
+ // }
+
+ // string sql2 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.PartCode4);
+ // string checkVinPartRepeatBillNum2 = _newJitDapperRepository.GetSingleBySql(sql2, true);
+ // if (string.IsNullOrEmpty(checkVinPartRepeatBillNum2) == false)
+ // {
+ // throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum2}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.PartCode4}之间重复!");
+ // }
+ // }
+ // }
- //调用派格版库存接口
- CallWMSInterface_MB(reportMainLst);
+ // //调用派格版库存接口
+ // CallWMSInterface_MB(reportMainLst);
- //插入门板打印记录表
- await _menBanPackingListRepository.InsertManyAsync(reportMainLst);
+ // //插入门板打印记录表
+ // await _menBanPackingListRepository.InsertManyAsync(reportMainLst);
- //更新M100的门板打印标志:BillStatus=3
- foreach (BillM100 billObj in billLst)
- {
- if (billObj.BillStatus == BillStatusEnum.Match)
- {
- billObj.SetBillStatus(BillStatusEnum.Publish);
- billObj.PrintTime = ServerHelper.CurrentDateTime;
- await _billM100Repository.UpdateAsync(billObj);
- }
- }
- }
+ // //更新M100的门板打印标志:BillStatus=3
+ // foreach (BillM100 billObj in billLst)
+ // {
+ // if (billObj.BillStatus == BillStatusEnum.Match)
+ // {
+ // billObj.SetBillStatus(BillStatusEnum.Publish);
+ // billObj.PrintTime = ServerHelper.CurrentDateTime;
+ // await _billM100Repository.UpdateAsync(billObj);
+ // }
+ // }
+ // }
- #region 格式转换
- //实体 转 DTO
- List targetLst = ObjectMapper.Map, List>(reportMainLst);
- targetLst = targetLst.OrderBy(itm => itm.BillNum).ToList();
+ // #region 格式转换
+ // //实体 转 DTO
+ // List targetLst = ObjectMapper.Map, List>(reportMainLst);
+ // targetLst = targetLst.OrderBy(itm => itm.BillNum).ToList();
- //补充空行
- foreach (var masterObj in targetLst)
- {
- int trueCnt = masterObj.Details.Count;
- int planCnt = 12;
- if (trueCnt > planCnt)
- {
- throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
- }
- int diffCnt = planCnt - trueCnt;
- for (int i = 0; i < diffCnt; i++)
- {
- MenBanPackingRecDto dtlObj = new MenBanPackingRecDto();
- masterObj.Details.Add(dtlObj);
- }
- }
- //子表BillNum赋值, BillNum填充空格
- foreach (var masterObj in targetLst)
- {
- masterObj.BillNum = GetTrueString(masterObj.BillNum);
- int sn = 1;
- foreach (var detailObj in masterObj.Details)
- {
- detailObj.BillNum = masterObj.BillNum;
- detailObj.KNR = GetTrueString(detailObj.KNR);
- detailObj.sn = sn++;
- detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
- }
- }
- //返回结果格式转换
- foreach (var masterObj in targetLst)
- {
- foreach (var detailObj in masterObj.Details)
- {
- retObj.DetailList.Add(detailObj);
- }
- masterObj.Details = null;
- retObj.MasterList.Add(masterObj);
- }
- #endregion
- ret.Status = true;
- return ret;
- }
- catch (Exception ex)
- {
- string errorMsg = _errorMessagePrefix + "PrintMenBanPackingList 执行出错:" + ex.Message;
- _logger.LogError(errorMsg);
- throw new BusinessException("1001", errorMsg);
- ret.Status = false;
- ret.Message = ex.Message;
- return ret;
- }
- }
+ // //补充空行
+ // foreach (var masterObj in targetLst)
+ // {
+ // int trueCnt = masterObj.Details.Count;
+ // int planCnt = 12;
+ // if (trueCnt > planCnt)
+ // {
+ // throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
+ // }
+ // int diffCnt = planCnt - trueCnt;
+ // for (int i = 0; i < diffCnt; i++)
+ // {
+ // MenBanPackingRecDto dtlObj = new MenBanPackingRecDto();
+ // masterObj.Details.Add(dtlObj);
+ // }
+ // }
+ // //子表BillNum赋值, BillNum填充空格
+ // foreach (var masterObj in targetLst)
+ // {
+ // masterObj.BillNum = GetTrueString(masterObj.BillNum);
+ // int sn = 1;
+ // foreach (var detailObj in masterObj.Details)
+ // {
+ // detailObj.BillNum = masterObj.BillNum;
+ // detailObj.KNR = GetTrueString(detailObj.KNR);
+ // detailObj.sn = sn++;
+ // detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
+ // }
+ // }
+ // //返回结果格式转换
+ // foreach (var masterObj in targetLst)
+ // {
+ // foreach (var detailObj in masterObj.Details)
+ // {
+ // retObj.DetailList.Add(detailObj);
+ // }
+ // masterObj.Details = null;
+ // retObj.MasterList.Add(masterObj);
+ // }
+ // #endregion
+ // ret.Status = true;
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // string errorMsg = _errorMessagePrefix + "PrintMenBanPackingList 执行出错:" + ex.Message;
+ // _logger.LogError(errorMsg);
+ // throw new BusinessException("1001", errorMsg);
+ // ret.Status = false;
+ // ret.Message = ex.Message;
+ // return ret;
+ // }
+ //}
@@ -2636,423 +2513,402 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
///
///
/// 执行成功返回真
- [UnitOfWork(isTransactional:false)]
- [HttpPost]
- [Route("print-zhuhuban-packing-list")]
- public virtual async Task> PrintZhuHuBanPackingList(ZhuHuBanPrintInputDto input)
- {
- ZhuHuBanPrintResultDto retObj = new ZhuHuBanPrintResultDto();
- ObjectResultDto ret = new ObjectResultDto(retObj);
- ret.Status = false;
- try
- {
- List reportMainLst = new List();
- List forWMSLst = new List();
+ //[UnitOfWork(isTransactional:false)]
+ //[HttpPost]
+ //[Route("print-zhuhuban-packing-list")]
+ //public virtual async Task> PrintZhuHuBanPackingList(ZhuHuBanPrintInputDto input)
+ //{
+ // ZhuHuBanPrintResultDto retObj = new ZhuHuBanPrintResultDto();
+ // ObjectResultDto ret = new ObjectResultDto(retObj);
+ // ret.Status = false;
+ // try
+ // {
+ // List reportMainLst = new List();
+ // List forWMSLst = new List();
- if (input.PrintType == PrintTypeEnum.正常打印)
- {
- if (input.BeginHostSN > input.EndHostSN)
- {
- ret.Message = "起大众顺序号不能大于止大众顺序号!";
- ret.Status = false;
- return ret;
- }
+ // if (input.PrintType == PrintTypeEnum.正常打印)
+ // {
+ // if (input.BeginHostSN > input.EndHostSN)
+ // {
+ // ret.Message = "起大众顺序号不能大于止大众顺序号!";
+ // ret.Status = false;
+ // return ret;
+ // }
- ListResultDto tempLst = await GetZHBReportDetailList(input, true); //-------------------
- List billLst = tempLst.Item;
- if (tempLst.Status == false)
- {
- ret.Message = tempLst.Message;
- ret.Status = false;
- return ret;
- }
- if (billLst.Count > 24)
- {
- ret.Message = "打印柱护板单据的数量不能大于24!";
- ret.Status = false;
- return ret;
- }
- //加载柱护板缓存列表
- _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
+ // ListResultDto tempLst = await GetZHBReportDetailList(input, true); //-------------------
+ // List billLst = tempLst.Item;
+ // if (tempLst.Status == false)
+ // {
+ // ret.Message = tempLst.Message;
+ // ret.Status = false;
+ // return ret;
+ // }
+ // if (billLst.Count > 24)
+ // {
+ // ret.Message = "打印柱护板单据的数量不能大于24!";
+ // ret.Status = false;
+ // return ret;
+ // }
+ // //加载柱护板缓存列表
+ // _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
- long maxBillNum = 0; //子方法内部赋值
- DateTime printTime = ServerHelper.CurrentDateTime;
- double maxSN;
+ // long maxBillNum = 0; //子方法内部赋值
+ // DateTime printTime = ServerHelper.CurrentDateTime;
+ // double maxSN;
- //A上C上
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
- List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
- if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
- {
- acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
- }
- reportMainLst.AddRange(acLst);
- forWMSLst.AddRange(acLstOnlyWMSUse);
- //A柱下,A中
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
-
- List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
- List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(aaLst1);
- reportMainLst.AddRange(aaLst2);
- forWMSLst.AddRange(aaLst1);
- forWMSLst.AddRange(aaLst2);
- //B柱上
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
- List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bUpLst1);
- reportMainLst.AddRange(bUpLst2);
- forWMSLst.AddRange(bUpLst1);
- forWMSLst.AddRange(bUpLst2);
- //B柱下
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
-
- List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bDownLst1);
- reportMainLst.AddRange(bDownLst2);
- forWMSLst.AddRange(bDownLst1);
- forWMSLst.AddRange(bDownLst2);
- //D柱
- var lst1 = billLst.Take(12).ToList();
- var lst2 = billLst.Skip(12).ToList();
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左"); //左用于打印
- List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1); //左右用于库存接口
-
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
- List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
- reportMainLst.AddRange(dLst1);
- reportMainLst.AddRange(dLst2);
- forWMSLst.AddRange(forWMSLst1);
- forWMSLst.AddRange(forWMSLst2);
-
- //后轮,上装饰板
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
- List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
- List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(hsLst1);
- reportMainLst.AddRange(hsLst2);
- forWMSLst.AddRange(hsLst1);
- forWMSLst.AddRange(hsLst2);
-
- #region 调用库存接口
- //List forWMSLst = new List();
- //forWMSLst.AddRange(reportMainLst);
- //forWMSLst.AddRange(acLstOnlyWMSUse);
- CallWMSInterface_ZHB(forWMSLst);
- #endregion
-
- //插入柱护板打印记录表
- Guid sortId = GuidGenerator.Create();
- foreach (var srcObj2 in reportMainLst)
- {
- srcObj2.SortId = sortId; //一次打印SortId相同
- var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
- }
+ // //A上C上
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
+ // List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
+ // if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
+ // {
+ // acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
+ // }
+ // reportMainLst.AddRange(acLst);
+ // forWMSLst.AddRange(acLstOnlyWMSUse);
+ // //A柱下,A中
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
+
+ // List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(aaLst1);
+ // reportMainLst.AddRange(aaLst2);
+ // forWMSLst.AddRange(aaLst1);
+ // forWMSLst.AddRange(aaLst2);
+ // //B柱上
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
+ // List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bUpLst1);
+ // reportMainLst.AddRange(bUpLst2);
+ // forWMSLst.AddRange(bUpLst1);
+ // forWMSLst.AddRange(bUpLst2);
+ // //B柱下
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
+
+ // List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bDownLst1);
+ // reportMainLst.AddRange(bDownLst2);
+ // forWMSLst.AddRange(bDownLst1);
+ // forWMSLst.AddRange(bDownLst2);
+ // //D柱
+ // var lst1 = billLst.Take(12).ToList();
+ // var lst2 = billLst.Skip(12).ToList();
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左"); //左用于打印
+ // List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1); //左右用于库存接口
+
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
+ // List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
+ // reportMainLst.AddRange(dLst1);
+ // reportMainLst.AddRange(dLst2);
+ // forWMSLst.AddRange(forWMSLst1);
+ // forWMSLst.AddRange(forWMSLst2);
+
+ // //后轮,上装饰板
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
+ // List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(hsLst1);
+ // reportMainLst.AddRange(hsLst2);
+ // forWMSLst.AddRange(hsLst1);
+ // forWMSLst.AddRange(hsLst2);
+
+ // #region 调用库存接口
+ // //List forWMSLst = new List();
+ // //forWMSLst.AddRange(reportMainLst);
+ // //forWMSLst.AddRange(acLstOnlyWMSUse);
+ // CallWMSInterface_ZHB(forWMSLst);
+ // #endregion
+
+ // //插入柱护板打印记录表
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var srcObj2 in reportMainLst)
+ // {
+ // srcObj2.SortId = sortId; //一次打印SortId相同
+ // var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
+ // }
- ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
- var updIdLst = billLst.Select(itm => itm.Id).ToList();
- var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
- foreach (var updObj in updLst)
- {
- updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
- updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
- }
- await _billM100Repository.UpdateManyAsync(updLst, true);
+ // ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
+ // var updIdLst = billLst.Select(itm => itm.Id).ToList();
+ // var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
+ // foreach (var updObj in updLst)
+ // {
+ // updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
+ // updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
+ // }
+ // await _billM100Repository.UpdateManyAsync(updLst, true);
- }
- else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
- {
- if (input.DataResultType == "1") //全部11条数据
- {
- var firObj = await _zhuHuBanPackingListRepository.FirstOrDefaultAsync(itm => input.ReportIdList.Contains(itm.Id));
- if (firObj != null)
- {
- Guid? sortId = firObj.SortId;
- reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => itm.SortId == sortId, true);
- }
- }
- else
- {
- reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
- }
+ // }
+ // else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
+ // {
+ // if (input.DataResultType == "1") //全部11条数据
+ // {
+ // var firObj = await _zhuHuBanPackingListRepository.FirstOrDefaultAsync(itm => input.ReportIdList.Contains(itm.Id));
+ // if (firObj != null)
+ // {
+ // Guid? sortId = firObj.SortId;
+ // reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => itm.SortId == sortId, true);
+ // }
+ // }
+ // else
+ // {
+ // reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
+ // }
- //按大众顺序号排序
- foreach (var reportMainObj in reportMainLst)
- {
- List recLst = reportMainObj.Details;
- if (recLst == null)
- continue;
- //bool has1999 = recLst.Any(itm => itm.HostSN.ToString().Contains("1999") || itm.HostSN.ToString().Contains("1998"));
- //bool has0001 = recLst.Any(itm => itm.HostSN.ToString().Contains("0001") || itm.HostSN.ToString().Contains("0002"));
- bool has1999 = recLst.Any(itm => (itm.HostSN % 10000) >= 1999 - 24);
- bool has0001 = recLst.Any(itm => (itm.HostSN % 10000) <= 24);
- if (has1999 && has0001)
- {
- reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN % 10000) <= 23 ? (itm.HostSN % 10000 + 1999) : (itm.HostSN % 10000)).ToList();
- }
- else
- {
- reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
- }
- }
- }
- else if (input.PrintType == PrintTypeEnum.补打)
- {
- if (input.M100IdList.Count > 24)
- {
- throw new BusinessException("1001", $"选中的柱护板补打不能超过24个底盘!");
- }
+ // //按大众顺序号排序
+ // foreach (var reportMainObj in reportMainLst)
+ // {
+ // List recLst = reportMainObj.Details;
+ // if (recLst == null)
+ // continue;
+ // //bool has1999 = recLst.Any(itm => itm.HostSN.ToString().Contains("1999") || itm.HostSN.ToString().Contains("1998"));
+ // //bool has0001 = recLst.Any(itm => itm.HostSN.ToString().Contains("0001") || itm.HostSN.ToString().Contains("0002"));
+ // bool has1999 = recLst.Any(itm => (itm.HostSN % 10000) >= 1999 - 24);
+ // bool has0001 = recLst.Any(itm => (itm.HostSN % 10000) <= 24);
+ // if (has1999 && has0001)
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN % 10000) <= 23 ? (itm.HostSN % 10000 + 1999) : (itm.HostSN % 10000)).ToList();
+ // }
+ // else
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
+ // }
+ // }
+ // }
+ // else if (input.PrintType == PrintTypeEnum.补打)
+ // {
+ // if (input.M100IdList.Count > 24)
+ // {
+ // throw new BusinessException("1001", $"选中的柱护板补打不能超过24个底盘!");
+ // }
- List billLst = _billM100Repository.GetListAsync(itm => input.M100IdList.Contains(itm.Id), true).GetAwaiter().GetResult();
- if (billLst.Count == 0)
- {
- ret.Message = "没有补打的柱护板,请先选择要补打的柱护板!";
- ret.Status = false;
- return ret;
- }
- billLst = billLst.OrderBy(itm => itm.SerialNumStr).ToList();
+ // List billLst = _billM100Repository.GetListAsync(itm => input.M100IdList.Contains(itm.Id), true).GetAwaiter().GetResult();
+ // if (billLst.Count == 0)
+ // {
+ // ret.Message = "没有补打的柱护板,请先选择要补打的柱护板!";
+ // ret.Status = false;
+ // return ret;
+ // }
+ // billLst = billLst.OrderBy(itm => itm.SerialNumStr).ToList();
- //加载柱护板缓存列表
- _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
+ // //加载柱护板缓存列表
+ // _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
- long maxBillNum = 0; //全局唯一装箱单号
- DateTime printTime = ServerHelper.CurrentDateTime;
- double maxSN; //右上角顺序号01-99
+ // long maxBillNum = 0; //全局唯一装箱单号
+ // DateTime printTime = ServerHelper.CurrentDateTime;
+ // double maxSN; //右上角顺序号01-99
- //A上C上
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
- List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
- if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
- {
- acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
- }
- reportMainLst.AddRange(acLst);
- forWMSLst.AddRange(acLstOnlyWMSUse);
- //A柱下,A中
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
-
- List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
- List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(aaLst1);
- reportMainLst.AddRange(aaLst2);
- forWMSLst.AddRange(aaLst1);
- forWMSLst.AddRange(aaLst2);
- //B柱上
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
- List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bUpLst1);
- reportMainLst.AddRange(bUpLst2);
- forWMSLst.AddRange(bUpLst1);
- forWMSLst.AddRange(bUpLst2);
- //B柱下
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
-
- List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bDownLst1);
- reportMainLst.AddRange(bDownLst2);
- forWMSLst.AddRange(bDownLst1);
- forWMSLst.AddRange(bDownLst2);
- //D柱
- var lst1 = billLst.Take(12).ToList();
- var lst2 = billLst.Skip(12).ToList();
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左");
- List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1);
-
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
- List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
- reportMainLst.AddRange(dLst1);
- reportMainLst.AddRange(dLst2);
- forWMSLst.AddRange(forWMSLst1);
- forWMSLst.AddRange(forWMSLst2);
-
- //后轮,上装饰板
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
- List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
- List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(hsLst1);
- reportMainLst.AddRange(hsLst2);
- forWMSLst.AddRange(hsLst1);
- forWMSLst.AddRange(hsLst2);
-
- #region 调用库存接口
- //List forWMSLst = new List();
- //forWMSLst.AddRange(reportMainLst);
- //forWMSLst.AddRange(acLstOnlyWMSUse);
- CallWMSInterface_ZHB(forWMSLst);
- #endregion
+ // //A上C上
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
+ // List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
+ // if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
+ // {
+ // acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
+ // }
+ // reportMainLst.AddRange(acLst);
+ // forWMSLst.AddRange(acLstOnlyWMSUse);
+ // //A柱下,A中
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
+
+ // List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(aaLst1);
+ // reportMainLst.AddRange(aaLst2);
+ // forWMSLst.AddRange(aaLst1);
+ // forWMSLst.AddRange(aaLst2);
+ // //B柱上
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
+ // List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bUpLst1);
+ // reportMainLst.AddRange(bUpLst2);
+ // forWMSLst.AddRange(bUpLst1);
+ // forWMSLst.AddRange(bUpLst2);
+ // //B柱下
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
+
+ // List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bDownLst1);
+ // reportMainLst.AddRange(bDownLst2);
+ // forWMSLst.AddRange(bDownLst1);
+ // forWMSLst.AddRange(bDownLst2);
+ // //D柱
+ // var lst1 = billLst.Take(12).ToList();
+ // var lst2 = billLst.Skip(12).ToList();
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左");
+ // List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1);
+
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
+ // List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
+ // reportMainLst.AddRange(dLst1);
+ // reportMainLst.AddRange(dLst2);
+ // forWMSLst.AddRange(forWMSLst1);
+ // forWMSLst.AddRange(forWMSLst2);
+
+ // //后轮,上装饰板
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
+ // List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(hsLst1);
+ // reportMainLst.AddRange(hsLst2);
+ // forWMSLst.AddRange(hsLst1);
+ // forWMSLst.AddRange(hsLst2);
+
+ // #region 调用库存接口
+ // //List forWMSLst = new List();
+ // //forWMSLst.AddRange(reportMainLst);
+ // //forWMSLst.AddRange(acLstOnlyWMSUse);
+ // CallWMSInterface_ZHB(forWMSLst);
+ // #endregion
+
+ // //插入柱护板打印记录表
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var srcObj2 in reportMainLst)
+ // {
+ // srcObj2.SortId = sortId; //一次打印SortId相同
+ // var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
+ // }
- //插入柱护板打印记录表
- Guid sortId = GuidGenerator.Create();
- foreach (var srcObj2 in reportMainLst)
- {
- srcObj2.SortId = sortId; //一次打印SortId相同
- var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
- }
+ // ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
+ // var updIdLst = billLst.Select(itm => itm.Id).ToList();
+ // var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
+ // foreach (var updObj in updLst)
+ // {
+ // updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
+ // updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
+ // }
+ // await _billM100Repository.UpdateManyAsync(updLst, true);
+ // }
- ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
- var updIdLst = billLst.Select(itm => itm.Id).ToList();
- var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
- foreach (var updObj in updLst)
- {
- updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
- updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
- }
- await _billM100Repository.UpdateManyAsync(updLst, true);
- }
+ // #region 返回结果格式转换
+ // //实体 转 DTO
+ // List targetLst = ObjectMapper.Map, List>(reportMainLst);
+ // //补充空行
+ // foreach (var masterObj in targetLst)
+ // {
+ // int trueCnt = masterObj.Details.Count;
- #region 返回结果格式转换
- //实体 转 DTO
- List targetLst = ObjectMapper.Map, List>(reportMainLst);
- //补充空行
- foreach (var masterObj in targetLst)
- {
- int trueCnt = masterObj.Details.Count;
+ // int planCnt = 0;
+ // switch (masterObj.PartType)
+ // {
+ // case "A上C上":
+ // case "A柱下A中":
+ // case "B柱上":
+ // case "B柱下":
+ // case "后轮上装饰板":
+ // planCnt = 24;
+ // break;
+ // case "D柱":
+ // planCnt = 12;
+ // break;
+ // default:
+ // planCnt = 24;
+ // break;
+ // }
+ // if (trueCnt > planCnt)
+ // {
+ // throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
+ // }
+ // int diffCnt = planCnt - trueCnt;
+ // for (int i = 0; i < diffCnt; i++)
+ // {
+ // ZhuHuBanPackingRecDto dtlObj = new ZhuHuBanPackingRecDto();
+ // masterObj.Details.Add(dtlObj);
+ // }
+ // }
+ // //子表BillNum赋值, BillNum填充空格, SN赋值
+ // foreach (var masterObj in targetLst)
+ // {
+ // masterObj.BillNum = GetTrueString(masterObj.BillNum);
+ // int sn = 1;
+ // foreach (var detailObj in masterObj.Details)
+ // {
+ // detailObj.BillNum = masterObj.BillNum;
+ // detailObj.KNR = GetTrueString(detailObj.KNR);
+ // detailObj.KNR = detailObj.KNR.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("/n", "").Replace("/r", "");
+ // detailObj.sn = sn++;
+ // detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
+ // //客户要求显示零件描述,替换之前的零件编码
+ // detailObj.PartCode = detailObj.MaterialDescription;
+ // detailObj.PartCode2 = detailObj.MaterialDescription2;
+ // detailObj.MaterialDescription = null;
+ // detailObj.MaterialDescription2 = null;
+ // }
+ // }
- int planCnt = 0;
- switch (masterObj.PartType)
- {
- case "A上C上":
- case "A柱下A中":
- case "B柱上":
- case "B柱下":
- case "后轮上装饰板":
- planCnt = 24;
- break;
- case "D柱":
- planCnt = 12;
- break;
- default:
- planCnt = 24;
- break;
- }
- if (trueCnt > planCnt)
- {
- throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
- }
- int diffCnt = planCnt - trueCnt;
- for (int i = 0; i < diffCnt; i++)
- {
- ZhuHuBanPackingRecDto dtlObj = new ZhuHuBanPackingRecDto();
- masterObj.Details.Add(dtlObj);
- }
- }
- //子表BillNum赋值, BillNum填充空格, SN赋值
- foreach (var masterObj in targetLst)
- {
- masterObj.BillNum = GetTrueString(masterObj.BillNum);
- int sn = 1;
- foreach (var detailObj in masterObj.Details)
- {
- detailObj.BillNum = masterObj.BillNum;
- detailObj.KNR = GetTrueString(detailObj.KNR);
- detailObj.KNR = detailObj.KNR.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("/n", "").Replace("/r", "");
- detailObj.sn = sn++;
- detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
- //客户要求显示零件描述,替换之前的零件编码
- detailObj.PartCode = detailObj.MaterialDescription;
- detailObj.PartCode2 = detailObj.MaterialDescription2;
- detailObj.MaterialDescription = null;
- detailObj.MaterialDescription2 = null;
- }
- }
+ // retObj.MasterList_AC = targetLst.Where(itm => itm.PartType == "A上C上").ToList();
+ // if (retObj.MasterList_AC.Count == 0) retObj.IsVisibleAC = false;
+ // foreach (var masterObj in retObj.MasterList_AC)
+ // {
+ // retObj.DetailList_AC.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_AC = targetLst.Where(itm => itm.PartType == "A上C上").ToList();
- if (retObj.MasterList_AC.Count == 0) retObj.IsVisibleAC = false;
- foreach (var masterObj in retObj.MasterList_AC)
- {
- retObj.DetailList_AC.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_AA = targetLst.Where(itm => itm.PartType == "A柱下A中").ToList();
+ // if (retObj.MasterList_AA.Count == 0) retObj.IsVisibleAA = false;
+ // foreach (var masterObj in retObj.MasterList_AA)
+ // {
+ // retObj.DetailList_AA.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_AA = targetLst.Where(itm => itm.PartType == "A柱下A中").ToList();
- if (retObj.MasterList_AA.Count == 0) retObj.IsVisibleAA = false;
- foreach (var masterObj in retObj.MasterList_AA)
- {
- retObj.DetailList_AA.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_BS = targetLst.Where(itm => itm.PartType == "B柱上").ToList();
+ // if (retObj.MasterList_BS.Count == 0) retObj.IsVisibleBS = false;
+ // foreach (var masterObj in retObj.MasterList_BS)
+ // {
+ // retObj.DetailList_BS.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_BS = targetLst.Where(itm => itm.PartType == "B柱上").ToList();
- if (retObj.MasterList_BS.Count == 0) retObj.IsVisibleBS = false;
- foreach (var masterObj in retObj.MasterList_BS)
- {
- retObj.DetailList_BS.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_BX = targetLst.Where(itm => itm.PartType == "B柱下").ToList();
+ // if (retObj.MasterList_BX.Count == 0) retObj.IsVisibleBX = false;
+ // foreach (var masterObj in retObj.MasterList_BX)
+ // {
+ // retObj.DetailList_BX.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_BX = targetLst.Where(itm => itm.PartType == "B柱下").ToList();
- if (retObj.MasterList_BX.Count == 0) retObj.IsVisibleBX = false;
- foreach (var masterObj in retObj.MasterList_BX)
- {
- retObj.DetailList_BX.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_D = targetLst.Where(itm => itm.PartType == "D柱").ToList();
+ // if (retObj.MasterList_D.Count == 0) retObj.IsVisibleD = false;
+ // foreach (var masterObj in retObj.MasterList_D)
+ // {
+ // retObj.DetailList_D.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_D = targetLst.Where(itm => itm.PartType == "D柱").ToList();
- if (retObj.MasterList_D.Count == 0) retObj.IsVisibleD = false;
- foreach (var masterObj in retObj.MasterList_D)
- {
- retObj.DetailList_D.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
-
- retObj.MasterList_HL = targetLst.Where(itm => itm.PartType == "后轮上装饰板").ToList();
- if (retObj.MasterList_HL.Count == 0) retObj.IsVisibleHL = false;
- foreach (var masterObj in retObj.MasterList_HL)
- {
- retObj.DetailList_HL.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
- #endregion
- ret.Status = true;
- return ret;
- }
- catch (Exception ex)
- {
- string errorMsg = _errorMessagePrefix + "PrintZhuHuBanPackingList 执行出错:" + ex.Message;
- _logger.LogError(errorMsg);
- throw new BusinessException("1001", errorMsg);
- ret.Status = false;
- ret.Message = ex.Message;
- return ret;
- }
- }
-
- ///
- /// 相同VIN的左右SortId相同,用于作废
- ///
- ///
- ///
- //private void ModifySortId(List lst1, List lst2 = null)
- //{
- // Guid sortId = GuidGenerator.Create();
- // foreach (var itm in lst1)
- // {
- // itm.SortId = sortId;
- // }
- // if (lst2 != null)
- // {
- // foreach (var itm in lst2)
+ // retObj.MasterList_HL = targetLst.Where(itm => itm.PartType == "后轮上装饰板").ToList();
+ // if (retObj.MasterList_HL.Count == 0) retObj.IsVisibleHL = false;
+ // foreach (var masterObj in retObj.MasterList_HL)
// {
- // itm.SortId = sortId;
+ // retObj.DetailList_HL.AddRange(masterObj.Details);
+ // masterObj.Details = null;
// }
+ // #endregion
+ // ret.Status = true;
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // string errorMsg = _errorMessagePrefix + "PrintZhuHuBanPackingList 执行出错:" + ex.Message;
+ // _logger.LogError(errorMsg);
+ // throw new BusinessException("1001", errorMsg);
+ // ret.Status = false;
+ // ret.Message = ex.Message;
+ // return ret;
// }
//}
@@ -3064,56 +2920,56 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
///
/// 输入查询条件
/// 返回符合条件的排序分页列表
- [HttpGet]
- [UnitOfWork(false)]
- [Route("replenish-print-list")]
- public virtual async Task> GetReplenishPrintListAsync(QueryBillM100Dto input)
- {
- _logger.LogDebug(_errorMessagePrefix + "GetReplenishPrintListAsync 进入");
- try
- {
- input.CanNotPrint = null; //忽略不能打印
- input.ZHBBillStatus = null;
- input.BillStatus = BillStatusEnum.Match; //单据状态是已解析未打印
- input.IsNeedReplenishPrint = true; //只显示需要补打的记录
- PagedResultDto ret = await QueryByConditionAsync(input, (PagedAndSortedBase)input);
- return ret;
- }
- catch (Exception ex)
- {
- string errMsg = _errorMessagePrefix + "GetReplenishPrintListAsync 执行出错:" + ex.Message;
- _logger.LogError(errMsg);
- return new PagedResultDto(0, new List());
- }
- }
+ //[HttpGet]
+ //[UnitOfWork(false)]
+ //[Route("replenish-print-list")]
+ //public virtual async Task> GetReplenishPrintListAsync(QueryBillM100Dto input)
+ //{
+ // _logger.LogDebug(_errorMessagePrefix + "GetReplenishPrintListAsync 进入");
+ // try
+ // {
+ // input.CanNotPrint = null; //忽略不能打印
+ // input.ZHBBillStatus = null;
+ // input.BillStatus = BillStatusEnum.Match; //单据状态是已解析未打印
+ // input.IsNeedReplenishPrint = true; //只显示需要补打的记录
+ // PagedResultDto ret = await QueryByConditionAsync(input, (PagedAndSortedBase)input);
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // string errMsg = _errorMessagePrefix + "GetReplenishPrintListAsync 执行出错:" + ex.Message;
+ // _logger.LogError(errMsg);
+ // return new PagedResultDto(0, new List());
+ // }
+ //}
///
/// 取柱护板补打列表(IsNeedReplenishPrint=true、单据状态BillStatus是未打印)
///
/// 输入查询条件
/// 返回符合条件的排序分页列表
- [HttpGet]
- [UnitOfWork(false)]
- [Route("replenish-print-zhb-list")]
- public virtual async Task> GetReplenishPrintZHBListAsync(QueryBillM100Dto input)
- {
- _logger.LogDebug(_errorMessagePrefix + "GetReplenishPrintZHBListAsync 进入");
- try
- {
- input.CanNotPrint = null; //忽略不能打印
- input.BillStatus = null;
- input.ZHBBillStatus = ZHBBillStatusEnum.NotPrint; //柱护板状态是已解析未打印
- input.IsNeedReplenishPrint = true; //只显示需要补打的记录
- PagedResultDto ret = await QueryZHBByConditionAsync(input, (PagedAndSortedBase)input);
- return ret;
- }
- catch (Exception ex)
- {
- string errMsg = _errorMessagePrefix + "GetReplenishPrintZHBListAsync 执行出错:" + ex.Message;
- _logger.LogError(errMsg);
- return new PagedResultDto(0, new List());
- }
- }
+ //[HttpGet]
+ //[UnitOfWork(false)]
+ //[Route("replenish-print-zhb-list")]
+ //public virtual async Task> GetReplenishPrintZHBListAsync(QueryBillM100Dto input)
+ //{
+ // _logger.LogDebug(_errorMessagePrefix + "GetReplenishPrintZHBListAsync 进入");
+ // try
+ // {
+ // input.CanNotPrint = null; //忽略不能打印
+ // input.BillStatus = null;
+ // input.ZHBBillStatus = ZHBBillStatusEnum.NotPrint; //柱护板状态是已解析未打印
+ // input.IsNeedReplenishPrint = true; //只显示需要补打的记录
+ // PagedResultDto ret = await QueryZHBByConditionAsync(input, (PagedAndSortedBase)input);
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // string errMsg = _errorMessagePrefix + "GetReplenishPrintZHBListAsync 执行出错:" + ex.Message;
+ // _logger.LogError(errMsg);
+ // return new PagedResultDto(0, new List());
+ // }
+ //}
#endregion
@@ -3395,7 +3251,7 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
public virtual async Task>> SaveMenBanReport(MenBanPrintInputDto input)
{
Stopwatch sw = new Stopwatch();
- sw.Start();
+
_logger.LogDebug(_errorMessagePrefix + "SaveMenBanReport 进入");
List retLst = new List();
@@ -3427,60 +3283,48 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
ret.Status = false;
return ret;
}
- sw.Stop();
+
_logger.LogWarning($"SaveMenBanReport读取数据 - {sw.ElapsedMilliseconds}毫秒");
- sw.Start();
+
int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
- double maxBillNum = 0;
+ //double maxBillNum = 0;
+
+ //DateTime printTime = ServerHelper.CurrentDateTime;
- DateTime printTime = ServerHelper.CurrentDateTime;
+ var reportSortDic = _dicItemRepository
+ .Where(itm => itm.DicTypeCode == "零件大类" && itm.DicItemSort2 == input.ProductLine)
+ .ToList()
+ .GroupBy(itm => itm.DicItemSort4)
+ .ToDictionary(itm => itm.Key, it2 => it2.Select(itm => itm.DicItemCode).ToArray());
for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
{
- //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
- double maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
- // 先打印两张:左后左前,再打印两张:右后右前
- List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
- List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
-
- //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
- Guid sortId = GuidGenerator.Create();
- foreach (var leftItm in leftLst)
- {
- leftItm.SortId = sortId;
- }
- foreach (var rightItm in rightLst)
+
+ foreach (var reportSortItem in reportSortDic)
{
- rightItm.SortId = sortId;
- }
+ //生成顺序号:按生产线分组,取当前生产线的最大流水号:001至999往复循环
+ double maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
- reportMainLst.AddRange(rightLst);
- reportMainLst.AddRange(leftLst);
+ MenBanPackingList packingObj = DoMBPrint(input, pageIdx, maxSN, billLst, reportSortItem.Key, reportSortItem.Value);
+ reportMainLst.Add(packingObj);
+ }
}
- sw.Stop();
+
_logger.LogWarning($"SaveMenBanReport转换数据 - {sw.ElapsedMilliseconds}毫秒");
- sw.Start();
+
//插入门板打印记录表
await _menBanPackingListRepository.InsertManyAsync(reportMainLst, true);
retLst.AddRange(reportMainLst.Select(itm => itm.Id));
- //foreach (var reportMainObj in reportMainLst)
- //{
- // var insObj = await _menBanPackingListRepository.InsertAsync(reportMainObj, true);
- // if (insObj != null)
- // {
- // retLst.Add(insObj.Id);
- // }
- //}
- sw.Stop();
+
_logger.LogWarning($"SaveMenBanReport插入门板打印记录表 - {sw.ElapsedMilliseconds}毫秒");
- sw.Start();
+
//调用派格版库存接口
- await SaveMiddleTable_MB(reportMainLst);
- sw.Stop();
+ //await SaveMiddleTable_MB(reportMainLst);
+
_logger.LogWarning($"SaveMenBanReport插入中间表 - {sw.ElapsedMilliseconds}毫秒");
- sw.Start();
+
//更新M100的门板打印标志:BillStatus=3
foreach (BillM100 billObj in billLst)
@@ -3499,103 +3343,103 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
await _billM100Repository.UpdateAsync(billObj, true);
}
}
- sw.Stop();
+
_logger.LogWarning($"SaveMenBanReport更新M100的门板打印标志 - {sw.ElapsedMilliseconds}毫秒");
}
- else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
- {
- throw new BusinessException("请调用LoadMenBanReport方法!");
- }
- else if (input.PrintType == PrintTypeEnum.补打)
- {
- List billLst = _billM100Repository.Where(itm => input.M100IdList.Contains(itm.Id)).OrderBy(itm => itm.SerialNumStr).ToList();
- if (billLst.Count == 0)
- {
- ret.Message = "没有补打的单据,请先选择要补打的单据!";
- ret.Status = false;
- return ret;
- }
-
- int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
-
- double maxBillNum = 0;
-
- DateTime printTime = ServerHelper.CurrentDateTime;
-
- for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
- {
- //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
- double maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
- // 先打印两张:左后左前,再打印两张:右后右前
- List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
- List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
-
- //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
- Guid sortId = GuidGenerator.Create();
- foreach (var leftItm in leftLst)
- {
- leftItm.SortId = sortId;
- }
- foreach (var rightItm in rightLst)
- {
- rightItm.SortId = sortId;
- }
-
- reportMainLst.AddRange(rightLst);
- reportMainLst.AddRange(leftLst);
- }
- //校验底盘号、零件是否重复打印
- string checkVinPartRepeatSql = @"
- select top 1 a.BillNum from FisMenBanPackingList a join FisMenBanPackingRec b
- on a.Id = b.MenBanPackingListId
- where a.ReportStatus = 0
- and b.VIN = '{0}' and (TopSAPMaterialNum = '{1}' or BelowSAPMaterialNum = '{1}')
- ";
- foreach (MenBanPackingList reportMainObj in reportMainLst)
- {
- foreach (MenBanPackingRec reportRecObj in reportMainObj.Details)
- {
- string sql1 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.TopSAPMaterialNum);
- string checkVinPartRepeatBillNum1 = _newJitDapperRepository.GetSingleBySql(sql1, true);
- if (string.IsNullOrEmpty(checkVinPartRepeatBillNum1) == false)
- {
- throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum1}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.TopSAPMaterialNum}之间重复!");
- }
-
- string sql2 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.BelowSAPMaterialNum);
- string checkVinPartRepeatBillNum2 = _newJitDapperRepository.GetSingleBySql(sql2, true);
- if (string.IsNullOrEmpty(checkVinPartRepeatBillNum2) == false)
- {
- throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum2}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.BelowSAPMaterialNum}之间重复!");
- }
- }
- }
-
- //调用派格版库存接口
- await SaveMiddleTable_MB(reportMainLst);
-
- //插入门板打印记录表
- //await _menBanPackingListRepository.InsertManyAsync(reportMainLst);
- foreach (var reportMainObj in reportMainLst)
- {
- var insObj = await _menBanPackingListRepository.InsertAsync(reportMainObj, true);
- if (insObj != null)
- {
- retLst.Add(insObj.Id);
- }
- }
- //更新M100的门板打印标志:BillStatus=3
- foreach (BillM100 billObj in billLst)
- {
- if (billObj.BillStatus == BillStatusEnum.Match)
- {
- billObj.SetBillStatus(BillStatusEnum.Publish);
- billObj.PrintTime = ServerHelper.CurrentDateTime;
- await _billM100Repository.UpdateAsync(billObj);
- }
- }
- } //补打if
+ //else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
+ //{
+ // throw new BusinessException("请调用LoadMenBanReport方法!");
+ //}
+ //else if (input.PrintType == PrintTypeEnum.补打)
+ //{
+ // List billLst = _billM100Repository.Where(itm => input.M100IdList.Contains(itm.Id)).OrderBy(itm => itm.SerialNumStr).ToList();
+ // if (billLst.Count == 0)
+ // {
+ // ret.Message = "没有补打的单据,请先选择要补打的单据!";
+ // ret.Status = false;
+ // return ret;
+ // }
+
+ // int pageCnt = (int)Math.Ceiling(billLst.Count / 12.0); //每页打印12列,取打印页数
+
+ // double maxBillNum = 0;
+
+ // DateTime printTime = ServerHelper.CurrentDateTime;
+
+ // for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
+ // {
+ // //取右上角顺序号:按生产线分组,取当前生产线的最大流水号:01至99循环,例如01左、01右
+ // double maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.门板, input.ProductLine, string.Empty);
+ // // 先打印两张:左后左前,再打印两张:右后右前
+ // List leftLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "左");
+ // List rightLst = DoMBPrint(input, pageIdx, ref maxBillNum, maxSN, printTime, billLst, "右");
+
+ // //作废时需要同时作废相同VIN的左右两页,SortId相同表示是同一组左右
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var leftItm in leftLst)
+ // {
+ // leftItm.SortId = sortId;
+ // }
+ // foreach (var rightItm in rightLst)
+ // {
+ // rightItm.SortId = sortId;
+ // }
+
+ // reportMainLst.AddRange(rightLst);
+ // reportMainLst.AddRange(leftLst);
+ // }
+ // //校验底盘号、零件是否重复打印
+ // string checkVinPartRepeatSql = @"
+ // select top 1 a.BillNum from FisMenBanPackingList a join FisMenBanPackingRec b
+ // on a.Id = b.MenBanPackingListId
+ // where a.ReportStatus = 0
+ // and b.VIN = '{0}' and (TopSAPMaterialNum = '{1}' or BelowSAPMaterialNum = '{1}')
+ // ";
+ // foreach (MenBanPackingList reportMainObj in reportMainLst)
+ // {
+ // foreach (MenBanPackingRec reportRecObj in reportMainObj.Details)
+ // {
+ // string sql1 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.PartCode2);
+ // string checkVinPartRepeatBillNum1 = _newJitDapperRepository.GetSingleBySql(sql1, true);
+ // if (string.IsNullOrEmpty(checkVinPartRepeatBillNum1) == false)
+ // {
+ // throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum1}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.PartCode2}之间重复!");
+ // }
+
+ // string sql2 = string.Format(checkVinPartRepeatSql, reportRecObj.VIN, reportRecObj.PartCode4);
+ // string checkVinPartRepeatBillNum2 = _newJitDapperRepository.GetSingleBySql(sql2, true);
+ // if (string.IsNullOrEmpty(checkVinPartRepeatBillNum2) == false)
+ // {
+ // throw new BusinessException("1001", $"与装箱单号{checkVinPartRepeatBillNum2}中的底盘号{reportRecObj.VIN}、零件号{reportRecObj.PartCode4}之间重复!");
+ // }
+ // }
+ // }
+
+ // //调用派格版库存接口
+ // await SaveMiddleTable_MB(reportMainLst);
+
+ // //插入门板打印记录表
+ // //await _menBanPackingListRepository.InsertManyAsync(reportMainLst);
+ // foreach (var reportMainObj in reportMainLst)
+ // {
+ // var insObj = await _menBanPackingListRepository.InsertAsync(reportMainObj, true);
+ // if (insObj != null)
+ // {
+ // retLst.Add(insObj.Id);
+ // }
+ // }
+ // //更新M100的门板打印标志:BillStatus=3
+ // foreach (BillM100 billObj in billLst)
+ // {
+ // if (billObj.BillStatus == BillStatusEnum.Match)
+ // {
+ // billObj.SetBillStatus(BillStatusEnum.Publish);
+ // billObj.PrintTime = ServerHelper.CurrentDateTime;
+ // await _billM100Repository.UpdateAsync(billObj);
+ // }
+ // }
+ //} //补打if
await uow.CompleteAsync();
ret.Status = true;
ret.Item = retLst;
@@ -3616,13 +3460,10 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
[UnitOfWork]
[HttpPost]
[Route("load-menban-report")]
- public virtual async Task> LoadMenBanReport(List input)
+ public virtual async Task> LoadMenBanReport(List input)
{
_logger.LogDebug(_errorMessagePrefix + "LoadMenBanReport 进入");
- MenBanPrintResultDto retObj = new MenBanPrintResultDto();
- ObjectResultDto ret = new ObjectResultDto(retObj);
- ret.Status = false;
try
{
List reportMainLst = new List();
@@ -3668,22 +3509,6 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
List targetLst = ObjectMapper.Map, List>(reportMainLst);
targetLst = targetLst.OrderBy(itm => itm.BillNum).ToList();
- //补充空行
- foreach (var masterObj in targetLst)
- {
- int trueCnt = masterObj.Details.Count;
- int planCnt = 12;
- if (trueCnt > planCnt)
- {
- throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
- }
- int diffCnt = planCnt - trueCnt;
- for (int i = 0; i < diffCnt; i++)
- {
- MenBanPackingRecDto dtlObj = new MenBanPackingRecDto();
- masterObj.Details.Add(dtlObj);
- }
- }
//子表BillNum赋值, BillNum填充空格
foreach (var masterObj in targetLst)
{
@@ -3693,1571 +3518,1571 @@ select min(SerialNumStr) from FisBillM100 a left join d on a.VIN=d.VIN
{
detailObj.BillNum = masterObj.BillNum;
detailObj.KNR = GetTrueString(detailObj.KNR);
- detailObj.sn = sn++;
+ detailObj.SN = (sn++).ToString();
detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
}
}
- //返回结果格式转换
- foreach (var masterObj in targetLst)
- {
- foreach (var detailObj in masterObj.Details)
- {
- retObj.DetailList.Add(detailObj);
- }
- masterObj.Details = null;
- retObj.MasterList.Add(masterObj);
- }
#endregion
- ret.Status = true;
- return ret;
+ return targetLst;
}
catch (Exception ex)
{
string errorMsg = _errorMessagePrefix + "LoadMenBanReport 执行出错:" + ex.Message;
_logger.LogError(errorMsg);
- ret.Status = false;
- ret.Message = ex.Message;
- return ret;
+ throw new UserFriendlyException(errorMsg);
}
}
-
-
+ private static string GetTrueString(string str)
+ {
+ return str == null ? " " : str.Trim(); ;
+ }
///
/// 打印柱护板装箱单
///
///
/// 执行成功返回真
- [UnitOfWork]
- [HttpPost]
- [Route("print-group-zhuhuban-packing-list")]
- public virtual async Task> PrintGroupZhuHuBanPackingList(ZhuHuBanPrintInputDto input)
- {
- ZhuHuBanPrintResultDto retObj = new ZhuHuBanPrintResultDto();
- ObjectResultDto ret = new ObjectResultDto(retObj);
- ret.Status = false;
- try
- {
- List reportMainLst = new List();
- List forWMSLst = new List();
+ //[UnitOfWork]
+ //[HttpPost]
+ //[Route("print-group-zhuhuban-packing-list")]
+ //public virtual async Task> PrintGroupZhuHuBanPackingList(ZhuHuBanPrintInputDto input)
+ //{
+ // throw new NotImplementedException();
+ // ZhuHuBanPrintResultDto retObj = new ZhuHuBanPrintResultDto();
+ // ObjectResultDto ret = new ObjectResultDto(retObj);
+ // ret.Status = false;
+ // try
+ // {
+ // List reportMainLst = new List();
+ // List forWMSLst = new List();
- if (input.PrintType == PrintTypeEnum.正常打印)
- {
- if (input.BeginHostSN > input.EndHostSN)
- {
- ret.Message = "起大众顺序号不能大于止大众顺序号!";
- ret.Status = false;
- return ret;
- }
- ListResultDto tempLst = await GetZHBReportDetailList(input, true); //-------------------
- List billLst = tempLst.Item;
- if (tempLst.Status == false)
- {
- ret.Message = tempLst.Message;
- ret.Status = false;
- return ret;
- }
- if (billLst.Count > 24)
- {
- ret.Message = "打印柱护板单据的数量不能大于24!";
- ret.Status = false;
- return ret;
- }
- //加载柱护板缓存列表
- _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
+ // if (input.PrintType == PrintTypeEnum.正常打印)
+ // {
+ // if (input.BeginHostSN > input.EndHostSN)
+ // {
+ // ret.Message = "起大众顺序号不能大于止大众顺序号!";
+ // ret.Status = false;
+ // return ret;
+ // }
- long maxBillNum = 0; //子方法内部赋值
- DateTime printTime = ServerHelper.CurrentDateTime;
- double maxSN;
+ // ListResultDto tempLst = await GetZHBReportDetailList(input, true); //-------------------
+ // List billLst = tempLst.Item;
+ // if (tempLst.Status == false)
+ // {
+ // ret.Message = tempLst.Message;
+ // ret.Status = false;
+ // return ret;
+ // }
+ // if (billLst.Count > 24)
+ // {
+ // ret.Message = "打印柱护板单据的数量不能大于24!";
+ // ret.Status = false;
+ // return ret;
+ // }
+ // //加载柱护板缓存列表
+ // _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
- //获取当前打印柱护板的零件类型
- var partTypes = await _printTemplateConfigurationRepository.GetListAsync(r => r.GroupName == input.GroupName);
- foreach (var partType in partTypes)
- {
- switch (partType.PartType)
- {
- case "A上C上":
- //A上C上
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
- List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
- if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
- {
- acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
- }
- reportMainLst.AddRange(acLst);
- forWMSLst.AddRange(acLstOnlyWMSUse);
- break;
- case "A柱下A中":
- //A柱下,A中
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
+ // long maxBillNum = 0; //子方法内部赋值
+ // DateTime printTime = ServerHelper.CurrentDateTime;
+ // double maxSN;
- List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
- List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(aaLst1);
- reportMainLst.AddRange(aaLst2);
- forWMSLst.AddRange(aaLst1);
- forWMSLst.AddRange(aaLst2);
+ // //获取当前打印柱护板的零件类型
+ // var partTypes = await _printTemplateConfigurationRepository.GetListAsync(r => r.GroupName == input.GroupName);
+ // foreach (var partType in partTypes)
+ // {
+ // switch (partType.PartType)
+ // {
+ // case "A上C上":
+ // //A上C上
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
+ // List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
+ // if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
+ // {
+ // acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
+ // }
+ // reportMainLst.AddRange(acLst);
+ // forWMSLst.AddRange(acLstOnlyWMSUse);
+ // break;
+ // case "A柱下A中":
+ // //A柱下,A中
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
+
+ // List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(aaLst1);
+ // reportMainLst.AddRange(aaLst2);
+ // forWMSLst.AddRange(aaLst1);
+ // forWMSLst.AddRange(aaLst2);
+
+ // break;
+ // case "B柱上":
+ // //B柱上
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
+ // List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bUpLst1);
+ // reportMainLst.AddRange(bUpLst2);
+ // forWMSLst.AddRange(bUpLst1);
+ // forWMSLst.AddRange(bUpLst2);
+ // break;
+ // case "B柱下":
+ // //B柱下
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
+
+ // List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bDownLst1);
+ // reportMainLst.AddRange(bDownLst2);
+ // forWMSLst.AddRange(bDownLst1);
+ // forWMSLst.AddRange(bDownLst2);
+ // break;
+ // case "D柱":
+ // //D柱
+ // var lst1 = billLst.Take(12).ToList();
+ // var lst2 = billLst.Skip(12).ToList();
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左"); //左用于打印
+ // List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1); //左右用于库存接口
+
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
+ // List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
+ // reportMainLst.AddRange(dLst1);
+ // reportMainLst.AddRange(dLst2);
+ // forWMSLst.AddRange(forWMSLst1);
+ // forWMSLst.AddRange(forWMSLst2);
+ // break;
+ // case "后轮上装饰板":
+ // //后轮,上装饰板
+ // maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
+ // List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(hsLst1);
+ // reportMainLst.AddRange(hsLst2);
+ // forWMSLst.AddRange(hsLst1);
+ // forWMSLst.AddRange(hsLst2);
+ // break;
+ // }
+ // }
- break;
- case "B柱上":
- //B柱上
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
- List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bUpLst1);
- reportMainLst.AddRange(bUpLst2);
- forWMSLst.AddRange(bUpLst1);
- forWMSLst.AddRange(bUpLst2);
- break;
- case "B柱下":
- //B柱下
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
-
- List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bDownLst1);
- reportMainLst.AddRange(bDownLst2);
- forWMSLst.AddRange(bDownLst1);
- forWMSLst.AddRange(bDownLst2);
- break;
- case "D柱":
- //D柱
- var lst1 = billLst.Take(12).ToList();
- var lst2 = billLst.Skip(12).ToList();
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左"); //左用于打印
- List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1); //左右用于库存接口
-
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
- List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
- reportMainLst.AddRange(dLst1);
- reportMainLst.AddRange(dLst2);
- forWMSLst.AddRange(forWMSLst1);
- forWMSLst.AddRange(forWMSLst2);
- break;
- case "后轮上装饰板":
- //后轮,上装饰板
- maxSN = await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
- List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
- List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(hsLst1);
- reportMainLst.AddRange(hsLst2);
- forWMSLst.AddRange(hsLst1);
- forWMSLst.AddRange(hsLst2);
- break;
- }
- }
+ // #region 调用库存接口
+ // //List forWMSLst = new List();
+ // //forWMSLst.AddRange(reportMainLst);
+ // //forWMSLst.AddRange(acLstOnlyWMSUse);
+ // CallWMSInterface_ZHB(forWMSLst);
+ // #endregion
- #region 调用库存接口
- //List forWMSLst = new List();
- //forWMSLst.AddRange(reportMainLst);
- //forWMSLst.AddRange(acLstOnlyWMSUse);
- CallWMSInterface_ZHB(forWMSLst);
- #endregion
+ // //插入柱护板打印记录表
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var srcObj2 in reportMainLst)
+ // {
+ // srcObj2.SortId = sortId; //一次打印SortId相同
+ // var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
+ // }
- //插入柱护板打印记录表
- Guid sortId = GuidGenerator.Create();
- foreach (var srcObj2 in reportMainLst)
- {
- srcObj2.SortId = sortId; //一次打印SortId相同
- var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
- }
+ // ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
+ // var updIdLst = billLst.Select(itm => itm.Id).ToList();
+ // var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
+ // foreach (var updObj in updLst)
+ // {
+ // updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
+ // updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
+ // }
+ // await _billM100Repository.UpdateManyAsync(updLst, true);
- ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
- var updIdLst = billLst.Select(itm => itm.Id).ToList();
- var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
- foreach (var updObj in updLst)
- {
- updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
- updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
- }
- await _billM100Repository.UpdateManyAsync(updLst, true);
+ // }
+ // else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
+ // {
+ // if (input.DataResultType == "1") //全部11条数据
+ // {
+ // var firObj = await _zhuHuBanPackingListRepository.FirstOrDefaultAsync(itm => input.ReportIdList.Contains(itm.Id));
+ // if (firObj != null)
+ // {
+ // Guid? sortId = firObj.SortId;
+ // reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => itm.SortId == sortId, true);
+ // }
+ // }
+ // else
+ // {
+ // reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
+ // }
- }
- else if (input.PrintType == PrintTypeEnum.重新打印) //和正常打印单据完全一样,可以打印部分单据
- {
- if (input.DataResultType == "1") //全部11条数据
- {
- var firObj = await _zhuHuBanPackingListRepository.FirstOrDefaultAsync(itm => input.ReportIdList.Contains(itm.Id));
- if (firObj != null)
- {
- Guid? sortId = firObj.SortId;
- reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => itm.SortId == sortId, true);
- }
- }
- else
- {
- reportMainLst = await _zhuHuBanPackingListRepository.GetListAsync(itm => input.ReportIdList.Contains(itm.Id), true);
- }
+ // //按大众顺序号排序
+ // foreach (var reportMainObj in reportMainLst)
+ // {
+ // List recLst = reportMainObj.Details;
+ // if (recLst == null)
+ // continue;
+ // //bool has1999 = recLst.Any(itm => itm.HostSN.ToString().Contains("1999") || itm.HostSN.ToString().Contains("1998"));
+ // //bool has0001 = recLst.Any(itm => itm.HostSN.ToString().Contains("0001") || itm.HostSN.ToString().Contains("0002"));
+ // bool has1999 = recLst.Any(itm => (itm.HostSN % 10000) >= 1977);
+ // bool has0001 = recLst.Any(itm => (itm.HostSN % 10000) <= 23);
+ // if (has1999 && has0001)
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN % 10000) <= 23 ? (itm.HostSN % 10000 + 1999) : (itm.HostSN % 10000)).ToList();
+ // }
+ // else
+ // {
+ // reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
+ // }
+ // }
+ // }
+ // else if (input.PrintType == PrintTypeEnum.补打)
+ // {
+ // if (input.M100IdList.Count > 24)
+ // {
+ // throw new BusinessException("1001", $"选中的柱护板补打不能超过24个底盘!");
+ // }
- //按大众顺序号排序
- foreach (var reportMainObj in reportMainLst)
- {
- List recLst = reportMainObj.Details;
- if (recLst == null)
- continue;
- //bool has1999 = recLst.Any(itm => itm.HostSN.ToString().Contains("1999") || itm.HostSN.ToString().Contains("1998"));
- //bool has0001 = recLst.Any(itm => itm.HostSN.ToString().Contains("0001") || itm.HostSN.ToString().Contains("0002"));
- bool has1999 = recLst.Any(itm => (itm.HostSN % 10000) >= 1977);
- bool has0001 = recLst.Any(itm => (itm.HostSN % 10000) <= 23);
- if (has1999 && has0001)
- {
- reportMainObj.Details = recLst.OrderBy(itm => (itm.HostSN % 10000) <= 23 ? (itm.HostSN % 10000 + 1999) : (itm.HostSN % 10000)).ToList();
- }
- else
- {
- reportMainObj.Details = recLst.OrderBy(itm => itm.HostSN).ToList();
- }
- }
- }
- else if (input.PrintType == PrintTypeEnum.补打)
- {
- if (input.M100IdList.Count > 24)
- {
- throw new BusinessException("1001", $"选中的柱护板补打不能超过24个底盘!");
- }
+ // List billLst = _billM100Repository.GetListAsync(itm => input.M100IdList.Contains(itm.Id), true).GetAwaiter().GetResult();
+ // if (billLst.Count == 0)
+ // {
+ // ret.Message = "没有补打的柱护板,请先选择要补打的柱护板!";
+ // ret.Status = false;
+ // return ret;
+ // }
+ // billLst = billLst.OrderBy(itm => itm.SerialNumStr).ToList();
- List billLst = _billM100Repository.GetListAsync(itm => input.M100IdList.Contains(itm.Id), true).GetAwaiter().GetResult();
- if (billLst.Count == 0)
- {
- ret.Message = "没有补打的柱护板,请先选择要补打的柱护板!";
- ret.Status = false;
- return ret;
- }
- billLst = billLst.OrderBy(itm => itm.SerialNumStr).ToList();
+ // //加载柱护板缓存列表
+ // _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
- //加载柱护板缓存列表
- _zhbCacheList = _materialExtRepository.Where(itm => itm.MaterialType == "2").ToList(); //取柱护板零件
+ // long maxBillNum = 0; //全局唯一装箱单号
+ // DateTime printTime = ServerHelper.CurrentDateTime;
+ // double maxSN; //右上角顺序号01-99
- long maxBillNum = 0; //全局唯一装箱单号
- DateTime printTime = ServerHelper.CurrentDateTime;
- double maxSN; //右上角顺序号01-99
+ // //A上C上
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
+ // List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
+ // if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
+ // {
+ // acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
+ // }
+ // reportMainLst.AddRange(acLst);
+ // forWMSLst.AddRange(acLstOnlyWMSUse);
+ // //A柱下,A中
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
+
+ // List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(aaLst1);
+ // reportMainLst.AddRange(aaLst2);
+ // forWMSLst.AddRange(aaLst1);
+ // forWMSLst.AddRange(aaLst2);
+ // //B柱上
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
+ // List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bUpLst1);
+ // reportMainLst.AddRange(bUpLst2);
+ // forWMSLst.AddRange(bUpLst1);
+ // forWMSLst.AddRange(bUpLst2);
+ // //B柱下
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
+
+ // List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(bDownLst1);
+ // reportMainLst.AddRange(bDownLst2);
+ // forWMSLst.AddRange(bDownLst1);
+ // forWMSLst.AddRange(bDownLst2);
+ // //D柱
+ // var lst1 = billLst.Take(12).ToList();
+ // var lst2 = billLst.Skip(12).ToList();
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左");
+ // List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1);
+
+ // maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
+ // List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
+ // List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
+ // reportMainLst.AddRange(dLst1);
+ // reportMainLst.AddRange(dLst2);
+ // forWMSLst.AddRange(forWMSLst1);
+ // forWMSLst.AddRange(forWMSLst2);
+
+ // //后轮,上装饰板
+ // maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
+ // List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
+ // List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
+ // reportMainLst.AddRange(hsLst1);
+ // reportMainLst.AddRange(hsLst2);
+ // forWMSLst.AddRange(hsLst1);
+ // forWMSLst.AddRange(hsLst2);
+
+ // #region 调用库存接口
+ // //List forWMSLst = new List();
+ // //forWMSLst.AddRange(reportMainLst);
+ // //forWMSLst.AddRange(acLstOnlyWMSUse);
+ // CallWMSInterface_ZHB(forWMSLst);
+ // #endregion
+
+ // //插入柱护板打印记录表
+ // Guid sortId = GuidGenerator.Create();
+ // foreach (var srcObj2 in reportMainLst)
+ // {
+ // srcObj2.SortId = sortId; //一次打印SortId相同
+ // var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
+ // }
- //A上C上
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A上C上");
- List acLst = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List acLstOnlyWMSUse = DoZHBPrint_3x8_LRMerge("A上C上", input, maxBillNum, maxSN, printTime, billLst, "右"); //仅库存系统接口使用,打印记录表不保存
- if (acLstOnlyWMSUse.Count > 0 && acLst.Count > 0)
- {
- acLstOnlyWMSUse[0].Details.InsertRange(0, acLst[0].Details); //右插入左
- }
- reportMainLst.AddRange(acLst);
- forWMSLst.AddRange(acLstOnlyWMSUse);
- //A柱下,A中
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "A柱下A中");
-
- List aaLst1 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "左");
- List aaLst2 = DoZHBPrint_3x8_LR("A柱下A中", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(aaLst1);
- reportMainLst.AddRange(aaLst2);
- forWMSLst.AddRange(aaLst1);
- forWMSLst.AddRange(aaLst2);
- //B柱上
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱上");
- List bUpLst1 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bUpLst2 = DoZHBPrint_4x6_LR("B柱上", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bUpLst1);
- reportMainLst.AddRange(bUpLst2);
- forWMSLst.AddRange(bUpLst1);
- forWMSLst.AddRange(bUpLst2);
- //B柱下
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "B柱下");
-
- List bDownLst1 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "左");
- List bDownLst2 = DoZHBPrint_4x6_LR("B柱下", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(bDownLst1);
- reportMainLst.AddRange(bDownLst2);
- forWMSLst.AddRange(bDownLst1);
- forWMSLst.AddRange(bDownLst2);
- //D柱
- var lst1 = billLst.Take(12).ToList();
- var lst2 = billLst.Skip(12).ToList();
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1, "左");
- List forWMSLst1 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst1);
-
- maxBillNum = _sequenceDomainService.GetSequence(SequenceTypeEnum.门板及柱护板装箱单号);
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "D柱");
- List dLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2, "左");
- List forWMSLst2 = DoZHBPrint_4x3("D柱", input, maxBillNum, maxSN, printTime, lst2);
- reportMainLst.AddRange(dLst1);
- reportMainLst.AddRange(dLst2);
- forWMSLst.AddRange(forWMSLst1);
- forWMSLst.AddRange(forWMSLst2);
-
- //后轮,上装饰板
- maxSN = 0; // await _lineSNDomianService.GetMaxSN(ProductTypeEnum.柱护板, input.ProductLine, "后轮上装饰板");
- List hsLst1 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "左");
- List hsLst2 = DoZHBPrint_4x6_LR("后轮上装饰板", input, maxBillNum, maxSN, printTime, billLst, "右");
- reportMainLst.AddRange(hsLst1);
- reportMainLst.AddRange(hsLst2);
- forWMSLst.AddRange(hsLst1);
- forWMSLst.AddRange(hsLst2);
-
- #region 调用库存接口
- //List forWMSLst = new List();
- //forWMSLst.AddRange(reportMainLst);
- //forWMSLst.AddRange(acLstOnlyWMSUse);
- CallWMSInterface_ZHB(forWMSLst);
- #endregion
+ // ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
+ // var updIdLst = billLst.Select(itm => itm.Id).ToList();
+ // var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
+ // foreach (var updObj in updLst)
+ // {
+ // updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
+ // updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
+ // }
+ // await _billM100Repository.UpdateManyAsync(updLst, true);
+ // }
- //插入柱护板打印记录表
- Guid sortId = GuidGenerator.Create();
- foreach (var srcObj2 in reportMainLst)
- {
- srcObj2.SortId = sortId; //一次打印SortId相同
- var ret22 = await _zhuHuBanPackingListRepository.InsertAsync(srcObj2, true);
- }
+ // #region 返回结果格式转换
+ // //实体 转 DTO
+ // List targetLst = ObjectMapper.Map, List>(reportMainLst);
+ // //补充空行
+ // foreach (var masterObj in targetLst)
+ // {
+ // int trueCnt = masterObj.Details.Count;
- ////更新M100的柱护板打印标志: PrintBillNum不为空时表示已打印
- var updIdLst = billLst.Select(itm => itm.Id).ToList();
- var updLst = await _billM100Repository.GetListAsync(itm => updIdLst.Contains(itm.Id));
- foreach (var updObj in updLst)
- {
- updObj.SetZHBBillStatus(ZHBBillStatusEnum.Print); //PrintBillNum = "柱护板已打印"
- updObj.PrintTime2 = ServerHelper.CurrentDateTime; //PrintTime只适用于门板
- }
- await _billM100Repository.UpdateManyAsync(updLst, true);
- }
-
- #region 返回结果格式转换
- //实体 转 DTO
- List targetLst = ObjectMapper.Map, List>(reportMainLst);
- //补充空行
- foreach (var masterObj in targetLst)
- {
- int trueCnt = masterObj.Details.Count;
-
- int planCnt = 0;
- switch (masterObj.PartType)
- {
- case "A上C上":
- case "A柱下A中":
- case "B柱上":
- case "B柱下":
- case "后轮上装饰板":
- planCnt = 24;
- break;
- case "D柱":
- planCnt = 12;
- break;
- default:
- planCnt = 24;
- break;
- }
- if (trueCnt > planCnt)
- {
- throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
- }
- int diffCnt = planCnt - trueCnt;
- for (int i = 0; i < diffCnt; i++)
- {
- ZhuHuBanPackingRecDto dtlObj = new ZhuHuBanPackingRecDto();
- masterObj.Details.Add(dtlObj);
- }
- }
- //子表BillNum赋值, BillNum填充空格, SN赋值
- foreach (var masterObj in targetLst)
- {
- masterObj.BillNum = GetTrueString(masterObj.BillNum);
- int sn = 1;
- foreach (var detailObj in masterObj.Details)
- {
- detailObj.BillNum = masterObj.BillNum;
- detailObj.KNR = GetTrueString(detailObj.KNR);
- detailObj.KNR = detailObj.KNR.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("/n", "").Replace("/r", "");
- detailObj.sn = sn++;
- detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
- //客户要求显示零件描述,替换之前的零件编码
- detailObj.PartCode = detailObj.MaterialDescription;
- detailObj.PartCode2 = detailObj.MaterialDescription2;
- detailObj.MaterialDescription = null;
- detailObj.MaterialDescription2 = null;
- }
- }
+ // int planCnt = 0;
+ // switch (masterObj.PartType)
+ // {
+ // case "A上C上":
+ // case "A柱下A中":
+ // case "B柱上":
+ // case "B柱下":
+ // case "后轮上装饰板":
+ // planCnt = 24;
+ // break;
+ // case "D柱":
+ // planCnt = 12;
+ // break;
+ // default:
+ // planCnt = 24;
+ // break;
+ // }
+ // if (trueCnt > planCnt)
+ // {
+ // throw new Exception($"实际打印行数{trueCnt}超过每页总行数{planCnt}, 底盘起{masterObj.BeginVin}底盘止{masterObj.EndVin}");
+ // }
+ // int diffCnt = planCnt - trueCnt;
+ // for (int i = 0; i < diffCnt; i++)
+ // {
+ // ZhuHuBanPackingRecDto dtlObj = new ZhuHuBanPackingRecDto();
+ // masterObj.Details.Add(dtlObj);
+ // }
+ // }
+ // //子表BillNum赋值, BillNum填充空格, SN赋值
+ // foreach (var masterObj in targetLst)
+ // {
+ // masterObj.BillNum = GetTrueString(masterObj.BillNum);
+ // int sn = 1;
+ // foreach (var detailObj in masterObj.Details)
+ // {
+ // detailObj.BillNum = masterObj.BillNum;
+ // detailObj.KNR = GetTrueString(detailObj.KNR);
+ // detailObj.KNR = detailObj.KNR.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("/n", "").Replace("/r", "");
+ // detailObj.sn = sn++;
+ // detailObj.VIN = detailObj.VIN.TryToRight(6); //底盘号返回后六位
+ // //客户要求显示零件描述,替换之前的零件编码
+ // detailObj.PartCode = detailObj.MaterialDescription;
+ // detailObj.PartCode2 = detailObj.MaterialDescription2;
+ // detailObj.MaterialDescription = null;
+ // detailObj.MaterialDescription2 = null;
+ // }
+ // }
- retObj.MasterList_AC = targetLst.Where(itm => itm.PartType == "A上C上").ToList();
- if (retObj.MasterList_AC.Count == 0) retObj.IsVisibleAC = false;
- foreach (var masterObj in retObj.MasterList_AC)
- {
- retObj.DetailList_AC.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_AC = targetLst.Where(itm => itm.PartType == "A上C上").ToList();
+ // if (retObj.MasterList_AC.Count == 0) retObj.IsVisibleAC = false;
+ // foreach (var masterObj in retObj.MasterList_AC)
+ // {
+ // retObj.DetailList_AC.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_AA = targetLst.Where(itm => itm.PartType == "A柱下A中").ToList();
- if (retObj.MasterList_AA.Count == 0) retObj.IsVisibleAA = false;
- foreach (var masterObj in retObj.MasterList_AA)
- {
- retObj.DetailList_AA.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_AA = targetLst.Where(itm => itm.PartType == "A柱下A中").ToList();
+ // if (retObj.MasterList_AA.Count == 0) retObj.IsVisibleAA = false;
+ // foreach (var masterObj in retObj.MasterList_AA)
+ // {
+ // retObj.DetailList_AA.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_BS = targetLst.Where(itm => itm.PartType == "B柱上").ToList();
- if (retObj.MasterList_BS.Count == 0) retObj.IsVisibleBS = false;
- foreach (var masterObj in retObj.MasterList_BS)
- {
- retObj.DetailList_BS.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_BS = targetLst.Where(itm => itm.PartType == "B柱上").ToList();
+ // if (retObj.MasterList_BS.Count == 0) retObj.IsVisibleBS = false;
+ // foreach (var masterObj in retObj.MasterList_BS)
+ // {
+ // retObj.DetailList_BS.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_BX = targetLst.Where(itm => itm.PartType == "B柱下").ToList();
- if (retObj.MasterList_BX.Count == 0) retObj.IsVisibleBX = false;
- foreach (var masterObj in retObj.MasterList_BX)
- {
- retObj.DetailList_BX.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_BX = targetLst.Where(itm => itm.PartType == "B柱下").ToList();
+ // if (retObj.MasterList_BX.Count == 0) retObj.IsVisibleBX = false;
+ // foreach (var masterObj in retObj.MasterList_BX)
+ // {
+ // retObj.DetailList_BX.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_D = targetLst.Where(itm => itm.PartType == "D柱").ToList();
- if (retObj.MasterList_D.Count == 0) retObj.IsVisibleD = false;
- foreach (var masterObj in retObj.MasterList_D)
- {
- retObj.DetailList_D.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
+ // retObj.MasterList_D = targetLst.Where(itm => itm.PartType == "D柱").ToList();
+ // if (retObj.MasterList_D.Count == 0) retObj.IsVisibleD = false;
+ // foreach (var masterObj in retObj.MasterList_D)
+ // {
+ // retObj.DetailList_D.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
- retObj.MasterList_HL = targetLst.Where(itm => itm.PartType == "后轮上装饰板").ToList();
- if (retObj.MasterList_HL.Count == 0) retObj.IsVisibleHL = false;
- foreach (var masterObj in retObj.MasterList_HL)
- {
- retObj.DetailList_HL.AddRange(masterObj.Details);
- masterObj.Details = null;
- }
- #endregion
- ret.Status = true;
- return ret;
- }
- catch (Exception ex)
- {
- string errorMsg = _errorMessagePrefix + "PrintZhuHuBanPackingList 执行出错:" + ex.Message;
- _logger.LogError(errorMsg);
- throw new BusinessException("1001", errorMsg);
- ret.Status = false;
- ret.Message = ex.Message;
- return ret;
- }
- }
+ // retObj.MasterList_HL = targetLst.Where(itm => itm.PartType == "后轮上装饰板").ToList();
+ // if (retObj.MasterList_HL.Count == 0) retObj.IsVisibleHL = false;
+ // foreach (var masterObj in retObj.MasterList_HL)
+ // {
+ // retObj.DetailList_HL.AddRange(masterObj.Details);
+ // masterObj.Details = null;
+ // }
+ // #endregion
+ // ret.Status = true;
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // string errorMsg = _errorMessagePrefix + "PrintZhuHuBanPackingList 执行出错:" + ex.Message;
+ // _logger.LogError(errorMsg);
+ // throw new BusinessException("1001", errorMsg);
+ // ret.Status = false;
+ // ret.Message = ex.Message;
+ // return ret;
+ // }
+ //}
///