Exemplo n.º 1
0
        public static CE_MarketingType OutPutBusinessTypeConvertToMarketingType(CE_OutPutBusinessType outPutType)
        {
            CE_MarketingType result = CE_MarketingType.未知;

            switch (outPutType)
            {
            case CE_OutPutBusinessType.领料:
                result = CE_MarketingType.领料;
                break;

            case CE_OutPutBusinessType.营销出库:
                result = CE_MarketingType.出库;
                break;

            case CE_OutPutBusinessType.营销退货:
            case CE_OutPutBusinessType.采购退货:
            case CE_OutPutBusinessType.自制件退货:
                result = CE_MarketingType.退货;
                break;

            default:
                break;
            }

            return(result);
        }
        /// <summary>
        /// 赋值账务信息_出
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        /// <param name="detail1">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        S_FetchGoodsDetailBill AssignDetailInfo_Out(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut,
                                                    View_Business_WarehouseOutPut_OutPutDetail detail1)
        {
            ServerModule.IStoreServer storeService = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>();
            IFlowServer           serverFlow       = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();
            CommonProcessInfo     processInfo      = new CommonProcessInfo();
            CE_OutPutBusinessType OutPutType       =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType);

            S_FetchGoodsDetailBill fetchDetail = new S_FetchGoodsDetailBill();

            fetchDetail.AssociatedBillNo   = detail1.关联业务;
            fetchDetail.AssociatedBillType = CE_BillTypeEnum.入库申请单.ToString();
            fetchDetail.BatchNo            = detail1.批次号;
            fetchDetail.BillTime           = ServerTime.Time;
            fetchDetail.DepartDirector     = "";
            fetchDetail.Department         = lnqOutPut.ApplyingDepartment;
            fetchDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称;

            fetchDetail.Price = 0;
            //Math.Round(detail1.单价 * detail1.数量, 2);
            fetchDetail.UnitPrice = 0;
            //detail1.单价;

            processInfo = serverFlow.GetFlowData(detail1.关联业务).First();

            fetchDetail.FillInDate      = Convert.ToDateTime(processInfo.时间);
            fetchDetail.FillInPersonnel = processInfo.人员;

            fetchDetail.FetchBIllID   = lnqOutPut.BillNo;
            fetchDetail.FetchCount    = detail1.数量;
            fetchDetail.GoodsID       = detail1.物品ID;
            fetchDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType);
            fetchDetail.Provider      = detail1.供应商;
            fetchDetail.Remark        = detail1.备注;
            fetchDetail.StorageID     = lnqOutPut.StorageID;

            DataTable stockTable = storeService.GetGoodsStockInfo(fetchDetail.GoodsID, fetchDetail.BatchNo, fetchDetail.Provider, fetchDetail.StorageID);

            if (stockTable != null && stockTable.Rows.Count > 0)
            {
                fetchDetail.ProviderBatchNo = stockTable.Rows[0]["ProviderBatchNo"].ToString();
            }
            else
            {
                fetchDetail.ProviderBatchNo = "";
            }

            fetchDetail.Using = lnqOutPut.BillTypeDetail;

            return(fetchDetail);
        }
        /// <summary>
        /// 赋值账务信息_入
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        /// <param name="detail1">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        S_InDepotDetailBill AssignDetailInfo_In(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut,
                                                View_Business_WarehouseOutPut_OutPutDetail detail1)
        {
            IFlowServer           serverFlow  = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();
            CommonProcessInfo     processInfo = new CommonProcessInfo();
            CE_OutPutBusinessType OutPutType  =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType);

            S_InDepotDetailBill inDepotDetail = new S_InDepotDetailBill();

            inDepotDetail.AffrimPersonnel = BasicInfo.LoginName;
            inDepotDetail.BatchNo         = detail1.批次号;
            inDepotDetail.BillTime        = ServerTime.Time;
            inDepotDetail.Department      = UniversalFunction.GetDeptName(lnqOutPut.ApplyingDepartment);
            inDepotDetail.Depot           = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称;

            inDepotDetail.FactPrice = 0;
            //Math.Round(detail1.单价 * detail1.数量, 2);
            inDepotDetail.FactUnitPrice = 0;
            //detail1.单价;
            inDepotDetail.Price            = inDepotDetail.FactPrice;
            inDepotDetail.UnitPrice        = inDepotDetail.FactUnitPrice;
            inDepotDetail.InvoicePrice     = null;
            inDepotDetail.InvoiceUnitPrice = null;

            processInfo = serverFlow.GetFlowData(detail1.关联业务).First();

            inDepotDetail.FillInDate      = Convert.ToDateTime(processInfo.时间);
            inDepotDetail.FillInPersonnel = processInfo.人员;

            inDepotDetail.InDepotBillID = lnqOutPut.BillNo;
            inDepotDetail.InDepotCount  = -detail1.数量;
            inDepotDetail.GoodsID       = detail1.物品ID;
            inDepotDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType);
            inDepotDetail.Provider      = detail1.供应商;
            inDepotDetail.Remark        = detail1.备注;
            inDepotDetail.StorageID     = lnqOutPut.StorageID;

            return(inDepotDetail);
        }
        /// <summary>
        /// 结束业务
        /// </summary>
        /// <param name="billNo">业务编号</param>
        public void FinishBill(string billNo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            ctx.Connection.Open();
            ctx.Transaction = ctx.Connection.BeginTransaction();

            try
            {
                Business_WarehouseOutPut_OutPut lnqOutPut  = GetSingleBillInfo(billNo);
                CE_OutPutBusinessType           OutPutType =
                    GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType);

                switch (OutPutType)
                {
                case CE_OutPutBusinessType.采购退货:
                case CE_OutPutBusinessType.自制件退货:
                case CE_OutPutBusinessType.营销退货:
                    OperationDetailAndStock_In(ctx, lnqOutPut);
                    break;

                case CE_OutPutBusinessType.领料:
                case CE_OutPutBusinessType.营销出库:
                    OperationDetailAndStock_Out(ctx, lnqOutPut);
                    break;

                default:
                    break;
                }

                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        public static CE_SubsidiaryOperationType OutPutBusinessTypeConvertToSubsidiaryOperationType(CE_OutPutBusinessType outPutType)
        {
            CE_SubsidiaryOperationType subsdiaryType = CE_SubsidiaryOperationType.未知;

            switch (outPutType)
            {
            case CE_OutPutBusinessType.领料:
                subsdiaryType = CE_SubsidiaryOperationType.领料;
                break;

            case CE_OutPutBusinessType.营销出库:
                subsdiaryType = CE_SubsidiaryOperationType.营销出库;
                break;

            case CE_OutPutBusinessType.营销退货:
                subsdiaryType = CE_SubsidiaryOperationType.营销退货;
                break;

            case CE_OutPutBusinessType.采购退货:
                subsdiaryType = CE_SubsidiaryOperationType.采购退货;
                break;

            case CE_OutPutBusinessType.自制件退货:
                subsdiaryType = CE_SubsidiaryOperationType.自制件退货;
                break;

            default:
                break;
            }

            return(subsdiaryType);
        }