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

            List <View_Business_WarehouseInPut_InPutDetail> listDetail = GetListViewDetailInfo(lnqInPut.BillNo);

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

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

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

                serverDetail.ProcessFetchGoodsDetail(dataContext, detailInfo, stockInfo);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 赋值库存信息
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        /// <param name="detail1">明细信息</param>
        /// <returns>返回库存信息对象</returns>
        S_Stock AssignStockInfo(DepotManagementDataContext ctx, Business_WarehouseInPut_InPut lnqInPut,
                                View_Business_WarehouseInPut_InPutDetail detail1)
        {
            S_Stock tempLnqStock = new S_Stock();

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

            return(tempLnqStock);
        }
Esempio n. 3
0
        /// <summary>
        /// 赋值账务信息_出
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        /// <param name="detail1">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        S_FetchGoodsDetailBill AssignDetailInfo_Out(DepotManagementDataContext ctx, Business_WarehouseInPut_InPut lnqInPut,
                                                    View_Business_WarehouseInPut_InPutDetail detail1)
        {
            ServerModule.IStoreServer storeService = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>();
            IFlowServer          serverFlow        = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();
            CommonProcessInfo    processInfo       = new CommonProcessInfo();
            CE_InPutBusinessType inPutType         =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(lnqInPut.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         = lnqInPut.ApplyingDepartment;
            fetchDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称;

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

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

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

            fetchDetail.FetchBIllID   = lnqInPut.BillNo;
            fetchDetail.FetchCount    = -detail1.数量;
            fetchDetail.GoodsID       = detail1.物品ID;
            fetchDetail.OperationType = (int)GlobalObject.EnumOperation.InPutBusinessTypeConvertToSubsidiaryOperationType(inPutType);
            fetchDetail.Provider      = detail1.供应商;
            fetchDetail.Remark        = detail1.备注;
            fetchDetail.StorageID     = lnqInPut.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 = lnqInPut.BillTypeDetail;

            return(fetchDetail);
        }
        private bool 入库单_Form_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            IInPutService serviceInPut = Service_Manufacture_Storage.ServerModuleFactory.GetServerModule <IInPutService>();

            try
            {
                List <View_Business_WarehouseInPut_InPutDetail> detailInfo =
                    form.ResultInfo as List <View_Business_WarehouseInPut_InPutDetail>;
                Business_WarehouseInPut_InPut lnqInPut = form.ResultList[0] as Business_WarehouseInPut_InPut;

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

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

                case CE_FlowOperationType.暂存:
                    serviceInPut.SaveInfo(lnqInPut, detailInfo);
                    break;

                case CE_FlowOperationType.回退:
                    break;

                case CE_FlowOperationType.未知:
                    break;

                default:
                    break;
                }

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

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
        public override void LoadFormInfo()
        {
            try
            {
                m_billNoControl = new BillNumberControl(CE_BillTypeEnum.入库单.ToString(), m_serviceInPut);
                m_lnqBillInfo   = m_serviceInPut.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);
            }
        }
        void SetInfo()
        {
            List <string> listType = GlobalObject.GeneralFunction.GetEumnList(typeof(CE_InPutBusinessType));

            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_WarehouseInPut_InPut();

                txtBillNo.Text       = this.FlowInfo_BillNo;
                m_lnqBillInfo.BillNo = txtBillNo.Text;
            }
            ;
            m_listViewDetail = m_serviceInPut.GetListViewDetailInfo(m_lnqBillInfo.BillNo);
            RefreshDataGridView(m_listViewDetail);
        }
Esempio n. 7
0
        /// <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_WarehouseInPut_InPut lnqInPut  = GetSingleBillInfo(billNo);
                CE_InPutBusinessType          inPutType =
                    GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(lnqInPut.BillType);

                switch (inPutType)
                {
                case CE_InPutBusinessType.生产采购:
                case CE_InPutBusinessType.普通采购:
                case CE_InPutBusinessType.委外采购:
                case CE_InPutBusinessType.样品采购:
                case CE_InPutBusinessType.自制件入库:
                case CE_InPutBusinessType.营销入库:;
                    OperationDetailAndStock_In(ctx, lnqInPut);
                    break;

                case CE_InPutBusinessType.领料退库:
                case CE_InPutBusinessType.营销退库:
                    OperationDetailAndStock_Out(ctx, lnqInPut);
                    break;

                default:
                    break;
                }

                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 赋值账务信息_入
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="lnqOutPut">单据信息</param>
        /// <param name="detail1">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        S_InDepotDetailBill AssignDetailInfo_In(DepotManagementDataContext ctx, Business_WarehouseInPut_InPut lnqInPut,
                                                View_Business_WarehouseInPut_InPutDetail detail1)
        {
            IFlowServer          serverFlow  = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();
            CommonProcessInfo    processInfo = new CommonProcessInfo();
            CE_InPutBusinessType inPutType   =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(lnqInPut.BillType);


            S_InDepotDetailBill inDepotDetail = new S_InDepotDetailBill();

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

            inDepotDetail.FactPrice        = Math.Round(detail1.单价 * detail1.数量, 2);
            inDepotDetail.FactUnitPrice    = 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 = lnqInPut.BillNo;
            inDepotDetail.InDepotCount  = detail1.数量;
            inDepotDetail.GoodsID       = detail1.物品ID;
            inDepotDetail.OperationType = (int)GlobalObject.EnumOperation.InPutBusinessTypeConvertToSubsidiaryOperationType(inPutType);
            inDepotDetail.Provider      = detail1.供应商;
            inDepotDetail.Remark        = detail1.备注;
            inDepotDetail.StorageID     = lnqInPut.StorageID;

            return(inDepotDetail);
        }
        private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType)
        {
            try
            {
                if (!CheckData())
                {
                    return(false);
                }

                m_lnqBillInfo = new Business_WarehouseInPut_InPut();

                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_WarehouseInPut_InPutDetail> listTemp = new List <View_Business_WarehouseInPut_InPutDetail>();

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

                    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();

                    if (detailTemp.供应商 == "")
                    {
                        throw new Exception(UniversalFunction.GetGoodsMessage(detailTemp.物品ID)
                                            + "批次号:【" + detailTemp.批次号 + "】,供应商为空,请选择供应商");
                    }

                    switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(m_lnqBillInfo.BillType))
                    {
                    case CE_InPutBusinessType.生产采购:
                    case CE_InPutBusinessType.普通采购:
                    case CE_InPutBusinessType.委外采购:
                    case CE_InPutBusinessType.样品采购:
                    case CE_InPutBusinessType.自制件入库:
                        break;

                    case CE_InPutBusinessType.领料退库:
                    case CE_InPutBusinessType.营销入库:
                    case CE_InPutBusinessType.营销退库:
                        if (!m_serverProductCode.IsFitCount(detailTemp.物品ID, Convert.ToInt32(detailTemp.数量), detailTemp.单据号))
                        {
                            MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示");
                            return(false);
                        }
                        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);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 保存业务信息
        /// </summary>
        /// <param name="billInfo">业务总单信息</param>
        /// <param name="detailInfo">业务明细信息</param>
        public void SaveInfo(Business_WarehouseInPut_InPut billInfo, List <View_Business_WarehouseInPut_InPutDetail> detailInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

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

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

                if (varData.Count() == 1)
                {
                    Business_WarehouseInPut_InPut 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_WarehouseInPut_InPut.InsertOnSubmit(billInfo);
                }
                else
                {
                    throw new Exception("单据数据不唯一");
                }

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

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

                foreach (View_Business_WarehouseInPut_InPutDetail item in detailInfo)
                {
                    Business_WarehouseInPut_InPutDetail lnqDetail = new Business_WarehouseInPut_InPutDetail();

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

                    if (!IsInput(lnqDetail))
                    {
                        throw new Exception(UniversalFunction.GetGoodsMessage(lnqDetail.GoodsID) + "【批次号】:"
                                            + lnqDetail.BatchNo + "【供应商】:" + lnqDetail.Provider + ",此物品无【检验报告】/【判定报告】");
                    }

                    ctx.Business_WarehouseInPut_InPutDetail.InsertOnSubmit(lnqDetail);
                }

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