From 011ca316e6ec2ed93e31c45a9ebd9d3c66664871 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 17 四月 2026 11:47:03 +0800
Subject: [PATCH] 代码更新
---
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 296 ++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 220 insertions(+), 76 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index c95cf6f..1913125 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -1,6 +1,7 @@
锘縰sing Autofac.Core;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using OfficeOpenXml.FormulaParsing.Excel.Operators;
using SqlSugar;
@@ -21,6 +22,7 @@
using WIDESEA_Common.TaskEnum;
using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
+using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
@@ -197,7 +199,7 @@
UpdateStock(stockInfoOld, weight, thickness, wide);
return content.OK($"涓存椂鍏ュ簱{stockInfoOld.RfidCode}");
}
- else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.鑰佸巶.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfoOld.IsPick==WhetherEnum.False.ObjToInt() && stationCode.IsNotEmptyOrNull())
+ else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.鑰佸巶.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stationCode.IsNotEmptyOrNull())
{
decimal oldQty = stockInfoOld.StockLength;
//璋冪敤鏇存柊閫�鏂欏簱瀛樺強涓婃姤閲嶉噺
@@ -228,6 +230,11 @@
//璁板綍搴撳瓨鍙樺姩
_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfoOld, oldQty, oldQty < stockInfoOld.StockLength ? stockInfoOld.StockLength- oldQty: oldQty- stockInfoOld.StockLength, StockChangeTypeEnum.MaterielGroup);
return content.OK($"鑰佸巶棰嗘枡閫�搴揜FID{stockInfoOld.RfidCode}鏉$爜{stockInfoOld.PalletCode}");
+ }
+ else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.鑰佸巶.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfoOld.StockLength<=0 && stationCode.IsNullOrEmpty())
+ {
+ _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfoOld, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
+ throw new Exception($"{palletCode}RFID淇℃伅鑰佸巶棰嗘枡鍚庢棤搴撳瓨閫�鏂�");
}
else if (stockInfoOld != null)
{
@@ -348,19 +355,24 @@
WebResponseContent content = new WebResponseContent();
try
{
+ if (thickness < 400)
+ {
+ throw new Exception($"RFID{stockInfoOld.RfidCode}鏉$爜{stockInfoOld.PalletCode}鐩村緞灏忎簬400mm");
+ }
BSTResponse<BSTStockInfoDTO> bSTResponse = _invokeERPService.BSTStockAsync(stockInfoOld.PalletCode).DeserializeObject<BSTResponse<BSTStockInfoDTO>>();
if (bSTResponse.Code == 500)
{
throw new Exception($"鏈壘鍒版潯鐮亄stockInfoOld.PalletCode}涓�鏈烢RP搴撳瓨涓嶅瓨鍦�");
}
-
BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"涓�鏈烢RP鏈繑鍥瀧stockInfoOld.PalletCode}鐨勫簱瀛樹俊鎭�");
- if (stockInfoOld.StockStatus == StockStatusEmun.鑰佸巶閫�鏂欐殏瀛�.ObjToInt())
+ if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0)
{
- stockInfoOld.IsPick = WhetherEnum.False.ObjToInt();
+ throw new Exception($"{stockInfoOld.RfidCode}缁戝畾鏉$爜{stockInfoOld.PalletCode}搴撳瓨涓�0");
}
+ stockInfoOld.IsPick = WhetherEnum.False.ObjToInt();
decimal stockLength = bSTStockInfoDTO.StockMeter;
- if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight)
+ decimal errWeight = Math.Abs(weight - bSTStockInfoDTO.Qty);
+ if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight && errWeight <= AppSettings.Get("ErrWeight").ObjToInt())
{
Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterialSourceId == stockInfoOld.MaterielId);
int gramWeight = (int)(materielInfo.MaterielWeight * 1000);
@@ -369,7 +381,7 @@
Paper_code = stockInfoOld.PalletCode,
Estimate_weight = bSTStockInfoDTO.Qty,
Actual_weight = weight,
- Error_weight = Math.Abs(weight - bSTStockInfoDTO.Qty),
+ Error_weight = errWeight,
Weigh_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
Operator = "LiKu",
Width = bSTStockInfoDTO.W,
@@ -390,9 +402,10 @@
stockInfoOld.StockLength = stockLength;
stockInfoOld.StockOutLength = 0;
stockInfoOld.WarehouseId = WarehouseEnum.LLDYL.ObjToInt();
- if (thickness < 400)
+ List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x=>x.PalletCode==stockInfoOld.PalletCode);
+ if (outLineViewsDel.Count>0)
{
- throw new Exception($"RFID{stockInfoOld.RfidCode}鏉$爜{stockInfoOld.PalletCode}鐩村緞灏忎簬400mm");
+ _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel);
}
content.OK("鎴愬姛",data:stockInfoOld);
}
@@ -926,22 +939,6 @@
bool RoadwayType = stockInfo.PalletType == LocationTypeEnum.MediumPallet.ObjToInt();
//鑾峰彇鍒嗛厤
List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.RoadwayNo.Contains("YLDual") && (stockInfo.PalletType == LocationTypeEnum.MediumPallet.ObjToInt() ? x.LocationType == LocationTypeEnum.MediumPallet.ObjToInt() : x.LocationType == LocationTypeEnum.SmallPallet.ObjToInt())).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).OrderBy(x => x.RoadwayNo).ToList();
- if (RoadwayType)
- {
- foreach (var item in locationCounts)
- {
- if (item.RoadwayNo.Contains("YLDual"))
- {
- int count = Db.Queryable<Dt_LocationInfo>()
- .Where(x => x.WarehouseId == warehouse.WarehouseId
- && x.LocationStatus == (int)LocationStatusEnum.Free
- && x.EnableStatus == (int)EnableStatusEnum.Normal
- && x.LocationType == LocationTypeEnum.MediumPallet.ObjToInt()
- && x.RoadwayNo == item.RoadwayNo).Count();
- item.Count = count;
- }
- }
- }
roadwayNo = HandleRoadway(locationCounts, warehouse, ErrorRoadway ? roadways : null);
}
}
@@ -978,6 +975,10 @@
{
item.Count -= count.Count;
}
+ if (item.Count >= 50 && count?.Count<=1)
+ {
+ return item.RoadwayNo;
+ }
}
return locationCounts.Where(x => x.Count > 0).OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
}
@@ -1001,6 +1002,25 @@
if (agvstation != null)
{
agvstation.IsOccupied = WhetherEnum.False.ObjToInt();
+ }
+ //鍙犵洏/鍐插垏鎼繍鑷抽浘鍖� 浠诲姟鍗曠嫭瀹屾垚
+ if (task.TaskType==TaskTypeEnum.EmptyStackPlate.ObjToInt() || task.TaskType == TaskTypeEnum.PunchingInbound.ObjToInt())
+ {
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ if (agvstation != null)
+ {
+ _basicRepository.AGVStationInfoRepository.UpdateData(agvstation);
+ }
+ if (task.ProductNo.IsNotEmptyOrNull())
+ {
+ Dt_MESProInOrderInfo mESProInOrderInfo = _inboundRepository.MESProInOrderInfoRepository.QueryFirst(x=>x.BarCode== task.ProductNo);
+ mESProInOrderInfo.MESProInStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+ _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfo);
+ }
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
+ _unitOfWorkManage.CommitTran();
+ return content.OK();
}
Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x=>x.proStockInfoDetails).First();
if (proStockInfo != null && proStockInfo.StockStatus == StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt())
@@ -1053,7 +1073,7 @@
}
proInUpModel.PB_INV_PRODUCT_IN= pRODUCT_INItems;
string request = _invokeERPService.ERPProInUp(proInUpModel) ?? throw new Exception("鎴愬搧鍏ュ簱鎺ュ彛璇锋眰澶辫触");
- if (!request.Contains("Success"))
+ if (!request.Contains("success"))
{
throw new Exception($"鎴愬搧鍏ュ簱澶辫触");
}
@@ -1246,7 +1266,7 @@
/// <summary>
/// 鎴愬搧绌烘墭鍥炲簱
/// </summary>
- public WebResponseContent EmptyBackTask(string barCode, string startPoint)
+ public WebResponseContent EmptyBackTask(string barCode, string startPoint,int target)
{
WebResponseContent content = new WebResponseContent();
try
@@ -1273,41 +1293,64 @@
{
return content.Error($"鎵樼洏{barCode}浠诲姟宸插瓨鍦�");
}
- Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode);
- if (proStockInfoOld!=null)
+ Dt_Task newTask = null;
+ Dt_ProStockInfo proStockInfo = null;
+ if (target==WhetherEnum.False.ObjToInt())//鍙犵洏绌烘墭浠诲姟
{
- return content.Error($"鎵樼洏{barCode}宸插瓨鍦�");
+ newTask = new Dt_Task()
+ {
+ CurrentAddress = startPoint,
+ Grade = 0,
+ NextAddress = "",
+ PalletCode = barCode,
+ Roadway = agvstation.AGVStationCode.StartsWith("PNT_1") ? "StackPlate1": "StackPlate2",
+ SourceAddress = startPoint,
+ TargetAddress = "",
+ TaskType = TaskTypeEnum.EmptyStackPlate.ObjToInt(),
+ TaskStatus = TaskStatusEnum.New.ObjToInt(),
+ WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+ PalletType = 1
+ };
}
- //鍒嗛厤宸烽亾
- string roadWay=AssignCPRoadwayNo();
-
- Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo()
+ else //绔嬪簱绌烘墭浠诲姟
{
- PalletCode=barCode,
- ProStockAttribute=ProStockAttributeEnum.绌烘墭.ObjToInt(),
- PalletType=1,
- LocationCode="",
- WarehouseId= WarehouseEnum.LLDFL.ObjToInt(),
- StockStatus=StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()
- };
-
- Dt_Task newTask = new Dt_Task()
- {
- CurrentAddress = startPoint,
- Grade = 0,
- NextAddress = "",
- PalletCode = barCode,
- Roadway = roadWay,
- SourceAddress = startPoint,
- TargetAddress = "",
- TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(),
- TaskStatus = TaskStatusEnum.New.ObjToInt(),
- WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
- PalletType = 1
- };
+ Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode);
+ if (proStockInfoOld != null)
+ {
+ return content.Error($"鎵樼洏{barCode}宸插瓨鍦�");
+ }
+ //鍒嗛厤宸烽亾
+ string roadWay = AssignCPRoadwayNo();
+ proStockInfo = new Dt_ProStockInfo()
+ {
+ PalletCode = barCode,
+ ProStockAttribute = ProStockAttributeEnum.绌烘墭.ObjToInt(),
+ PalletType = 1,
+ LocationCode = "",
+ WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+ StockStatus = StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()
+ };
+ newTask = new Dt_Task()
+ {
+ CurrentAddress = startPoint,
+ Grade = 0,
+ NextAddress = "",
+ PalletCode = barCode,
+ Roadway = roadWay,
+ SourceAddress = startPoint,
+ TargetAddress = "",
+ TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(),
+ TaskStatus = TaskStatusEnum.New.ObjToInt(),
+ WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+ PalletType = 1
+ };
+ }
_unitOfWorkManage.BeginTran();
int taskId = BaseDal.AddData(newTask);
- _stockRepository.ProStockInfoRepository.AddData(proStockInfo);
+ if (proStockInfo!=null)
+ {
+ _stockRepository.ProStockInfoRepository.AddData(proStockInfo);
+ }
newTask.TaskId = taskId;
_unitOfWorkManage.CommitTran();
//鎺ㄩ�佷换鍔�
@@ -1842,7 +1885,7 @@
return content.Error("浼犲叆淇℃伅涓虹┖");
}
//鑾峰彇鎵�鏈夋垚鍝侊紝鍗婃垚鍝佷俊鎭�
- List<Dt_MESProInOrderInfo> proInOrderInfos = _inboundRepository.MESProInOrderInfoRepository.QueryData();
+ List<Dt_MESProInOrderInfo> proInOrderInfosOld = _inboundRepository.MESProInOrderInfoRepository.QueryData();
//鑾峰彇鎵�鏈夌墿鏂欎俊鎭�
List<Dt_MaterielInfo> materielInfos = _basicRepository.MaterielInfoRepository.QueryData(x => x.MaterielInvOrgId == MaterielInvOrgEnum.鏂板巶.ObjToInt());
@@ -1855,12 +1898,12 @@
List<Dt_AGVStationInfo> aGVStationInfos = _basicRepository.AGVStationInfoRepository.QueryData(x => !string.IsNullOrEmpty(x.MESPointCode));
//鍒ゆ柇鏄惁瀛樺湪閲嶅
- MESProInDTO? proInDTO = proInDTOs.FirstOrDefault(x => x.IsMantissa == false && proInOrderInfos.Select(x => x.BarCode).Contains(x.BarCode));
+ MESProInDTO? proInDTO = proInDTOs.FirstOrDefault(x => x.IsMantissa == false && proInOrderInfosOld.Select(x => x.BarCode).Contains(x.BarCode));
if (proInDTO != null)
{
return content.Error($"{proInDTO.ProductOrderNo}鐢熶骇宸ュ崟{proInDTO.BarCode}鏉$爜宸插瓨鍦�");
}
- Dt_MESProInOrderInfo? proInOrderInfo = proInOrderInfos.FirstOrDefault(x => x.MESProInStatus == InOrderStatusEnum.鍏抽棴.ObjToInt() && proInDTOs.Select(x => x.ProductOrderNo).Distinct().Contains(x.ProductOrderNo));
+ Dt_MESProInOrderInfo? proInOrderInfo = proInOrderInfosOld.FirstOrDefault(x => x.MESProInStatus == InOrderStatusEnum.鍏抽棴.ObjToInt() && proInDTOs.Select(x => x.ProductOrderNo).Distinct().Contains(x.ProductOrderNo));
if (proInOrderInfo != null)
{
return content.Error($"{proInOrderInfo.ProductOrderNo}鐢熶骇宸ュ崟宸插叧闂�");
@@ -1869,6 +1912,11 @@
foreach (var item in proInDTOs)
{
Dt_MaterielInfo materielInfo = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterialCode);
+ //鍒ゆ柇
+ if ((item.Thickness <= 0 || item.Wide <= 0) && materielInfo.WarehouseId == WarehouseEnum.LLDYL.ObjToInt())
+ {
+ return content.Error($"鐗╂枡{item.MaterialCode}鏉$爜{item.BarCode}鐩村緞鎴栧箙瀹戒笉鑳藉皬浜�0");
+ }
if (materielInfo.MaterielSourceType != MaterielTypeEnum.鎴愬搧.ObjToInt())
{
Dt_AGVStationInfo? CheckPointCode = aGVStationInfos.FirstOrDefault(x => x.MESPointCode == item?.PointCode);
@@ -1884,6 +1932,11 @@
Dt_MESProInOrderInfo AddproInOrderInfo = _mapper.Map<Dt_MESProInOrderInfo>(item);
AddproInOrderInfo.WarehouseId = materielInfo.WarehouseId;
AddproInOrderInfo.MESProOrderType = materielInfo.MaterielSourceType;
+ //灏忎簬550骞呭鍒欎笉鑳芥惉杩�
+ if (item.Wide < 550 && materielInfo.WarehouseId == WarehouseEnum.LLDYL.ObjToInt())
+ {
+ AddproInOrderInfo.MESProInStatus=InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+ }
AddMESProInOrders.Add(AddproInOrderInfo);
}
List<Dt_Task> tasks = new List<Dt_Task>();
@@ -1907,24 +1960,30 @@
string request = _invokeERPService.ERPSemiProInUp(
new ERPProInUpModel()
{
- PB_INV_PRODUCT_IN= pRODUCT_INItems
+ PB_INV_PRODUCT_IN = pRODUCT_INItems
}) ?? throw new Exception("鍗婃垚鍝佸叆搴撴帴鍙h姹傚け璐�");
//鐢熸垚鍗婃垚鍝佸叆搴�
- WebResponseContent webResponse = SemiProInbound(AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.鍗婃垚鍝�.ObjToInt()).ToList());
- if (!webResponse.Status)
+ List<Dt_MESProInOrderInfo> semiProInOrderInfos = mESProInOrderInfos.Where(x => x.MESProInStatus == InOrderStatusEnum.鏈紑濮�.ObjToInt() && x.WarehouseId==WarehouseEnum.LLDYL.ObjToInt()).ToList();
+ if (semiProInOrderInfos.Count>0)
{
- throw new Exception(webResponse.Message);
- }
- tasks = webResponse.Data as List<Dt_Task>;
- WebResponseContent taskResponse = PushTasksToWCS(tasks);
- if (!taskResponse.Status)
- {
- throw new Exception(taskResponse.Message);
+ WebResponseContent webResponse = SemiProInbound(semiProInOrderInfos);
+ if (!webResponse.Status)
+ {
+ throw new Exception(webResponse.Message);
+ }
+ tasks = webResponse.Data as List<Dt_Task>;
+ WebResponseContent taskResponse = PushTasksToWCS(tasks);
+ if (!taskResponse.Status)
+ {
+ throw new Exception(taskResponse.Message);
+ }
+ _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfos);
}
}
- if (AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.鎴愬搧.ObjToInt()).Count() > 0)
+ List<Dt_MESProInOrderInfo> proInOrderInfos = AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.鎴愬搧.ObjToInt()).ToList();
+ if (proInOrderInfos.Count > 0)
{
- WebResponseContent webResponse = PushPackaxisTaskToWCS(AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.鎴愬搧.ObjToInt()).ToList());
+ WebResponseContent webResponse = PushPackaxisTaskToWCS(proInOrderInfos);
if (!webResponse.Status)
{
throw new Exception(webResponse.Message);
@@ -1953,7 +2012,6 @@
{
return content.Error("浼犲叆淇℃伅涓虹┖");
}
-
List<Dt_MaterielInfo> materielInfos = _basicRepository.MaterielInfoRepository.QueryData();
List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>();
List<Dt_Task> tasks = new List<Dt_Task>();
@@ -2014,23 +2072,27 @@
NextAddress = "",
PalletCode = item.BarCode,
Roadway = "",
- SourceAddress = CheckPointCode.AGVStationCode,
+ SourceAddress = item.PointCode.StartsWith("YS") ? CheckPointCode.AGVStationCode : CheckPointCode.MESPointCode,
TargetAddress = "",
TaskType = 0,
TaskStatus = TaskStatusEnum.New.ObjToInt(),
WarehouseId = materielInfo.WarehouseId,
PalletType = stockInfo.PalletType,
- TaskLength = (int)item.Wide
+ TaskLength = (int)item.Wide,
+ WorkCentreCode=item.MakeCode,
+ MaterielCode = item.MaterialCode,
+ Quantity =item.ProQuantity
};
TaskTypeEnum taskTypeEnum = CheckPointCode.StationArea switch
{
nameof(StationAreaEnum.涓�妤煎嵃鍒�) => TaskTypeEnum.PrintYLInbound,
nameof(StationAreaEnum.涓�妤煎垎鍒�) => TaskTypeEnum.PartOffInbound,
nameof(StationAreaEnum.涓�妤肩焊寮犳穻鑶�) => TaskTypeEnum.PaperFilmInbound,
- nameof(StationAreaEnum.涓�妤兼棤绾烘穻鑶�) => TaskTypeEnum.WFBYLInbound,
+ nameof(StationAreaEnum.涓�妤兼棤绾虹粐甯�) => TaskTypeEnum.WFBYLInbound,
+ nameof(StationAreaEnum.涓�妤兼棤绾烘穻鑶�) => TaskTypeEnum.WFBLMYLInbound,
_ => throw new Exception("鏈壘鍒板搴斾换鍔�")
};
- if (taskTypeEnum == TaskTypeEnum.WFBYLInbound)
+ if (taskTypeEnum == TaskTypeEnum.WFBYLInbound || taskTypeEnum == TaskTypeEnum.WFBLMYLInbound)
{
Dt_AGVStationInfo? stationInfo = AssignWFBStation(_AGVStationInfos?.Select(x => x.AGVStationCode).ToList()) ?? throw new Exception("鏈壘鍒板彲鐢ㄦ棤绾哄竷鏆傚瓨鏋�");
newTask.NextAddress = stationInfo.AGVStationCode;
@@ -2096,6 +2158,10 @@
throw new Exception(ex.Message);
}
}
+ /// <summary>
+ /// 鎴愬搧缁勭洏
+ /// </summary>
+ /// <returns></returns>
public WebResponseContent BoxingInBound(string stationCode,List<string> barCodes)
{
WebResponseContent content = new WebResponseContent();
@@ -2185,5 +2251,83 @@
}
return content;
}
+ /// <summary>
+ /// 鍗婃垚鍝佹墭鐩樻惉杩愬叆搴�
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent SemiProIn(string barcode, string palletCode, string address)
+ {
+
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ //鑾峰彇褰撳墠鍗婃垚鍝佷俊鎭�
+ Dt_MESProInOrderInfo mESProInOrderInfo = _inboundRepository.MESProInOrderInfoRepository.QueryFirst(x=>x.BarCode==barcode) ?? throw new Exception($"鍗婃垚鍝佹潯鐮亄barcode}淇℃伅涓嶅瓨鍦紝璇锋牳瀵逛俊鎭�");
+ //鑾峰彇鍔犲伐涓績
+ Dt_MakeCenterInfo makeCenterInfo = _basicRepository.MakeCenterInfoRepository.QueryFirst(x=>x.MakeCode==mESProInOrderInfo.MakeCode);
+ if (makeCenterInfo.MakeArea!=StationAreaEnum.涓�妤煎垎鍒�.ObjToInt() && makeCenterInfo.MakeArea != StationAreaEnum.涓�妤煎啿鍒�.ObjToInt() && makeCenterInfo.MakeArea != StationAreaEnum.涓�妤兼ā鍒�.ObjToInt()) throw new Exception($"鍗婃垚鍝佹潯鐮亄barcode}涓嶅睘浜庡垎鍒�/鍐插垏/妯″垏鍔犲伐");
+
+ //鍒ゆ柇浠诲姟
+ Dt_Task? taskExist = BaseDal.QueryFirst(x=>x.PalletCode==palletCode) == null ? null: throw new Exception($"鎵樼洏{palletCode}浠诲姟宸插瓨鍦�");
+ //鍒ゆ柇搴撳瓨
+ Dt_ProStockInfo? proStockInfoExist = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode== palletCode).Includes(x => x.proStockInfoDetails).First() == null ? null : throw new Exception($"鎵樼洏{palletCode}搴撳瓨宸插瓨鍦�"); ;
+ //鍒ゆ柇鍦板潃
+ Dt_AGVStationInfo StationInfoStart = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==address) ?? throw new Exception($"鍦板潃鐮亄address}涓嶅瓨鍦�");
+
+ Dt_AGVStationInfo? StationInfoEnd = null;
+ Dt_Task? newTask = null;
+ #region 閫昏緫鍒ゆ柇锛氬垎鍒�&妯″垏鍏ユ垚鍝�(杈呮枡)搴擄紱鍐插垏鎼繍鑷充簩妤奸浘鍖栦腑杞尯锛�
+ if (makeCenterInfo.MakeArea == StationAreaEnum.涓�妤煎啿鍒�.ObjToInt())
+ {
+ //鑾峰彇闆惧寲涓浆鍖虹偣浣�
+ StationInfoEnd = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.StationArea== StationAreaEnum.浜屾ゼ闆惧寲.ToString() && x.IsOccupied==WhetherEnum.False.ObjToInt()) ?? throw new Exception($"浜屾ゼ闆惧寲鍙敤鐐逛綅涓嶈冻");
+ //鐢熸垚浠诲姟
+ newTask = new Dt_Task()
+ {
+ CurrentAddress = StationInfoStart.AGVStationCode,
+ Grade = 0,
+ NextAddress = StationInfoEnd.AGVStationCode,
+ PalletCode = palletCode,
+ Roadway = "AGV",
+ SourceAddress = StationInfoStart.AGVStationCode,
+ TargetAddress = StationInfoEnd.AGVStationCode,
+ TaskType = TaskTypeEnum.PunchingInbound.ObjToInt(),
+ TaskStatus = TaskStatusEnum.New.ObjToInt(),
+ WarehouseId = mESProInOrderInfo.WarehouseId,
+ PalletType = PalletTypeEnum.SmallPallet.ObjToInt(),
+ TaskLength = (int)mESProInOrderInfo.Wide,
+ WorkCentreCode = mESProInOrderInfo.MakeCode,
+ MaterielCode=mESProInOrderInfo.MaterialCode,
+ Quantity=mESProInOrderInfo.ProQuantity,
+ ProductNo=mESProInOrderInfo.BarCode
+ };
+ StationInfoEnd.IsOccupied = 1;
+ }
+ else
+ {
+ return content.Error("鏆傛椂鏃犳硶婊¤冻");
+ }
+ mESProInOrderInfo.MESProInStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
+ //鏁版嵁搴撴搷浣滃苟鎺ㄩ�乄CS浠诲姟
+ _unitOfWorkManage.BeginTran();
+ _basicRepository.AGVStationInfoRepository.UpdateData(StationInfoEnd);
+ BaseDal.AddData(newTask);
+ _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfo);
+ WebResponseContent taskResponse = PushTasksToWCS(new List<Dt_Task>() { newTask });
+ if (!taskResponse.Status)
+ {
+ throw new Exception(taskResponse.Message);
+ }
+ _unitOfWorkManage.CommitTran();
+ #endregion
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
}
}
--
Gitblit v1.9.3