/// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息</returns>
        S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext ctx, S_FrockInDepotBill bill, S_FrockInDepotGoodsBill item)
        {
            IPersonnelInfoServer serverPersonnelInfo = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>();
            View_HR_Personnel    lnqPersonnel        = UniversalFunction.GetPersonnelInfo(ctx, bill.JJRYID);
            S_InDepotDetailBill  lnqDetailBill       = new S_InDepotDetailBill();

            View_F_GoodsPlanCost lnqBasicGoodsInfo = UniversalFunction.GetGoodsInfo(ctx, item.GoodsID);

            lnqDetailBill.ID              = Guid.NewGuid();
            lnqDetailBill.BillTime        = (DateTime)bill.InDepotDate;
            lnqDetailBill.FillInPersonnel = lnqPersonnel.姓名;
            lnqDetailBill.Department      = lnqPersonnel.部门名称;
            lnqDetailBill.FactPrice       = 0;
            lnqDetailBill.FactUnitPrice   = 0;
            lnqDetailBill.GoodsID         = item.GoodsID;
            lnqDetailBill.BatchNo         = item.BatchNo;
            lnqDetailBill.InDepotBillID   = bill.Bill_ID;
            lnqDetailBill.InDepotCount    = item.Amount;
            lnqDetailBill.Price           = 0;
            lnqDetailBill.UnitPrice       = 0;
            lnqDetailBill.OperationType   = (int)CE_SubsidiaryOperationType.自制件工装入库;
            lnqDetailBill.Provider        = bill.Provider;
            lnqDetailBill.StorageID       = bill.StorageID;
            lnqDetailBill.AffrimPersonnel = bill.DepotManager;
            lnqDetailBill.FillInDate      = bill.Bill_Time;

            return(lnqDetailBill);
        }
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息</returns>
        public S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext context, S_MaterialRejectBill bill,
                                                    S_MaterialListRejectBill item)
        {
            IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
            BASE_BillType   billType = server.GetBillTypeFromName("采购退货单");

            if (billType == null)
            {
                throw new Exception("获取不到单据类型信息");
            }


            S_InDepotDetailBill detailBill = new S_InDepotDetailBill();

            detailBill.ID              = Guid.NewGuid();
            detailBill.BillTime        = (DateTime)bill.OutDepotDate;
            detailBill.FillInPersonnel = bill.FillInPersonnel;
            detailBill.Department      = UniversalFunction.GetDeptInfo(context, bill.Department).部门名称;
            detailBill.FactPrice       = -Math.Round(item.UnitPrice * item.Amount, 2);
            detailBill.FactUnitPrice   = item.UnitPrice;
            detailBill.GoodsID         = item.GoodsID;
            detailBill.BatchNo         = item.BatchNo;
            detailBill.Provider        = item.Provider;
            detailBill.InDepotBillID   = bill.Bill_ID;
            detailBill.InDepotCount    = -item.Amount;
            detailBill.UnitPrice       = item.UnitPrice;
            detailBill.Price           = -Math.Round(item.UnitPrice * item.Amount, 2);
            detailBill.OperationType   = (int)GlobalObject.CE_SubsidiaryOperationType.采购退货;
            detailBill.StorageID       = bill.StorageID;
            detailBill.Remark          = "退货原因:" + bill.Reason + " 备注:" + bill.Remark;
            detailBill.AffrimPersonnel = bill.DepotManager;
            detailBill.FillInDate      = bill.Bill_Time;

            return(detailBill);
        }
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息</returns>
        public S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext dataContext, S_OrdinaryInDepotBill bill,
                                                    S_OrdinaryInDepotGoodsBill item)
        {
            IPersonnelInfoServer personnelServer = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>();

            S_InDepotDetailBill  detailBill     = new S_InDepotDetailBill();
            View_HR_Personnel    personnel      = UniversalFunction.GetPersonnelInfo(dataContext, bill.BuyerCode);
            View_F_GoodsPlanCost basicGoodsInfo = UniversalFunction.GetGoodsInfo(dataContext, item.GoodsID);

            detailBill.ID              = Guid.NewGuid();
            detailBill.BillTime        = (DateTime)bill.InDepotDate;
            detailBill.FillInPersonnel = personnel.姓名;
            detailBill.Department      = personnel.部门名称;
            detailBill.FactPrice       = Math.Round((item.UnitPrice * (decimal)item.Amount), 2);
            detailBill.FactUnitPrice   = item.UnitPrice;
            detailBill.GoodsID         = item.GoodsID;
            detailBill.BatchNo         = item.BatchNo;
            detailBill.InDepotBillID   = bill.Bill_ID;
            detailBill.InDepotCount    = item.Amount;
            detailBill.Price           = Math.Round((item.UnitPrice * (decimal)item.Amount), 2);
            detailBill.UnitPrice       = item.UnitPrice;
            detailBill.OperationType   = (int)GlobalObject.CE_SubsidiaryOperationType.普通入库;
            detailBill.Provider        = bill.Provider;
            detailBill.StorageID       = bill.StorageID;
            detailBill.AffrimPersonnel = UniversalFunction.GetPersonnelInfo(bill.DepotManager).姓名;
            detailBill.FillInDate      = bill.Bill_Time;

            return(detailBill);
        }
        /// <summary>
        /// 根据单据信息操作账务信息与库存信息
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="bill">单据信息</param>
        public void OpertaionDetailAndStock(DepotManagementDataContext dataContext, S_MaterialReturnedInTheDepot bill)
        {
            MaterialListReturnedInTheDepot listService  = new MaterialListReturnedInTheDepot();
            IFinancialDetailManagement     serverDetail =
                ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>();

            var result = from r in dataContext.S_MaterialListReturnedInTheDepot
                         where r.Bill_ID == bill.Bill_ID
                         select r;

            if (result == null || result.Count() == 0)
            {
                throw new Exception("获取单据信息失败");
            }

            foreach (var item in result)
            {
                S_FetchGoodsDetailBill detailInfo = listService.AssignDetailInfo(dataContext, bill, item);
                S_Stock stockInfo = listService.AssignStockInfo(dataContext, bill, item);

                if (detailInfo == null || stockInfo == null)
                {
                    throw new Exception("获取账务信息或者库存信息失败");
                }

                serverDetail.ProcessFetchGoodsDetail(dataContext, detailInfo, stockInfo);
            }

            IStoreServer serviceStore = ServerModuleFactory.GetServerModule <IStoreServer>();

            serviceStore.Operation_MES_InProduction(dataContext, bill.Bill_ID);
        }
예제 #5
0
        /// <summary>
        /// 工具账务操作
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="billNo">单据号</param>
        /// <param name="goodsID">物品ID</param>
        /// <param name="provider">供应商</param>
        /// <param name="operationCount">操作数量</param>
        /// <param name="workID">操作人员ID</param>
        void ToolsOperation(DepotManagementDataContext ctx, string billNo, int goodsID, string provider,
                            decimal operationCount, string workID)
        {
            IToolsManage serverTools = ServerModule.ServerModuleFactory.GetServerModule <IToolsManage>();

            if (serverTools.IsTools(goodsID))
            {
                Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                    Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();
                IPersonnelInfoServer serverPersonnel = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>();

                View_HR_Personnel viewPersonnel = serverPersonnel.GetPersonnelInfo(workID);
                WS_WorkShopCode   tempWSCode    = serverWSBasic.GetPersonnelWorkShop(workID);

                S_MachineAccount_Tools toolsInfo = new S_MachineAccount_Tools();

                toolsInfo.GoodsID    = goodsID;
                toolsInfo.Provider   = provider;
                toolsInfo.StockCount = -operationCount;

                if (tempWSCode != null)
                {
                    toolsInfo.StorageCode = tempWSCode.WSCode;
                }
                else
                {
                    toolsInfo.StorageCode = viewPersonnel.部门编码;
                }

                serverTools.OpertionInfo(ctx, toolsInfo);
                serverTools.DayToDayAccount(ctx, toolsInfo, billNo);
            }
        }
예제 #6
0
        /// <summary>
        /// 借还货出库业务的处理
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="fetchGoodsDetailInfo">出库业务对象</param>
        void FetchLendReturn_MaterialRequisition(DepotManagementDataContext ctx, S_FetchGoodsDetailBill fetchGoodsDetailInfo)
        {
            if (fetchGoodsDetailInfo == null)
            {
                return;
            }

            if (Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启借还货账务管理]))
            {
                BASE_SubsidiaryOperationType operationType = UniversalFunction.GetSubsidiaryOperationType(ctx, fetchGoodsDetailInfo.OperationType);

                if (operationType.LendReturnType != null)
                {
                    IProductLendReturnService serverLendReturn = ServerModuleFactory.GetServerModule <IProductLendReturnService>();

                    var varData = from a in ctx.View_S_MaterialRequisitionProductReturnList
                                  where a.单据号 == fetchGoodsDetailInfo.FetchBIllID &&
                                  a.还账物品ID == fetchGoodsDetailInfo.GoodsID &&
                                  a.还账物品批次号 == fetchGoodsDetailInfo.BatchNo &&
                                  a.还账物品供应商 == fetchGoodsDetailInfo.Provider
                                  select a;

                    if (varData.Count() > 0)
                    {
                        foreach (var item1 in varData)
                        {
                            S_ProductLendRecord tempRecord =
                                serverLendReturn.GetStockSingleInfo(ctx, BasicInfo.DeptCode, fetchGoodsDetailInfo.StorageID, item1.账物品ID,
                                                                    item1.账物品批次号, item1.账物品供应商);

                            if (tempRecord != null)
                            {
                                S_ProductLendReturnDetail tempDetail = new S_ProductLendReturnDetail();

                                tempDetail.Affirm         = fetchGoodsDetailInfo.DepotManager;
                                tempDetail.AffirmDate     = ServerTime.Time;
                                tempDetail.BatchNo        = item1.账物品批次号;
                                tempDetail.Provider       = item1.账物品供应商;
                                tempDetail.BillNo         = fetchGoodsDetailInfo.FetchBIllID;
                                tempDetail.BillTime       = ServerTime.Time;
                                tempDetail.Credit         = fetchGoodsDetailInfo.StorageID;
                                tempDetail.Debtor         = BasicInfo.DeptCode;
                                tempDetail.GoodsID        = item1.账物品ID;
                                tempDetail.OperationCount = item1.还账数量;
                                tempDetail.OperationType  = fetchGoodsDetailInfo.OperationType;
                                tempDetail.Proposer       = fetchGoodsDetailInfo.FillInPersonnel;
                                tempDetail.ProposerDate   =
                                    fetchGoodsDetailInfo.FillInDate == null ? ServerTime.Time : Convert.ToDateTime(fetchGoodsDetailInfo.FillInDate);
                                tempDetail.UnitPrice = 0;

                                serverLendReturn.OperationDetailRecord(ctx, tempDetail);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 提交入库信息
        /// </summary>
        /// <param name="inDepotInfo">入库信息, 只取其中入库部分</param>
        /// <param name="returnInfo">添加完毕后查询数据库的返回结果</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作结果</returns>
        public bool SubmitInDepotInfo(S_OrdinaryInDepotBill inDepotInfo, out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_OrdinaryInDepotBill where r.Bill_ID == inDepotInfo.Bill_ID select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到入库单号为 [{0}] 的普通入库单!", inDepotInfo.Bill_ID);
                    return(false);
                }

                S_OrdinaryInDepotBill bill = result.Single();

                if (bill.BillStatus == CheckInDepotBillStatus.已入库.ToString())
                {
                    error = string.Format("入库单号为 [{0}] 单据状态为已入库", inDepotInfo.Bill_ID);
                    return(false);
                }

                bill.DepotManager = inDepotInfo.DepotManager;
                bill.BillStatus   = inDepotInfo.BillStatus;
                bill.InDepotDate  = ServerTime.Time;

                // 添加信息到入库明细表
                OpertaionDetailAndStock(dataContxt, bill);

                //更新工装库存状态

                IDepotTypeForPersonnel serverDepot = ServerModuleFactory.GetServerModule <IDepotTypeForPersonnel>();

                if (serverDepot.GetDepotInfo(bill.Depot).DepotName == GlobalObject.CE_GoodsType.工装.ToString() &&
                    bill.Bill_Time > Convert.ToDateTime("2012-4-21") &&
                    !UpdateFrockStockStatus(dataContxt, bill.Bill_ID, out error))
                {
                    return(false);
                }

                // 正式使用单据号
                m_assignBill.UseBillNo(dataContxt, "普通入库单", bill.Bill_ID);

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #8
0
        /// <summary>
        /// 完成自制件退货单
        /// </summary>
        /// <param name="billNo">自制件退货单据号</param>
        /// <param name="storeManager">仓库管理员</param>
        /// <param name="returnBill">返回更新后重新查询的自制件退货单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加采购退货单</returns>
        public bool FinishBill(string billNo, string storeManager, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_HomemadeRejectBill
                             where r.Bill_ID == billNo
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("没有找到单据号为 {0} 的自制件退货单信息,无法进行此操作", billNo);
                    return(false);
                }

                S_HomemadeRejectBill bill = result.Single();

                if (bill.BillStatus == MaterialRejectBillBillStatus.已完成.ToString())
                {
                    error = "单据不能重复退货";
                    return(false);
                }

                bill.DepotManager = storeManager;
                bill.BillStatus   = MaterialRejectBillBillStatus.已完成.ToString();
                bill.OutDepotDate = ServerTime.Time;

                IHomemadeRejectBill goodsServer = ServerModuleFactory.GetServerModule <IHomemadeRejectBill>();

                //操作账务信息与库存信息
                OpertaionDetailAndStock(dataContxt, bill);

                //更新隔离单单据状态
                if (!UpdateIsolationBillStatus(dataContxt, billNo, out error))
                {
                    return(false);
                }

                // 正式使用单据号
                m_assignBill.UseBillNo(dataContxt, "自制件退货单", bill.Bill_ID);
                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #9
0
        /// <summary>
        /// 删除合同信息
        /// </summary>
        /// <param name="bargainNumber">合同编号</param>
        /// <param name="returnBargainInfo">返回查询到的合同信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool DeleteBargainInfo(string bargainNumber, out IQueryResult returnBargainInfo, out string error)
        {
            error             = null;
            returnBargainInfo = null;

            try
            {
                DepotManagementDataContext       dataContxt  = CommentParameter.DepotDataContext;
                IBargainGoodsServer              goodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();
                IQueryable <View_B_BargainGoods> returnBargainGoods;

                if (!goodsServer.GetBargainGoods(bargainNumber, out returnBargainGoods, out error))
                {
                    return(false);
                }

                #region 检查此合同的订单信息

                IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();

                if (orderFormServer.GetOrderFormCollection(bargainNumber).Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有订单信息无法进行删除,请将所有此合同包含的订单信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                #endregion

                if (returnBargainGoods != null && returnBargainGoods.Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有零件信息无法进行删除,请将所有此合同包含的零件信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                Table <B_BargainInfo> table = dataContxt.GetTable <B_BargainInfo>();

                var delRow = from c in table
                             where c.BargainNumber == bargainNumber
                             select c;

                table.DeleteAllOnSubmit(delRow);
                dataContxt.SubmitChanges();

                return(GetAllBargainInfo(out returnBargainInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 赋值库存信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="goodsItem">明细信息</param>
        /// <returns>返回库存信息对象</returns>
        public S_Stock AssignStockInfo(DepotManagementDataContext context, S_MaterialReturnedInTheDepot bill,
                                       S_MaterialListReturnedInTheDepot goodsItem)
        {
            if (goodsItem.ShelfArea == null || goodsItem.ColumnNumber == null || goodsItem.LayerNumber == null)
            {
                throw new Exception("仓库货架、层、列等信息不能为空,请修改后重新提交");
            }

            bool blIsOnlyForRepair = false;

            var resultbill = from a in context.S_MaterialReturnedInTheDepot
                             where a.Bill_ID == bill.Bill_ID
                             select a;

            if (resultbill.Count() != 1)
            {
                throw new Exception("数据不唯一或者为空");
            }
            else
            {
                blIsOnlyForRepair = resultbill.Single().IsOnlyForRepair.ToString() == ""
                    ? false : Convert.ToBoolean(resultbill.Single().IsOnlyForRepair);
            }

            S_Stock stock = new S_Stock();

            // 添加信息到库存
            IStoreServer storeServer = ServerModuleFactory.GetServerModule <IStoreServer>();

            stock.GoodsID         = goodsItem.GoodsID;
            stock.Provider        = goodsItem.Provider;
            stock.ProviderBatchNo = goodsItem.ProviderBatchNo;
            stock.BatchNo         = goodsItem.BatchNo;
            stock.ShelfArea       = goodsItem.ShelfArea;
            stock.ColumnNumber    = goodsItem.ColumnNumber;
            stock.LayerNumber     = goodsItem.LayerNumber;
            stock.ExistCount      = (decimal)goodsItem.ReturnedAmount;
            stock.Date            = ServerModule.ServerTime.Time;
            stock.StorageID       = bill.StorageID;

            if (blIsOnlyForRepair)
            {
                stock.GoodsStatus = 6;
            }

            return(stock);
        }
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        public S_FetchGoodsDetailBill AssignDetailInfo(DepotManagementDataContext context, S_MaterialReturnedInTheDepot bill,
                                                       S_MaterialListReturnedInTheDepot item)
        {
            IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
            BASE_BillType   billType = server.GetBillTypeFromName("领料退库单");

            if (billType == null)
            {
                throw new Exception("获取不到单据类型信息");
            }

            View_Department department = UniversalFunction.GetDeptInfo(context, bill.Department);

            //单价设置
            decimal dcStockUnitPrice = m_serverStore.GetGoodsUnitPrice(context, item.GoodsID, item.BatchNo, bill.StorageID);

            //S_FetchGoodsDetailBill用于存放每次领料、领料退库的明细信息
            S_FetchGoodsDetailBill detailBill = new S_FetchGoodsDetailBill();

            detailBill.ID               = Guid.NewGuid();
            detailBill.FetchBIllID      = bill.Bill_ID;
            detailBill.BillTime         = ServerTime.Time;
            detailBill.FetchCount       = -item.ReturnedAmount;
            detailBill.GoodsID          = item.GoodsID;
            detailBill.BatchNo          = item.BatchNo;
            detailBill.ProviderBatchNo  = item.ProviderBatchNo;
            detailBill.Provider         = item.Provider;
            detailBill.Price            = -dcStockUnitPrice * (decimal)item.ReturnedAmount;
            detailBill.UnitPrice        = dcStockUnitPrice;
            detailBill.Department       = department.部门名称;
            detailBill.FillInPersonnel  = bill.FillInPersonnel;
            detailBill.FinanceSignatory = null;
            detailBill.DepartDirector   = bill.DepartmentDirector;
            detailBill.DepotManager     = bill.DepotManager;
            detailBill.OperationType    = (int)CE_SubsidiaryOperationType.领料退库;
            detailBill.StorageID        = bill.StorageID;
            detailBill.Remark           = "退库原因:" + bill.ReturnReason + ";备注:" + item.Remark;
            detailBill.FillInDate       = bill.Bill_Time;

            IMaterialRequisitionPurposeServer purposeServer =
                ServerModuleFactory.GetServerModule <IMaterialRequisitionPurposeServer>();

            detailBill.Using = string.Format("领料退库,初始用途:{0}", purposeServer.GetBillPurpose(context, bill.PurposeCode).Purpose);

            return(detailBill);
        }
예제 #12
0
        /// <summary>
        /// 插入临时表
        /// </summary>
        /// <param name="code">产品型号</param>
        /// <param name="count">数量</param>
        public void AddTempTable(string code, decimal count)
        {
            DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;
            S_ForWantingReportTemp     lnqFor      = new S_ForWantingReportTemp();

            IBasicGoodsServer serverGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>();

            string error = "";

            View_F_GoodsPlanCost tempLnq = serverGoods.GetGoodsInfo(code, "", out error);

            lnqFor.GoodsID = tempLnq == null ? 0 : tempLnq.序号;
            lnqFor.Count   = count;
            dataContext.S_ForWantingReportTemp.InsertOnSubmit(lnqFor);

            dataContext.SubmitChanges();
        }
        /// <summary>
        /// 采购员提交单据
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="status">提交后的单据状态</param>
        /// <param name="returnInfo">返回更新后重新查询的领料单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加领料单</returns>
        public bool SubmitNewBill(string billNo, OrdinaryInDepotBillStatus status, out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_OrdinaryInDepotBill
                             where r.Bill_ID == billNo
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("没有找到单据号为 {0} 的普通入库单信息,无法进行此操作", billNo);
                    return(false);
                }

                result.Single().BillStatus = status.ToString();
                result.Single().Bill_Time  = ServerModule.ServerTime.Time;

                if (!m_serverFrockStandingBook.DeleteFrockOrdinaryInDepotBill(dataContxt, billNo, out error))
                {
                    return(false);
                }

                //插入工装信息
                IDepotTypeForPersonnel serverDepot = ServerModuleFactory.GetServerModule <IDepotTypeForPersonnel>();

                if (serverDepot.GetDepotInfo(result.Single().Depot).DepotName == GlobalObject.CE_GoodsType.工装.ToString() &&
                    !CreateNewFrockMessage(result.Single(), out error))
                {
                    return(false);
                }

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #14
0
        /// <summary>
        /// 保存单据明细信息
        /// </summary>
        /// <param name="dataContxt">LINQ数据上下文</param>
        /// <param name="lstDetail">添加的表</param>
        /// <param name="djID">添加的行</param>
        /// <param name="billNo">单据号</param>
        public void SaveBillList(DepotManagementDataContext dataContxt, List <S_CannibalizeList> lstDetail, int djID, string billNo)
        {
            IProductCodeServer serverProductCode = ServerModuleFactory.GetServerModule <IProductCodeServer>();

            try
            {
                List <S_CannibalizeList> lisList = new List <S_CannibalizeList>();

                if (lstDetail.Count == 0)
                {
                    return;
                }

                DeleteList(dataContxt, djID);
                foreach (S_CannibalizeList item in lstDetail)
                {
                    S_CannibalizeList lnqList = new S_CannibalizeList();

                    lnqList.DJ_ID     = djID;
                    lnqList.GoodsID   = item.GoodsID;
                    lnqList.BatchNo   = item.BatchNo;
                    lnqList.UnitPrice = item.UnitPrice;
                    lnqList.Count     = item.Count;
                    lnqList.Price     = item.Price;
                    lnqList.Remark    = item.Remark;
                    lnqList.Provider  = item.Provider;

                    if (item.RepairStatus != null && item.RepairStatus.ToString() != "")
                    {
                        lnqList.RepairStatus = item.RepairStatus;
                    }

                    lisList.Add(lnqList);
                }

                dataContxt.S_CannibalizeList.InsertAllOnSubmit(lisList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #15
0
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="outSourcing">单据信息</param>
        /// <returns>返回账务信息</returns>
        S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext ctx, S_CheckOutInDepotForOutsourcingBill outSourcing)
        {
            S_InDepotDetailBill detailBill = new S_InDepotDetailBill();
            var varData = from a in ctx.S_InDepotDetailBill
                          where a.InDepotBillID == outSourcing.Bill_ID
                          select a;

            if (varData.Count() != 0)
            {
                throw new Exception("数据不唯一");
            }
            else
            {
                IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
                BASE_BillType   billType = server.GetBillTypeFromName("委外报检入库单");

                if (billType == null)
                {
                    throw new Exception("获取不到单据类型信息");
                }

                detailBill.ID              = Guid.NewGuid();
                detailBill.BillTime        = ServerTime.Time;
                detailBill.FillInPersonnel = outSourcing.DeclarePersonnel;
                detailBill.Department      = UniversalFunction.GetPersonnelInfo(ctx, outSourcing.DeclarePersonnel).部门名称;
                detailBill.FactPrice       = Math.Round(outSourcing.UnitPrice * outSourcing.InDepotCount, 2);
                detailBill.FactUnitPrice   = outSourcing.UnitPrice;
                detailBill.GoodsID         = outSourcing.GoodsID;
                detailBill.BatchNo         = outSourcing.BatchNo;
                detailBill.InDepotBillID   = outSourcing.Bill_ID;
                detailBill.InDepotCount    = outSourcing.InDepotCount;
                detailBill.Price           = Math.Round(outSourcing.UnitPrice * outSourcing.InDepotCount, 2);
                detailBill.UnitPrice       = outSourcing.UnitPrice;
                detailBill.OperationType   = (int)CE_SubsidiaryOperationType.委外报检入库;
                detailBill.Provider        = outSourcing.Provider;
                detailBill.StorageID       = outSourcing.StorageID;
                detailBill.AffrimPersonnel = outSourcing.ManagerPersonnel;
                detailBill.FillInDate      = outSourcing.DeclareTime;
            }

            return(detailBill);
        }
        /// <summary>
        /// 获取报检入库单信息
        /// </summary>
        /// <returns>返回是否成功获取库存信息</returns>
        public IQueryResult GetAllBill()
        {
            IAuthorization m_authorization = PlatformFactory.GetObject <IAuthorization>();
            IQueryResult   qr = null;

            try
            {
                if (QueryResultFilter == null)
                {
                    qr = m_authorization.Query("报检入库单查询", null);
                }
                else
                {
                    qr = m_authorization.Query("报检入库单查询", null, QueryResultFilter);
                }

                if (!qr.Succeeded)
                {
                    throw new Exception(qr.Error);
                }

                if (m_billUniqueID < 0)
                {
                    IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
                    BASE_BillType   billType = server.GetBillTypeFromName("报检入库单");

                    if (billType == null)
                    {
                        throw new Exception("获取不到单据类型信息");
                    }

                    m_billUniqueID = billType.UniqueID;
                }

                return(qr);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        /// <summary>
        /// 获取订单物品表中某一产品单价
        /// </summary>
        /// <param name="orderFormNumber">订单物品号</param>
        /// <param name="goodsID">物品ID</param>
        /// <returns>返回获取到的单价</returns>
        public decimal GetGoodsUnitPrice(string orderFormNumber, int goodsID)
        {
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            var result = from r in dataContxt.B_OrderFormInfo
                         where r.OrderFormNumber == orderFormNumber
                         select r;

            if (result.Count() == 0)
            {
                throw new Exception("找不到订单物品中对应的物品,无法获取物品单价!");
            }

            var varData = from a in dataContxt.B_OrderFormInfo
                          where a.OrderFormNumber == orderFormNumber
                          select a;

            IBargainGoodsServer bargainGoodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();

            return(bargainGoodsServer.GetGoodsUnitPrice(result.Single().BargainNumber, goodsID, varData.Single().Provider));
        }
        /// <summary>
        /// 获取普通入库单信息
        /// </summary>
        /// <param name="returnInfo">入库单</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool GetAllBill(out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;
            error      = null;

            IAuthorization authorization = PlatformFactory.GetObject <IAuthorization>();
            IQueryResult   qr            = null;

            if (QueryResultFilter == null)
            {
                qr = authorization.Query("普通入库单查询", null);
            }
            else
            {
                qr = authorization.Query("普通入库单查询", null, QueryResultFilter);
            }

            if (!qr.Succeeded)
            {
                error = qr.Error;
                return(false);
            }

            if (m_billUniqueID < 0)
            {
                IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
                BASE_BillType   billType = server.GetBillTypeFromName("普通入库单");

                if (billType == null)
                {
                    error = "获取不到单据类型信息";
                    return(false);
                }

                m_billUniqueID = billType.UniqueID;
            }

            returnInfo = qr;
            return(true);
        }
        /// <summary>
        /// 检查业务中是否存在此物品相关信息
        /// </summary>
        /// <param name="id">物品ID</param>
        /// <param name="prompt">存在时返回的提示信息</param>
        /// <returns>存在返回true, 不存在返回false</returns>
        public bool IsExistInBusiness(int id, out string prompt)
        {
            prompt = null;

            IStoreServer storeServer = ServerModuleFactory.GetServerModule <IStoreServer>();
            View_S_Stock storeData   = storeServer.GetGoodsStore(id);

            if (storeServer != null)
            {
                prompt = "库存中存在此物品的相关信息";
                return(true);
            }

            ICheckOutInDepotServer cs = ServerModuleFactory.GetServerModule <ICheckOutInDepotServer>();

            if (cs.IsExist(id))
            {
                prompt = "报检入库单中存在此物品的相关信息";
                return(true);
            }

            IOrdinaryInDepotGoodsBill og = ServerModuleFactory.GetServerModule <IOrdinaryInDepotGoodsBill>();

            if (og.IsExist(id))
            {
                prompt = "普通入库单中存在此物品的相关信息";
                return(true);
            }

            IHomemadePartInDepotServer hs = ServerModuleFactory.GetServerModule <IHomemadePartInDepotServer>();

            if (hs.IsExist(id))
            {
                prompt = "自制件入库单中存在此物品的相关信息";
                return(true);
            }

            return(false);
        }
예제 #20
0
        /// <summary>
        /// 删除订单信息
        /// </summary>
        /// <param name="listRole">角色列表</param>
        /// <param name="loginName">登录名</param>
        /// <param name="orderFormNumber">订单编号</param>
        /// <param name="returnOrderFormInfo">返回查询到的订单信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool DeleteOrderFormInfo(List <string> listRole, string loginName, string orderFormNumber,
                                        out IQueryable <View_B_OrderFormInfo> returnOrderFormInfo, out string error)
        {
            error = null;
            returnOrderFormInfo = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                IOrderFormGoodsServer goodsServer = ServerModuleFactory.GetServerModule <IOrderFormGoodsServer>();
                IQueryable <View_B_OrderFormGoods> returnOrderFormGoods;

                if (!goodsServer.GetOrderFormGoods(listRole, loginName, orderFormNumber, out returnOrderFormGoods, out error))
                {
                    return(false);
                }

                if (returnOrderFormGoods != null && returnOrderFormGoods.Count() > 0)
                {
                    error = string.Format("订单 [{0}] 还包含有物品信息无法进行删除,请将所有此订单包含的物品信息全部删除后才能进行此操作!", orderFormNumber);
                    return(false);
                }

                Table <B_OrderFormInfo> table = dataContxt.GetTable <B_OrderFormInfo>();
                var delRow = from c in table where c.OrderFormNumber == orderFormNumber select c;

                table.DeleteAllOnSubmit(delRow);
                dataContxt.SubmitChanges();

                return(GetAllOrderFormInfo(listRole, loginName, out returnOrderFormInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #21
0
        /// <summary>
        /// 借还货出库业务的处理
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="fetchGoodsDetailInfo">出库业务对象</param>
        void FetchLendReturn(DepotManagementDataContext ctx, S_FetchGoodsDetailBill fetchGoodsDetailInfo)
        {
            if (fetchGoodsDetailInfo == null)
            {
                return;
            }

            if (Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启借还货账务管理]))
            {
                BASE_SubsidiaryOperationType operationType = UniversalFunction.GetSubsidiaryOperationType(ctx, fetchGoodsDetailInfo.OperationType);

                if (operationType.LendReturnType != null)
                {
                    S_ProductLendReturnDetail tempDetail = new S_ProductLendReturnDetail();

                    tempDetail.Affirm         = fetchGoodsDetailInfo.DepotManager;
                    tempDetail.AffirmDate     = fetchGoodsDetailInfo.BillTime;
                    tempDetail.BatchNo        = fetchGoodsDetailInfo.BatchNo;
                    tempDetail.Provider       = fetchGoodsDetailInfo.Provider;
                    tempDetail.BillNo         = fetchGoodsDetailInfo.FetchBIllID;
                    tempDetail.BillTime       = fetchGoodsDetailInfo.BillTime;
                    tempDetail.Credit         = fetchGoodsDetailInfo.StorageID;
                    tempDetail.Debtor         = UniversalFunction.GetPersonnelInfo(ctx, fetchGoodsDetailInfo.FillInPersonnel).部门编码;
                    tempDetail.GoodsID        = fetchGoodsDetailInfo.GoodsID;
                    tempDetail.OperationCount = fetchGoodsDetailInfo.FetchCount < 0 ? -(decimal)fetchGoodsDetailInfo.FetchCount : (decimal)fetchGoodsDetailInfo.FetchCount;
                    tempDetail.OperationType  = fetchGoodsDetailInfo.OperationType;
                    tempDetail.Proposer       = fetchGoodsDetailInfo.FillInPersonnel;
                    tempDetail.ProposerDate   = fetchGoodsDetailInfo.FillInDate == null ? ServerTime.Time : Convert.ToDateTime(fetchGoodsDetailInfo.FillInDate);
                    tempDetail.Remark         = fetchGoodsDetailInfo.Remark;
                    tempDetail.UnitPrice      = fetchGoodsDetailInfo.UnitPrice;

                    IProductLendReturnService serverLendReturn = ServerModuleFactory.GetServerModule <IProductLendReturnService>();
                    serverLendReturn.OperationDetailRecord(ctx, tempDetail);
                }
            }
        }
        /// <summary>
        /// 完成领料退库单
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="storeManager">仓库管理员</param>
        /// <param name="returnBill">返回更新后重新查询的领料退库单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加领料退库单</returns>
        public bool FinishBill(string billNo, string storeManager, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                if (!FinishFrock(ctx, billNo, out error))
                {
                    return(false);
                }

                //检查总成领用数量是否都设置了流水码
                if (!m_serverProductCode.IsFitCountInReturnBill(billNo, out error))
                {
                    return(false);
                }

                var result = from r in ctx.S_MaterialReturnedInTheDepot where r.Bill_ID == billNo select r;

                if (result.Count() == 0)
                {
                    error = string.Format("没有找到单据号为 {0} 的领料退库单信息,无法进行此操作", billNo);
                    return(false);
                }

                S_MaterialReturnedInTheDepot bill = result.Single();

                if (bill.BillStatus == MaterialReturnedInTheDepotBillStatus.已完成.ToString())
                {
                    error = "单据不能重复退库";
                    return(false);
                }

                bill.DepotManager = storeManager;
                bill.BillStatus   = MaterialReturnedInTheDepotBillStatus.已完成.ToString();
                bill.InDepotDate  = ServerTime.Time;

                if (bill.ReturnMode == "领料退库")
                {
                    DetailCheck(ctx, bill);//在退库模式为领料退库的模式情况下,只能退库房存在的库存记录的物品
                }

                IMaterialListReturnedInTheDepot goodsServer = ServerModuleFactory.GetServerModule <IMaterialListReturnedInTheDepot>();

                //操作账务信息与库存信息
                OpertaionDetailAndStock(ctx, bill);

                //操作总成库存状态
                var varList = from a in ctx.S_MaterialListReturnedInTheDepot
                              where a.Bill_ID == bill.Bill_ID
                              select a;

                foreach (var item in varList)
                {
                    bool blIsRepaired = false;

                    if (bill.StorageID == "05" && Convert.ToBoolean(item.RepairStatus))
                    {
                        blIsRepaired = true;
                    }

                    if (!m_serverProductCode.UpdateProductStock(ctx, bill.Bill_ID, "领料退库", bill.StorageID, blIsRepaired, item.GoodsID, out error))
                    {
                        return(false);
                    }

                    IStoreServer serverStore = ServerModuleFactory.GetServerModule <IStoreServer>();

                    YX_AfterServiceStock lnqAfterService = new YX_AfterServiceStock();

                    lnqAfterService.GoodsID        = item.GoodsID;
                    lnqAfterService.OperationCount = Convert.ToDecimal(item.ReturnedAmount);
                    lnqAfterService.RepairStatus   = Convert.ToBoolean(item.RepairStatus);
                    lnqAfterService.StorageID      = bill.StorageID;

                    if (!serverStore.OperationYXAfterService(ctx, lnqAfterService, out error))
                    {
                        return(false);
                    }
                }

                // 正式使用单据号
                m_assignBill.UseBillNo(ctx, "领料退库单", bill.Bill_ID);

                ctx.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #23
0
        /// <summary>
        /// 修改合同信息
        /// </summary>
        /// <param name="oldBargainNumber">旧合同号</param>
        /// <param name="bargainInfo">合同信息</param>
        /// <param name="returnBargainInfo">返回查询到的合同信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateBargainInfo(string oldBargainNumber, B_BargainInfo bargainInfo,
                                      out IQueryResult returnBargainInfo, out string error)
        {
            returnBargainInfo = null;
            error             = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.B_BargainInfo
                             where r.BargainNumber == oldBargainNumber
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到合同号为 [{0}] 的信息!", oldBargainNumber);
                    return(false);
                }

                B_BargainInfo       record      = result.Single();
                IBargainGoodsServer goodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();

                if (oldBargainNumber != bargainInfo.BargainNumber)
                {
                    IQueryable <View_B_BargainGoods> returnBargainGoods;

                    if (!goodsServer.GetBargainGoods(oldBargainNumber, out returnBargainGoods, out error))
                    {
                        return(false);
                    }

                    goodsServer.AutoSubmitToDatabase = false;

                    foreach (var item in returnBargainGoods)
                    {
                        if (!goodsServer.UpdateBargainNumber(dataContxt, item.序号, bargainInfo.BargainNumber, out error))
                        {
                            return(false);
                        }
                    }

                    #region 更新订单信息表中的合同编号

                    IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
                    orderFormServer.UpdateBargainNumber(dataContxt, oldBargainNumber, bargainInfo.BargainNumber);

                    #endregion

                    dataContxt.B_BargainInfo.DeleteOnSubmit(record);
                    record = new B_BargainInfo();
                }

                record.BargainNumber   = bargainInfo.BargainNumber;
                record.Provider        = bargainInfo.Provider;
                record.Buyer           = bargainInfo.Buyer;
                record.Cess            = bargainInfo.Cess;
                record.Date            = bargainInfo.Date;
                record.InputPerson     = bargainInfo.InputPerson;
                record.LaisonMode      = bargainInfo.LaisonMode;
                record.ProviderLinkman = bargainInfo.ProviderLinkman;
                record.IsOverseas      = bargainInfo.IsOverseas;
                record.IsConsignOut    = bargainInfo.IsConsignOut;
                record.Remark          = bargainInfo.Remark;
                record.AuditDate       = bargainInfo.AuditDate;

                if (oldBargainNumber != bargainInfo.BargainNumber)
                {
                    dataContxt.B_BargainInfo.InsertOnSubmit(record);
                }

                dataContxt.SubmitChanges();

                goodsServer.AutoSubmitToDatabase = true;

                return(GetAllBargainInfo(out returnBargainInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 自动插入报检入库单
        /// </summary>
        /// <param name="dateTable">需要插入的数据集</param>
        /// <param name="storageID">库房ID</param>
        /// <param name="version">版次号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool AddCheckInDepotBill(DataTable dateTable, string storageID, string version, out string error)
        {
            error = null;

            BargainInfoServer serverBargainInfo = new BargainInfoServer();

            CheckOutInDepotServer serverCheckInDepot = new CheckOutInDepotServer();

            try
            {
                string strBatchNo = serverCheckInDepot.GetNextBillNo(1);

                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                for (int i = 0; i < dateTable.Rows.Count; i++)
                {
                    S_CheckOutInDepotBill bill = new S_CheckOutInDepotBill();

                    decimal dcUnitPrice = serverBargainInfo.GetBargainUnitPrice(dateTable.Rows[i]["订单号"].ToString(),
                                                                                Convert.ToInt32(dateTable.Rows[i]["物品ID"]));

                    F_GoodsPlanCost lnqGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>().GetGoodsInfo(
                        Convert.ToInt32(dateTable.Rows[i]["物品ID"]));

                    bill.Bill_ID              = GetBillID(strBatchNo, i);
                    bill.OrderFormNumber      = dateTable.Rows[i]["订单号"].ToString();
                    bill.ArriveGoods_Time     = ServerTime.Time;                            // 到货日期
                    bill.Bill_Time            = ServerTime.Time;                            // 报检日期
                    bill.BillStatus           = CheckInDepotBillStatus.新建单据.ToString();
                    bill.Buyer                = dateTable.Rows[i]["订货人"].ToString();        // 采购员签名
                    bill.DeclarePersonnelCode = dateTable.Rows[i]["订货人编号"].ToString();      // 报检员编码
                    bill.DeclarePersonnel     = dateTable.Rows[i]["订货人"].ToString();        // 报检员签名
                    bill.DeclareCount         = Convert.ToInt32(dateTable.Rows[i]["到货数量"]); // 报检数
                    bill.Provider             = dateTable.Rows[i]["供应商"].ToString();        // 供应商编码
                    bill.ProviderBatchNo      = "";                                         // 供应商批次
                    bill.GoodsID              = (int)dateTable.Rows[i]["物品ID"];
                    bill.BatchNo              = strBatchNo + "Auto";                        // xsy, 没有废除OA前暂用
                    bill.Remark               = "由自动订单自动生成的报检入库单";
                    bill.CheckOutGoodsType    = 1;
                    bill.OnlyForRepairFlag    = false;
                    bill.UnitPrice            = dcUnitPrice;
                    bill.Price                = decimal.Round(bill.UnitPrice * Convert.ToDecimal(dateTable.Rows[i]["到货数量"]), 2);
                    bill.PlanUnitPrice        = Convert.ToDecimal(lnqGoods.GoodsUnitPrice);
                    bill.PlanPrice            = decimal.Round(bill.PlanUnitPrice * Convert.ToDecimal(dateTable.Rows[i]["到货数量"]), 2);
                    bill.TotalPrice           = CalculateClass.GetTotalPrice(bill.Price);
                    bill.StorageID            = storageID;
                    bill.Version              = version;
                    bill.IsExigenceCheck      = false;
                    bill.UnitInvoicePrice     = 0;
                    bill.InvoicePrice         = 0;

                    if (UniversalFunction.GetStorageInfo_View(bill.StorageID).零成本控制)
                    {
                        throw new Exception("【零成本】库房,无法通过【报检入库单】入库");
                    }

                    dataContext.S_CheckOutInDepotBill.InsertOnSubmit(bill);
                }

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
예제 #25
0
        /// <summary>
        /// 修改订单信息
        /// </summary>
        /// <param name="listRole">角色列表</param>
        /// <param name="loginName">登录名</param>
        /// <param name="oldOrderFormNumber">旧订单号</param>
        /// <param name="orderFormInfo">订单信息</param>
        /// <param name="returnOrderFormInfo">返回查询到的订单信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateOrderFormInfo(List <string> listRole, string loginName, string oldOrderFormNumber,
                                        B_OrderFormInfo orderFormInfo, out IQueryable <View_B_OrderFormInfo> returnOrderFormInfo, out string error)
        {
            returnOrderFormInfo = null;
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                var result = from r in dataContxt.B_OrderFormInfo where r.OrderFormNumber == oldOrderFormNumber select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到订单号为 [{0}] 的信息!", oldOrderFormNumber);
                    return(false);
                }

                B_OrderFormInfo record = result.Single();

                IOrderFormGoodsServer goodsServer = ServerModuleFactory.GetServerModule <IOrderFormGoodsServer>();

                if (oldOrderFormNumber != orderFormInfo.OrderFormNumber)
                {
                    IQueryable <View_B_OrderFormGoods> returnOrderFormGoods;

                    if (!goodsServer.GetOrderFormGoods(listRole, loginName, oldOrderFormNumber,
                                                       out returnOrderFormGoods, out error))
                    {
                        return(false);
                    }

                    goodsServer.AutoSubmitToDatabase = false;

                    foreach (var item in returnOrderFormGoods)
                    {
                        if (!goodsServer.UpdateOrderFormNumber(dataContxt, listRole, loginName, item.序号,
                                                               orderFormInfo.OrderFormNumber, out error))
                        {
                            return(false);
                        }
                    }

                    dataContxt.B_OrderFormInfo.DeleteOnSubmit(record);
                    record = new B_OrderFormInfo();
                }

                record.OrderFormNumber = orderFormInfo.OrderFormNumber;
                record.Provider        = orderFormInfo.Provider;
                record.Buyer           = orderFormInfo.Buyer;
                record.BargainNumber   = orderFormInfo.BargainNumber;
                record.TypeID          = orderFormInfo.TypeID;
                record.InputPerson     = orderFormInfo.InputPerson;
                record.ProviderLinkman = orderFormInfo.ProviderLinkman;
                record.ProviderEmail   = orderFormInfo.ProviderEmail;
                record.ProviderPhone   = orderFormInfo.ProviderPhone;
                record.ProviderFax     = orderFormInfo.ProviderFax;
                record.Remark          = orderFormInfo.Remark;
                record.TypeID          = orderFormInfo.TypeID;
                record.CreateDate      = orderFormInfo.CreateDate;

                if (oldOrderFormNumber != orderFormInfo.OrderFormNumber)
                {
                    dataContxt.B_OrderFormInfo.InsertOnSubmit(record);
                }

                dataContxt.SubmitChanges();

                goodsServer.AutoSubmitToDatabase = true;

                return(GetAllOrderFormInfo(listRole, loginName, out returnOrderFormInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #26
0
        /// <summary>
        /// 插入客户信息历史记录,若更换的是CVT,则修改客户信息中对应的车架号的CVT编号
        /// </summary>
        /// <param name="serviceID">反馈单号</param>
        /// <param name="vehicleShelfNumber">车架号</param>
        /// <param name="cvtType">变速箱型号</param>
        /// <param name="carModel">车型</param>
        /// <param name="clientName">客户名称</param>
        /// <param name="dealerName">经销商名称</param>
        /// <param name="replaceAccessoryList">更换件列表</param>
        /// <param name="error">错误信息</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool InsertCustomerHistoryInfo(string serviceID, string vehicleShelfNumber, string cvtType, string carModel, string clientName, string dealerName,
                                              DataTable replaceAccessoryList, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                for (int i = 0; i < replaceAccessoryList.Rows.Count; i++)
                {
                    YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory();

                    lnqCustomerHistory.CarModel        = carModel;
                    lnqCustomerHistory.ClientName      = clientName;
                    lnqCustomerHistory.CVTType         = cvtType;
                    lnqCustomerHistory.DealerName      = dealerName;
                    lnqCustomerHistory.FinishDate      = ServerTime.Time;
                    lnqCustomerHistory.FinishPersonnel = BasicInfo.LoginName;

                    lnqCustomerHistory.NewPartCode = replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim() == "" ?
                                                     replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim() :
                                                     replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim();

                    lnqCustomerHistory.OldPartCode = replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim() == "" ?
                                                     replaceAccessoryList.Rows[i]["OldCvtID"].ToString().Trim() :
                                                     replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim();

                    lnqCustomerHistory.ReplaceCode        = replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString();
                    lnqCustomerHistory.ReplaceName        = replaceAccessoryList.Rows[i]["OldGoodsName"].ToString();
                    lnqCustomerHistory.ReplaceSpec        = replaceAccessoryList.Rows[i]["OldSpec"].ToString();
                    lnqCustomerHistory.VehicleShelfNumber = vehicleShelfNumber;

                    lnqCustomerHistory.Remark = "由单号为【" + serviceID + "】售后反馈单,自动生成";

                    dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory);

                    IProductListServer serverProductList = ServerModuleFactory.GetServerModule <IProductListServer>();

                    int intGoodsID = serverProductList.GetProductGoodsID(replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString(), 0, true);

                    if (intGoodsID != 0)
                    {
                        var varData = from a in dataContext.YX_CVTCustomerInformation
                                      where a.VehicleShelfNumber == vehicleShelfNumber
                                      select a;

                        if (varData.Count() == 1)
                        {
                            YX_CVTCustomerInformation lnqCustomerInfo = varData.Single();

                            lnqCustomerInfo.ProductID = intGoodsID;
                            lnqCustomerInfo.CVTNumber = replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim();
                        }
                        else
                        {
                            error = "车架号在客户信息内不唯一或者不存在";
                            return(false);
                        }
                    }
                }

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
예제 #27
0
        /// <summary>
        /// 更改数据CVT客户基础信息
        /// </summary>
        /// <param name="cvtCustomer">CVT客户信息</param>
        /// <param name="error">c错误信息</param>
        /// <returns>更改成功返回True,更改失败返回False</returns>
        public bool UpdateCVTCustomerInformation(YX_CVTCustomerInformation cvtCustomer, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                var varData = from a in dataContext.YX_CVTCustomerInformation
                              where a.ID != cvtCustomer.ID &&
                              a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber
                              select a;

                if (varData.Count() != 0)
                {
                    error = "数据不唯一";
                    return(false);
                }
                else
                {
                    var varCVT = from a in dataContext.YX_CVTCustomerInformation
                                 where a.ID == cvtCustomer.ID
                                 select a;

                    if (varCVT.Count() == 1)
                    {
                        YX_CVTCustomerInformation lnqCustomer = varCVT.Single();

                        lnqCustomer.CarModelID         = cvtCustomer.CarModelID;
                        lnqCustomer.ClientName         = cvtCustomer.ClientName;
                        lnqCustomer.CVTNumber          = cvtCustomer.CVTNumber;
                        lnqCustomer.DealerName         = cvtCustomer.DealerName;
                        lnqCustomer.FullAddress        = cvtCustomer.FullAddress;
                        lnqCustomer.PhoneNumber        = cvtCustomer.PhoneNumber;
                        lnqCustomer.ProductID          = cvtCustomer.ProductID;
                        lnqCustomer.Remark             = cvtCustomer.Remark;
                        lnqCustomer.SellDate           = cvtCustomer.SellDate;
                        lnqCustomer.SiteCity           = cvtCustomer.SiteCity;
                        lnqCustomer.SiteProvince       = cvtCustomer.SiteProvince;
                        lnqCustomer.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber;
                        lnqCustomer.VKT           = cvtCustomer.VKT;
                        lnqCustomer.OverTheReason = cvtCustomer.OverTheReason;
                        lnqCustomer.ProofNo       = cvtCustomer.ProofNo;

                        var varInfo = from a in dataContext.YX_CVTCustomerInformation
                                      where a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber
                                      select a;

                        if (varInfo.Count() == 1)
                        {
                            YX_CVTCustomerInformation lnqInfo = varInfo.Single();


                            if (lnqInfo.CVTNumber != cvtCustomer.CVTNumber)
                            {
                                YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory();

                                IProductListServer serverProcutList = ServerModuleFactory.GetServerModule <IProductListServer>();

                                lnqCustomerHistory.CarModel   = serverProcutList.GetMotorcycleInfo(Convert.ToInt32(cvtCustomer.CarModelID));
                                lnqCustomerHistory.ClientName = cvtCustomer.ClientName;

                                IBasicGoodsServer serverBasicGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>();

                                F_GoodsPlanCost lnqGoods = serverBasicGoods.GetGoodsInfo(Convert.ToInt32(cvtCustomer.ProductID));

                                lnqCustomerHistory.CVTType            = lnqGoods.GoodsCode;
                                lnqCustomerHistory.DealerName         = cvtCustomer.DealerName;
                                lnqCustomerHistory.FinishDate         = ServerTime.Time;
                                lnqCustomerHistory.FinishPersonnel    = BasicInfo.LoginName;
                                lnqCustomerHistory.NewPartCode        = cvtCustomer.CVTNumber;
                                lnqCustomerHistory.OldPartCode        = lnqInfo.CVTNumber;
                                lnqCustomerHistory.Remark             = "手动修改";
                                lnqCustomerHistory.ReplaceCode        = lnqGoods.GoodsCode;
                                lnqCustomerHistory.ReplaceName        = lnqGoods.GoodsName;
                                lnqCustomerHistory.ReplaceSpec        = lnqGoods.Spec;
                                lnqCustomerHistory.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber;

                                dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory);
                            }
                        }
                    }
                }

                dataContext.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
예제 #28
0
        /// <summary>
        /// 检测是否与之前的数据一致
        /// </summary>
        /// <param name="djh">单据号</param>
        /// <param name="lstGoods">要检查的数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>True 一致 False 不一致</returns>
        public bool IsInfoAccordance(string djh, List <View_S_ScrapGoods> lstGoods, out string error)
        {
            error = null;

            #region 夏石友,2012-07-13 17:00 改写

            try
            {
                if (!ServerModuleFactory.GetServerModule <IMaterialRequisitionGoodsServer>().IsExist(djh))
                {
                    return(true);
                }

                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                // 获取报废单中物品明细,并用物品ID排序
                List <View_S_ScrapGoods> checkGoods = (from r in ctx.View_S_ScrapGoods
                                                       where r.报废单号 == djh
                                                       orderby r.物品ID
                                                       select r).ToList();

                if (checkGoods.Count != lstGoods.Count)
                {
                    return(false);
                }

                // 将要检查的数据集用物品ID排序
                List <View_S_ScrapGoods> surGoods = (from r in lstGoods.AsEnumerable()
                                                     orderby r.物品ID
                                                     select r).ToList();

                // 逐一比较,有不一致则返回
                for (int i = 0; i < surGoods.Count; i++)
                {
                    if (surGoods[i].物品ID != checkGoods[i].物品ID || surGoods[i].报废数量 != checkGoods[i].报废数量)
                    {
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }

            #endregion

            //try
            //{
            //    string strSql = "select * from S_MaterialRequisition where AssociatedBillNo = '" + djh + "'";

            //    DataTable dt = GlobalObject.DatabaseServer.QueryInfo(strSql);

            //    if (dt == null || dt.Rows.Count == 0)
            //    {
            //        return true;
            //    }
            //    else
            //    {
            //        bool blflag = false;

            //        strSql = "select * from S_ScrapGoods where Bill_ID = '" + djh + "'";

            //        dt = GlobalObject.DatabaseServer.QueryInfo(strSql);

            //        for (int i = 0; i < dt.Rows.Count; i++)
            //        {
            //            blflag = false;

            //            foreach (var item in goodsdate)
            //            {
            //                if (Convert.ToInt32(dt.Rows[i]["GoodsID"]) == Convert.ToInt32(item.物品ID)
            //                    && Convert.ToDecimal(dt.Rows[i]["Quantity"]) == Convert.ToDecimal(item.报废数量))
            //                {
            //                    blflag = true;
            //                }
            //            }

            //            if (!blflag)
            //            {
            //                return false;
            //            }
            //        }
            //    }

            //    return true;
            //}
            //catch (Exception ex)
            //{
            //    error = ex.Message;
            //    return false;
            //}
        }
예제 #29
0
        public void InsertInfoExcel(string billNo, DataTable infoTable)
        {
            IMaterialRequisitionServer billServer    = ServerModuleFactory.GetServerModule <IMaterialRequisitionServer>();
            BillNumberControl          billNoControl = new BillNumberControl("领料单", billServer);
            DepotManagementDataContext ctx           = CommentParameter.DepotDataContext;

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

            IStoreServer storeService = ServerModuleFactory.GetServerModule <IStoreServer>();

            try
            {
                List <string> lstStorage = new List <string>();

                if (infoTable.Columns.Contains("库房"))
                {
                    lstStorage = DataSetHelper.ColumnsToList_Distinct(infoTable, "库房");

                    foreach (string storage in lstStorage)
                    {
                        string temp = UniversalFunction.GetStorageID(storage);

                        if (temp.Trim().Length == 0)
                        {
                            throw new Exception("【库房名称】:" + storage + "有误, 无法匹配到库房ID");
                        }
                    }
                }

                if (!infoTable.Columns.Contains("物品ID"))
                {
                    infoTable.Columns.Add("物品ID");

                    foreach (DataRow dr in infoTable.Rows)
                    {
                        int goodsID = UniversalFunction.GetGoodsID(dr["图号型号"] == null ? "" : dr["图号型号"].ToString(),
                                                                   dr["物品名称"] == null ? "" : dr["物品名称"].ToString(),
                                                                   dr["规格"] == null ? "" : dr["规格"].ToString());

                        if (goodsID == 0)
                        {
                            throw new Exception(string.Format("【图号型号】:{0} 【物品名称】:{1} 【规格】:{2}有误," +
                                                              " 无法匹配到物品ID", dr["图号型号"], dr["物品名称"], dr["规格"]));
                        }

                        dr["物品ID"] = goodsID;
                    }
                }

                var varData = from a in ctx.S_MaterialRequisition
                              where a.Bill_ID == billNo
                              select a;

                if (varData.Count() != 1)
                {
                    throw new Exception("无法获取【单据号】: " + billNo + " 的基本信息");
                }

                S_MaterialRequisition requisition = varData.Single();

                if (BillIsFinish(ctx, requisition.Bill_ID))
                {
                    throw new Exception("单据已完成,无法进行操作");
                }

                if (lstStorage.Count == 0)
                {
                    lstStorage.Add(UniversalFunction.GetStorageName(requisition.StorageID));
                }

                foreach (string storage in lstStorage)
                {
                    DataTable tempTable = infoTable;

                    if (lstStorage.Count > 1)
                    {
                        tempTable = DataSetHelper.SiftDataTable(infoTable, "库房 = '" + storage + "'");
                    }

                    string tempBillNo = "";
                    string storageID  = UniversalFunction.GetStorageID(storage);

                    if (requisition.StorageID != storageID)
                    {
                        S_MaterialRequisition tempRequisition = new S_MaterialRequisition();

                        tempBillNo = billNoControl.GetNewBillNo(ctx);

                        tempRequisition.Bill_ID             = tempBillNo;
                        tempRequisition.AssociatedBillNo    = requisition.AssociatedBillNo;
                        tempRequisition.AssociatedBillType  = requisition.AssociatedBillType;
                        tempRequisition.AuthorizeDate       = requisition.AuthorizeDate;
                        tempRequisition.AuthorizePersonnel  = requisition.AuthorizePersonnel;
                        tempRequisition.Bill_Time           = requisition.Bill_Time;
                        tempRequisition.BillStatus          = requisition.BillStatus;
                        tempRequisition.Department          = requisition.Department;
                        tempRequisition.DepartmentDirector  = requisition.DepartmentDirector;
                        tempRequisition.DepotManager        = requisition.DepotManager;
                        tempRequisition.FetchCount          = requisition.FetchCount;
                        tempRequisition.FetchType           = requisition.FetchType;
                        tempRequisition.FillInPersonnel     = requisition.FillInPersonnel;
                        tempRequisition.FillInPersonnelCode = requisition.FillInPersonnelCode;
                        tempRequisition.OutDepotDate        = requisition.OutDepotDate;
                        tempRequisition.ProductType         = requisition.ProductType;
                        tempRequisition.PurposeCode         = requisition.PurposeCode;
                        tempRequisition.Remark                = requisition.Remark;
                        tempRequisition.StorageID             = storageID;
                        tempRequisition.TechnologistDate      = requisition.TechnologistDate;
                        tempRequisition.TechnologistPersonnel = requisition.TechnologistPersonnel;

                        ctx.S_MaterialRequisition.InsertOnSubmit(tempRequisition);
                        ctx.SubmitChanges();
                    }
                    else
                    {
                        tempBillNo = billNo;
                    }

                    foreach (DataRow dr in tempTable.Rows)
                    {
                        S_MaterialRequisitionGoods goodsInfo = new S_MaterialRequisitionGoods();

                        goodsInfo.RequestCount = dr["数量"] == null ? 0 : Convert.ToDecimal(dr["数量"]);
                        goodsInfo.BatchNo      = dr["批次号"] == null ? "" : dr["批次号"].ToString();

                        if (dr["物品ID"] == null || Convert.ToInt32(dr["物品ID"]) == 0)
                        {
                            throw new Exception("【物品ID】无效");
                        }

                        goodsInfo.GoodsID = Convert.ToInt32(dr["物品ID"]);
                        goodsInfo.Bill_ID = tempBillNo;

                        StoreQueryCondition condition = new StoreQueryCondition();

                        condition.BatchNo   = goodsInfo.BatchNo;
                        condition.GoodsID   = goodsInfo.GoodsID;
                        condition.StorageID = storageID;

                        S_Stock stockInfo = storeService.GetStockInfo(condition);

                        if (stockInfo == null)
                        {
                            throw new Exception(string.Format("【物品ID】:{0} 【批次号】:{1} 【库房】:{2} 未找到匹配的库存记录",
                                                              goodsInfo.GoodsID, goodsInfo.BatchNo, storage));
                        }

                        goodsInfo.ProviderCode = stockInfo.Provider;
                        goodsInfo.BasicCount   = 0;
                        goodsInfo.Remark       = "由Excel导入";
                        goodsInfo.RepairStatus = null;
                        goodsInfo.RealCount    = goodsInfo.RequestCount;
                        goodsInfo.ShowPosition = 1;

                        ctx.S_MaterialRequisitionGoods.InsertOnSubmit(goodsInfo);
                        ctx.SubmitChanges();
                    }
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
예제 #30
0
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        public S_FetchGoodsDetailBill AssignDetailInfo(DepotManagementDataContext context, S_MaterialRequisition bill,
                                                       S_MaterialRequisitionGoods item)
        {
            IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
            BASE_BillType   billType = server.GetBillTypeFromName("领料单");

            if (billType == null)
            {
                throw new Exception("获取不到单据类型信息");
            }

            View_Department           department       = UniversalFunction.GetDeptInfo(context, bill.Department);
            IStoreServer              storeServer      = ServerModuleFactory.GetServerModule <IStoreServer>();
            IProductLendReturnService serverLendReturn = ServerModuleFactory.GetServerModule <IProductLendReturnService>();
            F_GoodsPlanCost           basicGoods       = m_basicGoodsServer.GetGoodsInfo(context, item.GoodsID);

            if (basicGoods == null)
            {
                throw new Exception(string.Format("物品ID [{0}] 的物品在基础物品表中没有查到,请与系统管理员联系!", item.GoodsID));
            }

            StoreQueryCondition condition = new StoreQueryCondition();

            condition.GoodsID   = item.GoodsID;
            condition.Provider  = item.ProviderCode;
            condition.BatchNo   = item.BatchNo;
            condition.StorageID = bill.StorageID;

            S_Stock stock = storeServer.GetStockInfoOverLoad(context, condition);

            if (stock == null && GlobalObject.GeneralFunction.IsNullOrEmpty(basicGoods.GoodsType))
            {
                throw new Exception(string.Format("图号:{0}, 名称:{1}, 规格:{2}, 供应商:{3}, 批次号:{4} 的物品在库存中没有查到相关物品,请仓管员核实!",
                                                  basicGoods.GoodsCode, basicGoods.GoodsName, basicGoods.Spec, item.ProviderCode, item.BatchNo));
            }

            //S_FetchGoodsDetailBill用于存放每次领料、领料退库的明细信息
            decimal dcRealCount = item.RealCount;
            decimal dcSumCount  = 0;

            var varData = from a in context.View_S_MaterialRequisitionProductReturnList
                          where a.单据号 == item.Bill_ID &&
                          a.还账物品ID == item.GoodsID &&
                          a.还账物品批次号 == item.BatchNo &&
                          a.还账物品供应商 == item.ProviderCode
                          select a;

            if (varData.Count() > 0)
            {
                dcSumCount = varData.Sum(a => a.还账数量);

                if (dcRealCount < dcSumCount)
                {
                    throw new Exception("实际领用数量不能大于还货数量,请重新核对");
                }
            }

            S_FetchGoodsDetailBill detailBill = new S_FetchGoodsDetailBill();

            detailBill.ID                 = Guid.NewGuid();
            detailBill.FetchBIllID        = bill.Bill_ID;
            detailBill.BillTime           = (DateTime)bill.OutDepotDate;
            detailBill.AssociatedBillType = bill.AssociatedBillType;
            detailBill.AssociatedBillNo   = bill.AssociatedBillNo;
            detailBill.Department         = department.部门名称;
            detailBill.FetchCount         = item.RealCount;
            detailBill.GoodsID            = item.GoodsID;
            detailBill.StorageID          = bill.StorageID;
            detailBill.Price              = dcSumCount;
            detailBill.UnitPrice          = stock == null ? 0 : stock.UnitPrice;
            detailBill.OperationType      = (int)CE_SubsidiaryOperationType.领料;
            detailBill.Provider           = item.ProviderCode;

            if (stock != null)
            {
                detailBill.ProviderBatchNo = stock.ProviderBatchNo;
            }
            else
            {
                detailBill.ProviderBatchNo = "";
            }

            detailBill.BatchNo = item.BatchNo;

            detailBill.FillInPersonnel  = bill.FillInPersonnel;
            detailBill.FinanceSignatory = null;
            detailBill.DepartDirector   = bill.DepartmentDirector;
            detailBill.DepotManager     = bill.DepotManager;
            detailBill.Remark           = (bill.Remark == null ? "" : bill.Remark.Trim()) + (item.Remark == null ? "" : item.Remark.Trim());
            detailBill.FillInDate       = bill.Bill_Time;

            IMaterialRequisitionPurposeServer purposeServer =
                ServerModuleFactory.GetServerModule <IMaterialRequisitionPurposeServer>();

            detailBill.Using = purposeServer.GetBillPurpose(context, bill.PurposeCode).Purpose;

            return(detailBill);
        }