/// <summary>
        /// 操作账务信息与库存信息_出
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        void OperationDetailAndStock_Out(DepotManagementDataContext dataContext, Business_WarehouseOutPut_OutPut lnqOutPut)
        {
            string             error = "";
            IProductCodeServer productCodeService =
                ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IProductCodeServer>();
            CE_MarketingType marketingType = GlobalObject.EnumOperation.OutPutBusinessTypeConvertToMarketingType(
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType));
            IFinancialDetailManagement serverDetail =
                ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>();

            List <View_Business_WarehouseOutPut_OutPutDetail> listDetail = GetListViewDetailInfo(lnqOutPut.BillNo);

            foreach (View_Business_WarehouseOutPut_OutPutDetail detail1 in listDetail)
            {
                if (!productCodeService.UpdateProductStock(dataContext, lnqOutPut.BillNo, marketingType.ToString(), lnqOutPut.StorageID,
                                                           (lnqOutPut.StorageID == "05" && marketingType == CE_MarketingType.入库) ? true : false, detail1.物品ID, out error))
                {
                    throw new Exception(error);
                }

                S_FetchGoodsDetailBill detailInfo = AssignDetailInfo_Out(dataContext, lnqOutPut, detail1);
                S_Stock stockInfo = AssignStockInfo(dataContext, lnqOutPut, detail1);

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

                serverDetail.ProcessFetchGoodsDetail(dataContext, detailInfo, stockInfo);
            }
        }
        /// <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_Stock AssignStockInfo(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut,
                                View_Business_WarehouseOutPut_OutPutDetail detail1)
        {
            S_Stock tempLnqStock = new S_Stock();

            tempLnqStock.GoodsID    = detail1.物品ID;
            tempLnqStock.BatchNo    = detail1.批次号;
            tempLnqStock.Date       = ServerTime.Time;
            tempLnqStock.Provider   = detail1.供应商;
            tempLnqStock.StorageID  = lnqOutPut.StorageID;
            tempLnqStock.ExistCount = Convert.ToDecimal(detail1.数量);

            return(tempLnqStock);
        }
Exemplo n.º 4
0
        bool 出库单_Form_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            IOutPutService serviceOutPut = Service_Manufacture_Storage.ServerModuleFactory.GetServerModule <IOutPutService>();

            try
            {
                List <View_Business_WarehouseOutPut_OutPutDetail> detailInfo =
                    form.ResultInfo as List <View_Business_WarehouseOutPut_OutPutDetail>;
                Business_WarehouseOutPut_OutPut lnqOutPut = form.ResultList[0] as Business_WarehouseOutPut_OutPut;

                this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[1].ToString());
                this.BillNo        = lnqOutPut.BillNo;

                switch (this.OperationType)
                {
                case CE_FlowOperationType.提交:
                    serviceOutPut.SaveInfo(lnqOutPut, detailInfo);
                    serviceOutPut.FinishBill(lnqOutPut.BillNo);
                    break;

                case CE_FlowOperationType.暂存:
                    serviceOutPut.SaveInfo(lnqOutPut, detailInfo);
                    break;

                case CE_FlowOperationType.回退:
                    break;

                case CE_FlowOperationType.未知:
                    break;

                default:
                    break;
                }

                if (!serviceOutPut.IsExist(lnqOutPut.BillNo))
                {
                    MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面");
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Exemplo n.º 5
0
        public override void LoadFormInfo()
        {
            try
            {
                m_billNoControl = new BillNumberControl(CE_BillTypeEnum.出库单.ToString(), m_serviceOutPut);
                m_lnqBillInfo   = m_serviceOutPut.GetSingleBillInfo(this.FlowInfo_BillNo);

                this.关联业务.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(关联业务_m_OnCompleteSearch);
                this.图号型号.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(图号型号_m_OnCompleteSearch);
                this.批次号.m_OnCompleteSearch  += new GlobalObject.DelegateCollection.NonArgumentHandle(批次号_m_OnCompleteSearch);
                SetInfo();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowErrorMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
        void SetInfo()
        {
            List <string> listType = GlobalObject.GeneralFunction.GetEumnList(typeof(CE_OutPutBusinessType));

            cmbBillType.DataSource    = listType;
            cmbBillType.SelectedIndex = -1;

            DataTable dt = UniversalFunction.GetStorageTb();

            cmbStorage.DataSource    = dt;
            cmbStorage.DisplayMember = "StorageName";
            cmbStorage.ValueMember   = "StorageID";
            cmbStorage.SelectedIndex = -1;

            if (m_lnqBillInfo != null)
            {
                lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo);

                txtBillNo.Text             = m_lnqBillInfo.BillNo;
                txtRemark.Text             = m_lnqBillInfo.Remark;
                txtApplyingDepartment.Tag  = m_lnqBillInfo.ApplyingDepartment;
                txtApplyingDepartment.Text = UniversalFunction.GetDeptName(m_lnqBillInfo.ApplyingDepartment);


                cmbTypeDetail.Text = m_lnqBillInfo.BillTypeDetail;

                cmbBillType.Text         = m_lnqBillInfo.BillType;
                cmbStorage.SelectedValue = m_lnqBillInfo.StorageID;
                cmbStorage.Text          = UniversalFunction.GetStorageName(m_lnqBillInfo.StorageID);
            }
            else
            {
                lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString();

                m_lnqBillInfo = new Business_WarehouseOutPut_OutPut();

                txtBillNo.Text       = this.FlowInfo_BillNo;
                m_lnqBillInfo.BillNo = txtBillNo.Text;
            }

            m_listViewDetail = m_serviceOutPut.GetListViewDetailInfo(m_lnqBillInfo.BillNo);
            RefreshDataGridView(m_listViewDetail);
        }
        /// <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.º 9
0
        private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType)
        {
            try
            {
                if (!CheckData())
                {
                    return(false);
                }

                m_lnqBillInfo = new Business_WarehouseOutPut_OutPut();

                m_lnqBillInfo.BillNo             = txtBillNo.Text;
                m_lnqBillInfo.BillType           = cmbBillType.Text;
                m_lnqBillInfo.BillTypeDetail     = cmbTypeDetail.Text;
                m_lnqBillInfo.ApplyingDepartment = txtApplyingDepartment.Tag.ToString();
                m_lnqBillInfo.StorageID          = cmbStorage.SelectedValue.ToString();
                m_lnqBillInfo.Remark             = txtRemark.Text;

                List <View_Business_WarehouseOutPut_OutPutDetail> listTemp = new List <View_Business_WarehouseOutPut_OutPutDetail>();

                foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                {
                    View_Business_WarehouseOutPut_OutPutDetail detailTemp = new View_Business_WarehouseOutPut_OutPutDetail();

                    detailTemp.备注   = dgvr.Cells["备注"].Value == null ? "" : dgvr.Cells["备注"].Value.ToString();
                    detailTemp.单据号  = txtBillNo.Text;
                    detailTemp.单位   = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString();
                    detailTemp.供应商  = dgvr.Cells["供应商"].Value == null ? "" : dgvr.Cells["供应商"].Value.ToString();
                    detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString();
                    detailTemp.规格   = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString();
                    detailTemp.批次号  = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString();
                    detailTemp.数量   = Convert.ToDecimal(dgvr.Cells["数量"].Value);
                    detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString();
                    detailTemp.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value);
                    detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString();

                    switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(m_lnqBillInfo.BillType))
                    {
                    case CE_OutPutBusinessType.领料:
                    case CE_OutPutBusinessType.营销出库:
                    case CE_OutPutBusinessType.营销退货:
                        if (!m_serverProductCode.IsFitCount(detailTemp.物品ID, Convert.ToInt32(detailTemp.数量), detailTemp.单据号))
                        {
                            MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示");
                            return(false);
                        }
                        break;

                    case CE_OutPutBusinessType.采购退货:
                        break;

                    case CE_OutPutBusinessType.自制件退货:
                        break;

                    default:
                        break;
                    }

                    listTemp.Add(detailTemp);
                }

                this.FlowInfo_BillNo = txtBillNo.Text;
                this.ResultInfo      = listTemp;

                this.ResultList = new List <object>();

                this.ResultList.Add(m_lnqBillInfo);
                this.ResultList.Add(flowOperationType);

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 保存业务信息
        /// </summary>
        /// <param name="billInfo">业务总单信息</param>
        /// <param name="detailInfo">业务明细信息</param>
        public void SaveInfo(Business_WarehouseOutPut_OutPut billInfo, List <View_Business_WarehouseOutPut_OutPutDetail> detailInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

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

            try
            {
                var varData = from a in ctx.Business_WarehouseOutPut_OutPut
                              where a.BillNo == billInfo.BillNo
                              select a;

                if (varData.Count() == 1)
                {
                    Business_WarehouseOutPut_OutPut lnqBill = varData.Single();

                    lnqBill.ApplyingDepartment = billInfo.ApplyingDepartment;
                    lnqBill.BillType           = billInfo.BillType;
                    lnqBill.StorageID          = billInfo.StorageID;
                    lnqBill.Remark             = billInfo.Remark;
                    lnqBill.BillTypeDetail     = billInfo.BillTypeDetail;
                }
                else if (varData.Count() == 0)
                {
                    ctx.Business_WarehouseOutPut_OutPut.InsertOnSubmit(billInfo);
                }
                else
                {
                    throw new Exception("单据数据不唯一");
                }

                var varDetail = from a in ctx.Business_WarehouseOutPut_OutPutDetail
                                where a.BillNo == billInfo.BillNo
                                select a;

                ctx.Business_WarehouseOutPut_OutPutDetail.DeleteAllOnSubmit(varDetail);
                ctx.SubmitChanges();

                foreach (View_Business_WarehouseOutPut_OutPutDetail item in detailInfo)
                {
                    Business_WarehouseOutPut_OutPutDetail lnqDetail = new Business_WarehouseOutPut_OutPutDetail();

                    lnqDetail.BatchNo    = item.批次号;
                    lnqDetail.BillNo     = billInfo.BillNo;
                    lnqDetail.BillRelate = item.关联业务;
                    lnqDetail.GoodsCount = item.数量;
                    lnqDetail.GoodsID    = item.物品ID;
                    lnqDetail.Provider   = item.供应商;
                    lnqDetail.Remark     = item.备注;

                    ctx.Business_WarehouseOutPut_OutPutDetail.InsertOnSubmit(lnqDetail);
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }