| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | |
| | | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | |
| | | return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æçåºåºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PalletOutboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | |
| | | case (int)TaskInStatusEnum.SC_InFinish: |
| | | content = UpdateTaskStatusInFinish(task); |
| | | break; |
| | | case (int)TaskInStatusEnum.Car_InFinish: |
| | | content = InboundTaskCompleted(task); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | task.TaskState = nextStatus; |
| | | switch (nextStatus) |
| | | { |
| | | case (int)TaskOutStatusEnum.SC_OutFinish: |
| | | case (int)TaskOutStatusEnum.SC_OutFinish://æ´æ°è´§ä½ä¿¡æ¯ |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡ç¶æå®æ |
| | | /// </summary> |
| | |
| | | WebResponseContent content = new WebResponseContent().OK(); |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);//ç»çåºå |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);//è´§ä½ |
| | | var result = CheckCompleted(stockInfo, locationInfo); |
| | | if (!result.Item1) throw new Exception(result.Item2); |
| | | |
| | | |
| | | if (stockInfo.StockStatus != StockStatusEmun.å
¥åºä¸.ObjToInt()) throw new Exception($"æç[{task.PalletCode}],该ç»çç¶æä¸å¯å
¥åº"); |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | locationInfo.CurrentQty++; |
| | | locationInfo.LocationStatus = locationInfo.MaxQty - locationInfo.CurrentQty == 0 ? LocationStatusEnum.Fullload.ObjToInt() : LocationStatusEnum.InStock.ObjToInt(); |
| | | using (TransactionScope scope = new TransactionScope()) |
| | | Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault(x => x.StockId == stockInfo.Id); |
| | | |
| | | #region å
¥åºå |
| | | Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo); |
| | | if (inboundOrder == null || inboundOrder.Details == null) throw new Exception($"æªæ¾å°æç[{task.PalletCode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | | Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo && x.MaterielCode == stockInfoDetail.MaterielCode); |
| | | inboundOrderDetail.OverInQuantity++; |
| | | inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); |
| | | |
| | | if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null) |
| | | { |
| | | BaseDal.UpdateData(task); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | scope.Complete(); |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 夿æ¯å¦ä¸ºå åæºåæ¾è´§ä½ |
| | | if(task.IsPickPlace) |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | //List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.Repository.LocationCodesGetStockInfos(stockInfo.LocationCode).Where(x => x.StockStatus == StockStatusEmun.å·²å
¥åº.ObjToInt()).ToList(); |
| | | //stockInfo.SerialNumber = stockInfos.Count + 1; |
| | | stockInfo.InDate= DateTime.Now; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | stockInfoDetail.Status = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = locationInfo.MaxQty - locationInfo.CurrentQty == 0 ? LocationStatusEnum.Fullload.ObjToInt() : LocationStatusEnum.InStock.ObjToInt(); |
| | | |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.UpdateData(task); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail); |
| | | _inboundService.InbounOrderService.Repository.UpdateData(inboundOrder); |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | Db.Ado.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |