| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | Dt_ProOutOrder proOutOrder = _outboundRepository.ProOutOrderRepository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOutOrderNo == outOrderDTO.OrderNo).Includes(x => x.Details).First(); |
| | | if (proOutOrder==null) |
| | | { |
| | | return content.Error($"æªæ¾å°åºåºå{outOrderDTO.OrderNo}"); |
| | | } |
| | | if (proOutOrder.ProOrderStatus==OutOrderStatusEnum.åºåºå®æ.ObjToInt() || proOutOrder.ProOrderStatus == OutOrderStatusEnum.åºåºä¸.ObjToInt()) |
| | | { |
| | | return content.Error("åºåºåæ§è¡ä¸"); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundRepository.ProOutOrderRepository.DeleteData(proOutOrder); |
| | | _outboundRepository.ProOutOrderDetailRepository.DeleteData(proOutOrder.Details); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK("æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | |
| | | /// æååºå¾
åè´§åº(å¹³åº)+忥ERPåºåº(ç»å®äºåºåºååºå) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutProductPK(string[] OutPKCodes,string ProOutNo) |
| | | public WebResponseContent OutProductPK(SaveModel saveModel, string ProOutNo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<string> OutPKCodes = saveModel.DelKeys.Select(x => x.ToString()).ToList(); |
| | | if (OutPKCodes.IsNullOrEmpty()) |
| | | { |
| | | return content.Error("ä¸è½ä¸ºç©º"); |
| | |
| | | }; |
| | | _stockRepository.ProStockInfoRepository.DeleteAndMoveIntoHty(proStockInfos, OperateTypeEnum.èªå¨å®æ); |
| | | _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(proStockInfoDetails, OperateTypeEnum.èªå¨å®æ); |
| | | WebResponseContent contentSaveInfos = SaveOutProPKInfos(proStockInfos); |
| | | if (!contentSaveInfos.Status) |
| | | { |
| | | throw new Exception(contentSaveInfos.Message); |
| | | }; |
| | | string response = _invokeERPService.InvokeProOutApi(proOutOrderModel); |
| | | ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>(); |
| | | if (erpRequestContent.res != 1) |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// è·ååºåºææçå¤å
å
æç» |
| | | /// </summary> |
| | | /// <param name="proStockInfos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent SaveOutProPKInfos(List<Dt_ProStockInfo> proStockInfos) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_OutProPKStockInfo> outProPKStockInfos = new List<Dt_OutProPKStockInfo>(); |
| | | foreach (var fromItem in proStockInfos) |
| | | { |
| | | foreach (var lordItem in fromItem.proStockInfoDetails) |
| | | { |
| | | Dt_OutProPKStockInfo outProPKStockInfo = new Dt_OutProPKStockInfo() |
| | | { |
| | | PCode = lordItem.ProductCode, |
| | | PVer=lordItem.ProductVersion, |
| | | PLot=lordItem.ProductVersion, |
| | | DateCode=lordItem.DateCode, |
| | | StockId=fromItem.Id, |
| | | OriginalQuantity=lordItem.StockPcsQty, |
| | | AssignQuantity=lordItem.StockPcsQty, |
| | | PalletCode=fromItem.PalletCode, |
| | | Unit="PCS" |
| | | }; |
| | | outProPKStockInfos.Add(outProPKStockInfo); |
| | | } |
| | | } |
| | | Db.InsertNav(outProPKStockInfos).Include(x=>x).ExecuteCommand(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | //æ ¹æ®å
å
åºåº |
| | | public WebResponseContent BagProductPK(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var outOrder = saveModel.MainData["proOutNo"].ToString(); |
| | | var outBags = saveModel.DelKeys.Select(x => x.ToString()).ToList(); |
| | | if (outBags.Count<=0) |
| | | { |
| | | return content.Error("å
å
ä¿¡æ¯è·å失败"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | |
| | | { |
| | | Way = 1, |
| | | StockOutCode = _outboundOrderService.CreateCodeByRule(nameof(RuleCodeEnum.ProOutCOdeRule)), |
| | | ConfirmedUserNo = "admin", |
| | | AssignUserNo = "admin", |
| | | ConfirmedUserNo = App.User.UserName, |
| | | AssignUserNo = App.User.UserName, |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | ShipDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | DeliverplanCode = proOutOrder.ProOutOrderNo, |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// PDAè·ååºåºåæ® |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetProOutOrders(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | int pageNo = saveModel.MainData["pageNo"].ObjToInt(); |
| | | int warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | string orderNo = saveModel.MainData["orderNo"].ToString(); |
| | | List<Dt_ProOutOrder> proOutOrders = new List<Dt_ProOutOrder>(); |
| | | if (string.IsNullOrEmpty(orderNo)) |
| | | { |
| | | proOutOrders = Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOrderStatus == OutOrderStatusEnum.åºåºä¸.ObjToInt() && x.WarehouseId == warehouseId).Includes(x=>x.Details).OrderByDescending(x => x.Id).ToPageList(pageNo, 5); |
| | | } |
| | | else |
| | | { |
| | | proOutOrders = Db.Queryable<Dt_ProOutOrder>().Where(x => (x.ProOutOrderNo.Contains(orderNo) || x.ProOutOrderNo.Contains(orderNo)) && x.ProOrderStatus == OutOrderStatusEnum.åºåºä¸.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.Id).Includes(x => x.Details).ToPageList(pageNo, 5); |
| | | } |
| | | |
| | | content.OK(data: proOutOrders); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// è·åæ«ç è·å订åæç»ä¿¡æ¯ |
| | | /// </summary> |
| | | public WebResponseContent GetOrderDetails(int keyId) |
| | | { |
| | | WebResponseContent content=new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·ååºåºåå· |
| | | Dt_ProOutOrder proOutOrder = BaseDal.QueryFirst(x => x.Id == keyId); |
| | | if (proOutOrder == null) |
| | | { |
| | | return content.Error($"æªæ¾å°åºåºå{proOutOrder.ProOutOrderNo}"); |
| | | } |
| | | //è·åå½åå·²ç»å®çå¤å
ç (åºåºç¶æ) |
| | | List<string> outBags = _stockRepository.ProStockInfoRepository.QueryData(x => x.StockStatus == StockStatusEmun.å¹³åºå¾
åè´§.ObjToInt() && x.ShipmentOrder== proOutOrder.ProOutOrderNo).Select(x=>x.PalletCode).ToList(); |
| | | //è·åæç» |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = _outboundRepository.ProOutOrderDetailRepository.QueryData(x=>x.ProOrderId==keyId).OrderBy(x=>x.ProOrderDetailStatus).ThenBy(x=>x.Id).ToList(); |
| | | content.OK("æå", new { outBags, proOutOrderDetails }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |