Esempio n. 1
0
        public ActionResult DoPOProfileAction(POEntity item)
        {
            DateTime today = DateTime.Now;

            POEntity currentItem = UtilityModelClass.Models.Utility.CopyShadow <POEntity>(item);

            currentItem.CreateDate = (item.CreateDate);
            currentItem.UpdateDate = today;
            currentItem.UserID     = 1;

            DBPOProfile poProfile = new DBPOProfile();

            if (currentItem.POID > 0)
            {
                poProfile.DoPOProfileAction(enumActionItem.Edit, currentItem);
            }
            else
            {
                poProfile.DoPOProfileAction(enumActionItem.Insert, currentItem);
            }

            var jsonData = item;

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
 public LogInfo(POEntity entity)
 {
     this.OptIP        = "127.0.0.1";
     this.OptTime      = DateTime.Now;
     this.OptUserSysNo = 493;
     this.CompanyCode  = Settings.CompanyCode;
     this.TicketType   = Convert.ToInt32(Settings.TicketType);
 }
Esempio n. 3
0
        public void UpdateInvoiceInfo(int poSysNo)
        {
            POEntity po = CollectionPaymentDA.GetPOMaster(poSysNo);

            if (po == null)
            {
                throw new BizException(string.Format("不存在编号为{0}的PO单!", poSysNo));
            }
            if (4 != (int)po.Status.Value && 6 != (int)po.Status.Value)
            {
                throw new BizException("当前Po单不是部分入库或已入库状态,不能生成应付款!");
            }
        }
Esempio n. 4
0
        public static void InStock(POEntity po)
        {
            WMSRequest request = new WMSRequest()
            {
                Header      = ServiceAdapterHelper.ApplyMessageHeader()
                , OrderInfo = new WMSOrderInfo()
                {
                    OrderSysNo        = po.SysNo.Value
                    , OrderType       = "PO"
                    , WarehouseNumber = po.StockSysNo.ToString()
                }
            };

            List <WMSRequestProduct> products = new List <WMSRequestProduct>();

            foreach (var item in po.POItems)
            {
                products.Add(
                    new WMSRequestProduct()
                {
                    Code      = item.ProductID
                    , UnitQty = item.PurchaseQty
                });
            }

            WMSRequestWaitInStock req = new WMSRequestWaitInStock()
            {
                Action          = "ImportAsn"
                , OrderCode     = po.SysNo.ToString()
                , WarehouseCode = po.StockSysNo.ToString()
                , ProductList   = products
            };

            request.WaitInStock = req;

            IWMSMaintain service = ServiceBroker.FindService <IWMSMaintain>();

            try
            {
                WMSResponse response = service.WaitInStock(request);
                ServiceAdapterHelper.DealServiceFault(response.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IWMSMaintain>(service);
            }
        }
Esempio n. 5
0
 public DBPOCollection()
 {
     _currentpoentitiyItem    = new POEntity();
     _poentityItems           = new List <POEntity>();
     _currentpoentityviewItem = new POEntity_View();
     _poentityviewItems       = new List <POEntity_View>();
     _currentpodetailviewItem = new PODetail_View();
     _podetailviewItems       = new List <PODetail_View>();
     _currentpodetailItem     = new PODetail();
     _podetailItems           = new List <PODetail>();
     _currentaccountItem      = new Account();
     _accountItems            = new List <Account>();
     _currentdepartmentItem   = new Department();
     _departmentItems         = new List <Department>();
     _currentpartsmasterItem  = new PartsMaster();
     _partsmasterItems        = new List <PartsMaster>();
     _currentmasterItem       = new OrgMaster();
     _masterItemsList         = new List <OrgMaster>();
 }
Esempio n. 6
0
        public void DoPOProfileAction(enumActionItem action, POEntity item)
        {
            DatabaseClass <POEntity> dbc = new DatabaseClass <POEntity>();

            switch (action)
            {
            case enumActionItem.Edit:
                dbc.DoDBAction(item, enumActionItem.Edit);
                break;

            case enumActionItem.Insert:
                dbc.DoDBAction(item, enumActionItem.Insert);
                break;

            case enumActionItem.Delete:
                dbc.DoDBAction(item, enumActionItem.Delete, item.POID);
                break;
            }
        }
Esempio n. 7
0
        public IEnumerable <PODto> PODataAll(PODto podto)
        {
            try
            {
                POEntity poEntity = new POEntity
                {
                    login_entity = new LoginEntity
                    {
                        servername = podto.login_dto.servername,
                        username   = podto.login_dto.username,
                        password   = podto.login_dto.password,
                        dBname     = podto.login_dto.dBname
                    },
                };

                return(_mapper.Map <IEnumerable <POEntity>, IEnumerable <PODto> >
                           (_pORepository.GetPO(poEntity)));
            }
            catch (Exception ex)
            {
                logCentral.Error("PODataAll", ex);
                throw;
            }
        }
Esempio n. 8
0
        //private static void EIMSOper(POEntity PO)
        //{
        //    IEIMSInterfaceService service = null;
        //    try
        //    {
        //        service = ServiceBroker.FindService<IEIMSInterfaceService>(Settings.ConsumerName, Settings.EIMSLocationName);
        //        EIMSMessage<POAttachInfo> entity = new EIMSMessage<POAttachInfo>()
        //        {
        //            Header = new EIMSMessageHeader()
        //            {
        //                UserID = "493",
        //                CompanyCode = Settings.CompanyCode
        //            },
        //            Body = new POAttachInfo()
        //            {
        //                PONumber = PO.SysNo,
        //                InvoiceNumber = PO.PM_ReturnPointSysNo,
        //                UseInvoiceAmount = PO.UsingReturnPoint * -1,
        //                PostTime = System.DateTime.Now,
        //                UseTime = System.DateTime.Now,
        //                C3SysNo = PO.ReturnPointC3SysNo
        //            }
        //        };
        //        var result = service.PostPOCancel(entity);
        //        if (!result.IsSucceed)
        //        {
        //            throw new Exception(result.Error);
        //        }
        //        OnShowInfo(string.Format("采购单{0}需要调整返点成功", PO.SysNo));
        //    }
        //    catch (Exception e)
        //    {
        //        throw e;
        //    }
        //    finally
        //    {
        //        ServiceBroker.DisposeService<IEIMSInterfaceService>(service);
        //    }
        //}
        //public static void EIMSOper(List<POAttachInfo> poAttachEntitys, string userSysNo, int poSysNo)
        //{
        //    EIMSMessageResult returnValue = null;
        //    IEIMSInterfaceService service = null;
        //    try
        //    {
        //        EIMSMessage<List<POAttachInfo>> entity = new EIMSMessage<List<POAttachInfo>>
        //        {
        //            Header = new EIMSMessageHeader()
        //            {
        //                UserID = userSysNo,
        //                CompanyCode = Settings.CompanyCode
        //            },
        //            Body = poAttachEntitys
        //        };

        //        service = ServiceBroker.FindService<IEIMSInterfaceService>(Settings.ConsumerName, Settings.EIMSLocationName);
        //        returnValue = service.PostPOCancel(entity);
        //        if (!returnValue.IsSucceed)
        //        {
        //            throw new Exception(returnValue.Error);
        //        }
        //        OnShowInfo(string.Format("采购单{0}需要调整返点成功", poSysNo));
        //    }
        //    finally
        //    {
        //        ServiceBroker.DisposeService<IEIMSInterfaceService>(service);
        //    }
        //}

        private static void InventoryOper(POEntity poInfo)
        {
            InventoryAdjustContractInfo info = new InventoryAdjustContractInfo();

            info.SourceActionName      = InventoryAdjustSourceAction.AbandonForPO;
            info.SourceBizFunctionName = InventoryAdjustSourceBizFunction.PO_Order;
            info.AdjustItemList        = new List <InventoryAdjustItemInfo>();
            info.ReferenceSysNo        = poInfo.SysNo.ToString();
            foreach (var item in poInfo.Items)
            {
                info.AdjustItemList.Add(new InventoryAdjustItemInfo
                {
                    AdjustQuantity = -1 * item.PurchaseQty,
                    ProductSysNo   = item.ProductSysNo,
                    StockSysNo     = poInfo.StockSysNo
                });
            }

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["PORestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Update("/PurchaseOrder/AdjustPurchaseOrderQtyInventory", info, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
        }
Esempio n. 9
0
 public static void CreateFinancePayAndItem(POEntity entity, decimal payAmt, int userSysNo)
 {
 }
Esempio n. 10
0
        public static void AbandonPO(POEntity PO)
        {
            string logInfo = string.Empty;
            string halfday = string.Empty;

            if (PO.ETAHalfDay == "AM")
            {
                halfday = "上午";
            }
            else if (PO.ETAHalfDay == "PM")
            {
                halfday = "下午";
            }
            logInfo = string.Format("POSysNo:{0},StockSysNo:{1} ,ETATime:{2}{3}", PO.SysNo, PO.StockSysNo, PO.ETATime.Value.ToShortDateString(), halfday);
            try
            {
                //if (PO.PM_ReturnPointSysNo > 0)
                //{
                //    EIMSOper(PO);
                //}
                int userSysNo = 493;
                #region 返还返点信息
                //List<POAttachInfo> poAttachEntitys = new List<POAttachInfo>();
                //List<POEimsEntity> poEimsEntitys = GetPOEimsRelevanceInfo(PO.SysNo);
                //if (poEimsEntitys != null && poEimsEntitys.Count > 0)
                //{
                //    foreach (POEimsEntity poEims in poEimsEntitys)
                //    {
                //        POAttachInfo poAttachInfo = new POAttachInfo()
                //        {
                //            PONumber = PO.SysNo,
                //            InvoiceNumber = poEims.EIMSNo,
                //            UseInvoiceAmount = poEims.EIMSAmt * -1,
                //            PostTime = System.DateTime.Now,
                //            UseTime = System.DateTime.Now,
                //            C3SysNo = -1
                //        };
                //        poAttachEntitys.Add(poAttachInfo);
                //    }
                //    EIMSOper(poAttachEntitys, userSysNo.ToString(), PO.SysNo);
                //}
                #endregion

                InventoryOper(PO);

                //但放到前面则会报:等待入库和等待分配的采购单只能添加预付款单!
                //为已付款的PO产生POAjust时需在作废PO单之前,否则报业务异常:已作废、关闭、初始状态的采购单不能添加付款单!
                var fpItem = MonitorDA.GetFinacePayItemByPOSysNo(PO.SysNo);
                if (fpItem != null && fpItem.AvailableAmt > 0) //如果找到已付款的则调用财务接品生成POAjust单
                {
                    MonitorDA.InsertFinancePayAndItem(fpItem, userSysNo);
                }

                MonitorDA.AbandonPO(PO.SysNo, Settings.CompanyCode);
                MonitorDA.AbandonETA(PO.SysNo);
                foreach (var poItem in PO.Items)
                {
                    MonitorDA.UpdateExtendPOInfo(poItem.SysNo, Settings.CompanyCode, poItem.ProductSysNo);
                }

                //CRL17821 发送关闭消息
                SendCloseMessage(PO.SysNo, userSysNo);

                Logger.WriteLog("JOB自动作废PO单Success" + logInfo, "JobConsole", PO.SysNo.ToString());
                OnShowInfo(string.Format("采购单{0}作废成功.", PO.SysNo));
            }
            catch (Exception ex)
            {
                Logger.WriteLog(DateTime.Now + "JOB自动作废PO单Failed。" + logInfo + "\r\n" + ex.Message.ToString(),
                                "JobConsole",
                                PO.SysNo.ToString()
                                );
                OnShowInfo(string.Format("采购单{0}作废失败:\r\n{1}.", PO.SysNo, ex.Message));
            }
        }
Esempio n. 11
0
        ///// <summary>
        ///// 校验so是否满足出库条件
        ///// </summary>
        ///// <param name="so"></param>
        //private bool Validation(SOEntity so)
        //{

        //    if (so.SOItemList == null || so.SOItemList.Count == 0)
        //    {
        //        throw new Exception("没有商品信息");
        //    }

        //    //支付方式
        //    if (so.PaymentMethod == 0 && so.IsPayWhenRecv != 0)
        //    {
        //        throw new Exception("支付方式异常");
        //    }

        //    //应收款验证
        //    if(so.ReceivableAmt==0)
        //    {
        //        if (so.PaymentMethod.Value != 0
        //            || so.PayTypeSysNo==null)
        //        {
        //            throw new Exception("代收款异常");

        //        }

        //    }

        //    //


        //    return true;
        //}

        /// <summary>
        /// 调用WMS接口,导入入库单
        /// </summary>
        /// <param name="so"></param>
        private void InStock(POEntity po)
        {
            ThirdPartServiceAdapter.InStock(po);
        }
Esempio n. 12
0
 public static void FillItemAndPOInfo(POEntity po)
 {
     po.POItems = PODA.GetPOItemListByPOSysNo(po.SysNo.Value);
 }