public void ICConfirm(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, ICReceiveReceipt cReceive) { try { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; builder.Path = $"{Conn.environment}/Erp/BO/Receipt.svc"; svcReceipt.ReceiptSvcContractClient _svcReceipt = GetClient <svcReceipt.ReceiptSvcContractClient, svcReceipt.ReceiptSvcContract>( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); _svcReceipt.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); svcReceipt.ReceiptTableset dsReceipt = new svcReceipt.ReceiptTableset(); string purPoint = string.Empty; string packSlip = string.Empty; bool requiresUserInput = false; string legalNumMsg = string.Empty; string closePO = string.Empty; _svcReceipt.ImportReceipt(cReceive.intQue, false, ref dsReceipt, out purPoint, out packSlip, out requiresUserInput, out legalNumMsg, out closePO); _svcReceipt.GetByID(cReceive.VendorNum, "", cReceive.DONum); _svcReceipt.CreateMassReceipts(cReceive.VendorNum, "", cReceive.DONum, cReceive.intQue, cReceive.PONum, ref dsReceipt); int Count = dsReceipt.RcvDtl.Count(); for (int i = 0; i < Count; i++) { dsReceipt.RcvDtl[i].Received = true; } _svcReceipt.Update(ref dsReceipt); _svcReceipt.ProcessIM(cReceive.intQue, cReceive.DONum, ref dsReceipt); } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } }
public void ReceiptUpdate(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, IEnumerable <PODetailSchedular> poDetail) { var pd = poDetail.First(); int packLn = 0, ln = 0; bool errFlg = false; //Set company and plant string comp = "", plant = ""; comp = string.IsNullOrEmpty(pd.company) ? Conn.Company : pd.company; plant = string.IsNullOrEmpty(pd.plant) ? Conn.Plant : pd.plant; try { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; builder.Path = $"{Conn.environment}/Erp/BO/Receipt.svc"; svcReceipt.ReceiptSvcContractClient svcReceipt = GetClient <svcReceipt.ReceiptSvcContractClient, svcReceipt.ReceiptSvcContract>( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); svcReceipt.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); string questionMsg = "", warnMsg = "", pPoint = ""; svcReceipt.ReceiptTableset dsReceipt = new svcReceipt.ReceiptTableset(); if (pd.isExist) { dsReceipt = svcReceipt.GetByID(pd.vendorNum, pd.purPoint, pd.RH_PackSlip); } else { svcReceipt.GetNewRcvHead(ref dsReceipt, 0, pd.purPoint); svcReceipt.GetPOInfo(ref dsReceipt, pd.poNum, true, out pPoint); } dsReceipt.RcvHead[0].PackSlip = pd.packSlip; svcReceipt.Update(ref dsReceipt); //IEnumerable<PORelease> pr = GetPORelList(pd.company, pd.plant, pd.poNum, pd.poLine, pd.qty).AsEnumerable(); IEnumerable <PORelease> pr = GetPORelList(comp, plant, pd.poNum, pd.poLine, pd.qty).AsEnumerable(); foreach (var prRow in pr) { svcReceipt.GetNewRcvDtl(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip); svcReceipt.CheckDtlJobStatus(pd.poNum, pd.poLine, prRow.poRelNum, pd.jobNum, out questionMsg, out warnMsg); ln = dsReceipt.RcvDtl.Count() - 1; dsReceipt.RcvDtl[ln].VendorNum = pd.vendorNum; dsReceipt.RcvDtl[ln].PurPoint = pd.purPoint; dsReceipt.RcvDtl[ln].PackSlip = pd.packSlip; dsReceipt.RcvDtl[ln].PONum = pd.poNum; dsReceipt.RcvDtl[ln].POLine = pd.poLine; dsReceipt.RcvDtl[ln].PORelNum = prRow.poRelNum; dsReceipt.RcvDtl[ln].OurQty = prRow.qty; dsReceipt.RcvDtl[ln].VendorQty = prRow.qty; dsReceipt.RcvDtl[ln].SupplierUnInvcReceiptQty = prRow.qty; dsReceipt.RcvDtl[ln].PUM = pd.uom; dsReceipt.RcvDtl[ln].LotNum = pd.LotNum; if (!String.IsNullOrEmpty(pd.warehouse)) { dsReceipt.RcvDtl[ln].WareHouseCode = pd.warehouse; dsReceipt.RcvDtl[ln].BinNum = pd.binNum; } dsReceipt.RcvDtl[ln].JobNum = pd.jobNum; dsReceipt.RcvDtl[ln].AssemblySeq = pd.assembly; dsReceipt.RcvDtl[ln].JobSeq = pd.seq; dsReceipt.RcvDtl[ln].Received = true; svcReceipt.GetDtlPOLineInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, pd.poLine); //packLn = dsReceipt.RcvDtl[ln].PackLine; svcReceipt.GetDtlPORelInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.poRelNum); //packLn = dsReceipt.RcvDtl[ln].PackLine; svcReceipt.GetDtlQtyInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.qty, pd.uom, "QTY"); svcReceipt.GetDtlVenQtyInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.qty); if (!String.IsNullOrEmpty(pd.warehouse)) { dsReceipt.RcvDtl[ln].WareHouseCode = pd.warehouse; dsReceipt.RcvDtl[ln].BinNum = pd.binNum; } svcReceipt.Update(ref dsReceipt); //packLn = dsReceipt.RcvDtl[ln].PackLine; } } catch (Exception ex) { //throw new Exception($"Epicor Error : {ex.Message.ToString()}"); errFlg = true; LogErrorDetails("PODetailTbl", pd.id, ex.Message.ToString(), "POReceipt->ReceiptUpdate"); UpdateProcessStatus(pd.id, Constants.StatusCode.ERR, pd.packSlip, packLn); } finally{ if (!errFlg) { UpdateProcessStatus(pd.id, Constants.StatusCode.COMP, pd.packSlip, packLn); } } }