| | |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Log; |
| | | using WIDESEA_Core.LogHelper; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicRepository; |
| | |
| | | |
| | | private Dictionary<string, OrderByType> _OutLockOrderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | |
| | | |
| | | { nameof(Dt_OutStockLockInfo.CreateDate), OrderByType.Desc }, |
| | | |
| | | }; |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService, ITask_HtyService taskHtyService, ILocationInfoService locationInfoService, ISys_JobService sys_JobService, ILabelMasterRepository labelMasterRepository, IOutStockLockInfoRepository outStockLockInfoRepository, IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutBoundOrderBYDRepository outBoundOrderBYDRepository, IOutboundOrderDetailBYDRepository outboundOrderDetailByDRepository, IOutboundOrderRepository outboundOrderRepository, IOutboundOrder_HtyRepository outboundOrder_HtyRepository, IOutboundOrderDetail_HtyRepository outboundOrderDetail_HtyRepository, IReturnInventoryDetailRepository returnInventoryDetailRepository,IMainReturnInventoryRepository mainReturnInventoryRepository) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService, ITask_HtyService taskHtyService, ILocationInfoService locationInfoService, ISys_JobService sys_JobService, ILabelMasterRepository labelMasterRepository, IOutStockLockInfoRepository outStockLockInfoRepository, IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutBoundOrderBYDRepository outBoundOrderBYDRepository, IOutboundOrderDetailBYDRepository outboundOrderDetailByDRepository, IOutboundOrderRepository outboundOrderRepository, IOutboundOrder_HtyRepository outboundOrder_HtyRepository, IOutboundOrderDetail_HtyRepository outboundOrderDetail_HtyRepository, IReturnInventoryDetailRepository returnInventoryDetailRepository, IMainReturnInventoryRepository mainReturnInventoryRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _outboundOrderDetail_HtyRepository = outboundOrderDetail_HtyRepository; |
| | | _returnInventoryDetailRepository = returnInventoryDetailRepository; |
| | | _mainReturnInventoryRepository = mainReturnInventoryRepository; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId>0? App.User.UserName: "System")}{ Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{ JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | } |
| | | } |
| | | public WebResponseContent TaskCancel(int taskNum) |
| | |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return content=WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCancel"); |
| | |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content=WebResponseContent.Instance.Error(response.Message); |
| | | return content = WebResponseContent.Instance.Error(response.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content=responseContent; |
| | | return content = responseContent; |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content=responseContent; |
| | | return content = responseContent; |
| | | } |
| | | } |
| | | } |
| | | return content=WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content=WebResponseContent.Instance.Error(ex.Message); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | |
| | | task.Modifier = App.User.UserId > 0 ? App.User.UserName : "System"; |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.0 "); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | //Logger.Write_Log("System/test_in", "", "3.1 "); |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | //Logger.Write_Log("System/test_in", "", "3.2 "); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.3 "); |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | foreach (Dt_StockInfoDetail detail in stockInfo.Details) |
| | | { |
| | | //0 - ééå¶ï¼å¨åºæ£å¸¸çç©æï¼ |
| | | //1 - å»ç»ï¼å¨åºå·²å»ç»çç©æï¼ |
| | | //2 - å¾
è´¨æ£ï¼å·²ä¸æ¶ç«åºï¼è¿æªè´¨æ£æå·²è´¨æ£ä¸åæ ¼çç©æï¼ |
| | | Dt_LabelMaster labMaster = _labelMasterRepository.QueryFirst(x => x.LABEL_NO == detail.SerialNumber); |
| | | if (labMaster.LABEL_STATUS == "01") |
| | | { |
| | | labMaster.SOBKZ = "0"; |
| | | } |
| | | else |
| | | { |
| | | labMaster.SOBKZ = "2"; |
| | | } |
| | | _labelMasterRepository.UpdateData(labMaster); |
| | | } |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.4 "); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt(); |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.5 "); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.6 "); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound,task.TaskNum); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound, task.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.7 "); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | #region åä¼ é»è¾å¤ç |
| | | try |
| | | { |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.8 "); |
| | | PutAwayRequest request = new PutAwayRequest(); |
| | | List<PutAway> itemData = new List<PutAway>(); |
| | | request.ITEMDATA = itemData; |
| | | request.WERKS = AppSettings.Configuration["WERKS"]; |
| | | request.WH_NUMBER = AppSettings.Configuration["WERKS"]; |
| | | request.IZLID = request.WERKS + request.WH_NUMBER+ DateTime.Now.ToString("yyyyMMdd") + task.TaskNum.ToString(); |
| | | request.WH_NUMBER = AppSettings.Configuration["SYSNO"]; |
| | | request.IZLID = request.WERKS + request.WH_NUMBER + DateTime.Now.ToString("yyyyMMdd") + task.TaskNum.ToString(); |
| | | request.CREATE_DATE = task.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | request.PSTNG_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | request.INBOUND_NO = "";//todo:åå·è¦ä»æ¡ç ä¸»æ°æ®ä¸è·åï¼ä¸ç¶åä¼ ä¼æç¤ºï¼è¯¥æ¡ç æ è¿ä»åæ°æ®ï¼ |
| | | request.RECEIPT_NO = "";//todo:åå·è¦ä»æ¡ç ä¸»æ°æ®ä¸ï¼ä¸ç¶åä¼ ä¼æç¤ºï¼è¯¥æ¡ç æ è¿ä»åæ°æ®ï¼ |
| | | //Logger.Write_Log("System/test_in", "", "3.9 "); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | //Logger.Write_Log("System/test_in", "", "3.10 "); |
| | | foreach (Dt_StockInfoDetail detail in stockInfo.Details) |
| | | { |
| | | //Logger.Write_Log("System/test_in", "", "3.11 "); |
| | | Dt_LabelMaster labMaster = _labelMasterRepository.QueryFirst(x => x.LABEL_NO == detail.SerialNumber); |
| | | if (labMaster != null) |
| | | { |
| | | if (request.INBOUND_NO == "") |
| | | //Logger.Write_Log("System/test_in", "", "3.12 "); |
| | | if (string.IsNullOrWhiteSpace(request.INBOUND_NO)) |
| | | { |
| | | request.INBOUND_NO = labMaster.INBOUND_NO; |
| | | } |
| | | if (request.RECEIPT_NO == "") |
| | | if (string.IsNullOrWhiteSpace(request.RECEIPT_NO)) |
| | | { |
| | | request.RECEIPT_NO = labMaster.RECEIPT_NO; |
| | | } |
| | |
| | | putAway.RECEIPT_ITEM_NO = labMaster.RECEIPT_ITEM_NO; |
| | | putAway.INBOUND_NO = task.TaskNum.ToString(); |
| | | //LABEL _STATUS æ¡ç ç¶æ 02å·²æ¶æ(æ éè´¨æ£)03 å¾
è¿ä»(已质æ£)ï¼å¹¶ä¸ï¼QC RESULT CODEè´¨æ£ç¶æä¸ºâ02â æå
è®¡ä¸æ¶ |
| | | if (labMaster.QC_RESULT_CODE=="02"&&(labMaster.LABEL_STATUS=="02"|| labMaster.LABEL_STATUS == "03")) |
| | | //Logger.Write_Log("System/test_in", "", "3.13 "); |
| | | if (labMaster.QC_RESULT_CODE == "02" && (labMaster.LABEL_STATUS == "02" || labMaster.LABEL_STATUS == "03")) |
| | | { |
| | | //Logger.Write_Log("System/test_in", "", "3.14 "); |
| | | itemData.Add(putAway); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | if (itemData.Count > 0) |
| | | { |
| | | WebResponseContent content= _sys_JobService.CallPutAway(request); |
| | | if (content != null&&content.Message== "䏿¶åä¼ æå") //妿䏿¶æåï¼ä¿®æ¹åºåç¶æä¸ºå·²ä¸æ¶ |
| | | //Logger.Write_Log("System/test_in", "", "3.15 "); |
| | | WebResponseContent content = _sys_JobService.CallPutAway(request); |
| | | //Logger.Write_Log("System/test_in", "", "3.16 "); |
| | | if (content != null && content.Message == "䏿¶åä¼ æå") //妿䏿¶æåï¼ä¿®æ¹åºåç¶æä¸ºå·²ä¸æ¶ |
| | | { |
| | | //Logger.Write_Log("System/test_in", "", "3.17 "); |
| | | stockInfo.StockStatus = StockStatusEmun.已䏿¶.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | } |
| | | else |
| | | { |
| | | |
| | | //Logger.Write_Log("System/test_in", "", "3.18 " + content.Message); |
| | | } |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | |
| | | try |
| | | { |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.0 "); |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | //Logger.Write_Log("System/test_re", "", "3.1 "); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | //Logger.Write_Log("System/test_re", "", "3.2 "); |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | //Logger.Write_Log("System/test_re", "", "3.3 "); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | //Logger.Write_Log("System/test_re", "", "3.4 "); |
| | | |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.5 "); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt(); |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.6 "); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.7 "); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | //Logger.Write_Log("System/test_re", "", "3.8 "); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound, task.TaskNum); |
| | | //Logger.Write_Log("System/test_re", "", "3.9 "); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //Logger.Write_Log("System/test_re", "", "3.10 "); |
| | | |
| | | |
| | | } |
| | |
| | | #region åä¼ é»è¾å¤ç |
| | | try |
| | | { |
| | | //Logger.Write_Log("System/test_re", "", "3.11 "); |
| | | PutAwayReturnRequest request = new PutAwayReturnRequest(); |
| | | List<PutAwayReturn> DATA = new List<PutAwayReturn>(); |
| | | request.DATA = DATA; |
| | | request.WERKS = AppSettings.Configuration["WERKS"]; |
| | | request.WH_NUMBER = AppSettings.Configuration["SYSNO"]; |
| | | request.IZLID = task.OrderNo;//è¿ä¸ªå¼ä¼å¨æ¥æ¶ä¸æ¸¸ååºç»çä¿¡æ¯æ¶ï¼åå¨åºå表ä¸ï¼ååå°ä»»å¡è¡¨ä¸ |
| | | Dt_MainReturnInventory mainReturnInventory = _mainReturnInventoryRepository.QueryFirst(x => x.IZLID == task.OrderNo); |
| | | //request.WH_NUMBER = AppSettings.Configuration["SYSNO"]; |
| | | //request.WERKS = AppSettings.Configuration["WERKS"]; |
| | | //request.IZLID = task.OrderNo;//è¿ä¸ªå¼ä¼å¨æ¥æ¶ä¸æ¸¸ååºç»çä¿¡æ¯æ¶ï¼åå¨åºå表ä¸ï¼ååå°ä»»å¡è¡¨ä¸ |
| | | |
| | | Dt_MainReturnInventory mainReturnInventory = _mainReturnInventoryRepository.QueryFirst(x => x.TPNUM == task.PalletCode && x.YLZD4 != "1"); |
| | | if (mainReturnInventory != null) |
| | | { |
| | | request.RETURN_NO = mainReturnInventory.RETURN_NO; |
| | | request.RETURN_ITEM_NO = mainReturnInventory.RETURN_ITEM_NO; |
| | | //Logger.Write_Log("System/test_re", "", "3.12 "); |
| | | request.WH_NUMBER = mainReturnInventory.WH_NUMBER; |
| | | request.BUSINESS_NAME = mainReturnInventory.BUSINESS_NAME; |
| | | request.BUSINESS_CODE = mainReturnInventory.BUSINESS_CODE; |
| | | request.TPNUM = mainReturnInventory.TPNUM; |
| | | request.WERKS = mainReturnInventory.WERKS; |
| | | request.LGORT = mainReturnInventory.LGORT; |
| | | request.MO_NO = mainReturnInventory.MO_NO; |
| | | request.TOTAL_RETURN_QTY = mainReturnInventory.TOTAL_RETURN_QTY; |
| | | request.BUSINESS_CODE = mainReturnInventory.BUSINESS_CODE; |
| | | request.RETURN_NO = mainReturnInventory.RETURN_NO; |
| | | |
| | | request.RETURN_ITEM_NO = mainReturnInventory.RETURN_ITEM_NO; |
| | | request.TPNUM = mainReturnInventory.TPNUM; |
| | | request.YLZD5 = mainReturnInventory.YLZD5; |
| | | request.IZLID = mainReturnInventory.IZLID; |
| | | request.MO_NO = mainReturnInventory.MO_NO; |
| | | request.YLZD3 = mainReturnInventory.YLZD3; |
| | | request.YLZD4 = mainReturnInventory.YLZD4; |
| | | request.YLZD1 = mainReturnInventory.YLZD1; |
| | | request.YLZD2 = mainReturnInventory.YLZD2; |
| | | request.SYSNOD = mainReturnInventory.SYSNOD; |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.13 "); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | List<Dt_ReturnInventoryDetail> returnInventoryDetails = new List<Dt_ReturnInventoryDetail>(); |
| | | foreach (Dt_StockInfoDetail detail in stockInfo.Details) |
| | | { |
| | | Dt_ReturnInventoryDetail dt_ReturnInventoryDetail = _returnInventoryDetailRepository.QueryFirst(x => x.LABEL_NO == detail.SerialNumber); |
| | | //Logger.Write_Log("System/test_re", "", "3.14 "); |
| | | Dt_ReturnInventoryDetail dt_ReturnInventoryDetail = _returnInventoryDetailRepository.QueryFirst(x => x.LABEL_NO == detail.SerialNumber && x.SOBKZ == "Z"); |
| | | if (dt_ReturnInventoryDetail != null) |
| | | { |
| | | //Logger.Write_Log("System/test_re", "", "3.15 "); |
| | | PutAwayReturn putAwayReturn = new PutAwayReturn(); |
| | | putAwayReturn.LABEL_NO = dt_ReturnInventoryDetail.LABEL_NO; |
| | | putAwayReturn.SOBKZ = dt_ReturnInventoryDetail.SOBKZ; |
| | | putAwayReturn.UNIT = dt_ReturnInventoryDetail.UNIT; |
| | | putAwayReturn.SOBKZ = dt_ReturnInventoryDetail.SOBKZ; |
| | | putAwayReturn.LGORT = dt_ReturnInventoryDetail.LGORT; |
| | | putAwayReturn.TOTAL_RETURN_QTY = dt_ReturnInventoryDetail.QTY; |
| | | putAwayReturn.QTY = dt_ReturnInventoryDetail.QTY; |
| | | putAwayReturn.F_LGORT = dt_ReturnInventoryDetail.F_LGORT; |
| | | putAwayReturn.MO_NO = mainReturnInventory.MO_NO; |
| | | putAwayReturn.LIFNR = dt_ReturnInventoryDetail.LIFNR; |
| | | putAwayReturn.MO_NO = mainReturnInventory.MO_NO; |
| | | putAwayReturn.MATNR = dt_ReturnInventoryDetail.MATNR; |
| | | putAwayReturn.BATCH = ""; |
| | | DATA.Add(putAwayReturn); |
| | | //Logger.Write_Log("System/test_re", "", "3.16 "); |
| | | |
| | | returnInventoryDetails.Add(dt_ReturnInventoryDetail); |
| | | } |
| | | } |
| | | if(DATA.Count>0) |
| | | request.DATA = DATA; |
| | | if (DATA.Count > 0) |
| | | { |
| | | _sys_JobService.CallPutAwayReturn(request);//使éåºåä¼ |
| | | //Logger.Write_Log("System/test_re", "", "3.17 "); |
| | | var res = _sys_JobService.CallPutAwayReturn(request);//使éåºåä¼ |
| | | if (res.Status) |
| | | { |
| | | //Logger.Write_Log("System/test_re", "", "3.18 "); |
| | | mainReturnInventory.YLZD4 = "1"; |
| | | _mainReturnInventoryRepository.UpdateData(mainReturnInventory); |
| | | |
| | | foreach (var li in returnInventoryDetails) |
| | | { |
| | | li.SOBKZ = "0"; |
| | | _returnInventoryDetailRepository.UpdateData(li); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | //Logger.Write_Log("System/test_re", "", "3.19 "); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public WebResponseContent OutboundTaskCompleted(Dt_Task task) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.0 "); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | Dt_StockInfo stockInfoCatch = stockInfo;//å
ç¼åèµ·æ¥ï¼ä¾åé¢çåä¼ æ¥å£è°ç¨ |
| | | //Logger.Write_Log("System/test_out", "", "3.1 "); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | |
| | | |
| | | //Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | //Dt_StockInfo stockInfoCatch = stockInfo;//å
ç¼åèµ·æ¥ï¼ä¾åé¢çåä¼ æ¥å£è°ç¨ |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | //Logger.Write_Log("System/test_out", "", "3.2 "); |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | //Logger.Write_Log("System/test_out", "", "3.3 "); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | //Logger.Write_Log("System/test_out", "", "3.4 "); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.5 "); |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.6 "); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | |
| | | } |
| | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | //Logger.Write_Log("System/test_out", "", "3.7 "); |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | //Logger.Write_Log("System/test_out", "", "3.8 "); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | //Logger.Write_Log("System/test_out", "", "3.9 "); |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | //Logger.Write_Log("System/test_out", "", "3.10 "); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound, task.TaskNum); |
| | | //Logger.Write_Log("System/test_out", "", "3.11 "); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | //Logger.Write_Log("System/test_out", "", "3.12 "); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | #region åä¼ é»è¾å¤ç |
| | | try |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.13 "); |
| | | PickAndPostRequest request = new PickAndPostRequest(); |
| | | List<PickAndPost> itemData = new List<PickAndPost>(); |
| | | request.ITEMDATA = itemData; |
| | | request.WH_NUMBER = AppSettings.Configuration["SYSNO"]; |
| | | request.SYSNOD = AppSettings.Configuration["SYSNO"]; |
| | | request.WERKS = AppSettings.Configuration["CallMaterialID"]; |
| | | |
| | | request.WERKS = AppSettings.Configuration["WERKS"]; |
| | | |
| | | Dt_OutboundOrderDetail_Hty detail = _outboundOrderDetail_HtyRepository.QueryFirst(x => x.SourceId.ToString() == task.Remark);// task.Remarkåéæ±æç»ID |
| | | if (detail != null) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.14 "); |
| | | Dt_OutboundOrder_Hty outboundOrder = _outboundOrder_HtyRepository.QueryFirst(x => x.SourceId == detail.OrderId); |
| | | if (outboundOrder != null) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.15 "); |
| | | Dt_OutBoundOrderBYD outboundOrderBYD = _outBoundOrderBYDRepository.QueryFirst(x => x.REQUIREMENT_NO == outboundOrder.OrderNo); |
| | | if (outboundOrderBYD != null) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.16 "); |
| | | |
| | | Dt_OutboundOrderDetailBYD outboundOrderDetailBYD = _outboundOrderDetailByDRepository.QueryFirst(x => x.REQUIREMENT_NO == outboundOrderBYD.REQUIREMENT_NO && x.REQUIREMENT_ITEM_NO == detail.Remark);//detail.Remark åéæ±è¡ |
| | | //æ ¹æ®æçå·æ¥ç«åºçæ¡ç åæ¹æ¬¡è¿è¡åä¼ |
| | | foreach (var item in stockInfoCatch.Details) |
| | | { |
| | | //Logger.Write_Log("System/test_out", "", "3.17 "); |
| | | |
| | | Dt_LabelMaster labMaster = _labelMasterRepository.QueryFirst(x => x.LABEL_NO == item.SerialNumber); |
| | | |
| | | PickAndPost pickpost = new PickAndPost(); |
| | | pickpost.REQUIREMENT_NO = outboundOrderDetailBYD.REQUIREMENT_NO; |
| | | pickpost.REQUIREMENT_ITEM_NO = outboundOrderDetailBYD.REQUIREMENT_ITEM_NO; |
| | | pickpost.WERKS = outboundOrderBYD.WRKS; |
| | | pickpost.ORDERCODE = request.WERKS + request.WH_NUMBER + DateTime.Now.ToString("yyyyMMdd") + outboundOrderDetailBYD.Id.ToString("D6"); |
| | | pickpost.ORDERCODE_ITEM_NO = "1"; |
| | | pickpost.SYSNOD = outboundOrderBYD.SYSNOD; |
| | | pickpost.MATNR = outboundOrderDetailBYD.MATNR; |
| | | pickpost.LIFNR = "";//没æè¿åï¼ææ¶è½¬ç©º |
| | | pickpost.QTY = outboundOrderDetailBYD.QTY; |
| | | pickpost.QTY = labMaster.BOX_QTY ?? outboundOrderDetailBYD.QTY; |
| | | pickpost.BATCH = item.BatchNo;//åç«åºå
¥åºåºåçæ¡ç |
| | | pickpost.LGORT = outboundOrderBYD.LGORT; |
| | | pickpost.BUSINESS_CODE = outboundOrderBYD.BUSINESS_CODE; |
| | |
| | | pickpost.STATION = outboundOrderBYD.STATION; |
| | | pickpost.SPLIT = outboundOrderBYD.SPLIT; |
| | | pickpost.LABEL_NO = item.SerialNumber;//åç«åºå
¥åºåºåçæ¡ç |
| | | pickpost.Pack_LABEL_NO = null; |
| | | pickpost.pallet_label_no = null; |
| | | pickpost.CREATE_DATE = outboundOrderBYD.CREATE_DATE; |
| | | pickpost.UPDATE_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | pickpost.STATUS = outboundOrderBYD.STATUS; |
| | | pickpost.MO_NO = null; |
| | | itemData.Add(pickpost); |
| | | |
| | | //Logger.Write_Log("System/test_out", "", "3.18 "); |
| | | } |
| | | _sys_JobService.CallPickAndPost(request);//åä¼ |
| | | //Logger.Write_Log("System/test_out", "", "3.19 "); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | //Logger.Write_Log("System/test_out", "empt ", "3.0 "); |
| | | _unitOfWorkManage.BeginTran(); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | //Logger.Write_Log("System/test_out", "empt ", "3.1 "); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public WebResponseContent OutboundTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutCancel.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | locationEnd.LocationStatus= LocationStatusEnum.Free.ObjToInt(); |
| | | locationEnd.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.RelocationFree(locationStart, task.TaskNum); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationEnd); |
| | | |
| | |
| | | } |
| | | public bool DepthTask(Dt_LocationInfo location) |
| | | { |
| | | if (location != null ) |
| | | if (location != null) |
| | | { |
| | | Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.RoadwayNo == location.RoadwayNo && x.Column == location.Column && x.Layer == location.Layer && x.Depth != location.Depth && x.Row != location.Row && (SqlFunc.Abs(x.Row - location.Row) == 1)); |
| | | if (locations != null) |
| | |
| | | { |
| | | expression = x => x.Creater == App.User.UserName; |
| | | } |
| | | var task = BaseDal.Db.Queryable<Dt_Task>().OrderByDescending(x => x.CreateDate).Take(10).Select(x => new Dt_Task { TaskNum = x.TaskNum, PalletCode=x.PalletCode, TaskType=x.TaskType,SourceAddress=x.SourceAddress,TargetAddress=x.TargetAddress }).ToList(); |
| | | var task = BaseDal.Db.Queryable<Dt_Task>().OrderByDescending(x => x.CreateDate).Take(10).Select(x => new Dt_Task { TaskNum = x.TaskNum, PalletCode = x.PalletCode, TaskType = x.TaskType, SourceAddress = x.SourceAddress, TargetAddress = x.TargetAddress }).ToList(); |
| | | content = WebResponseContent.Instance.OK(data: task); |
| | | } |
| | | catch (Exception ex) |