Exemplo n.º 1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="nodeInfo">功能树节点信息</param>
        public 自制件入库单(PlatformManagement.FunctionTreeNodeInfo nodeInfo)
        {
            InitializeComponent();

            m_msgPromulgator.BillType = "自制件入库单";
            m_billNoControl           = new BillNumberControl(CE_BillTypeEnum.自制件入库单.ToString(), m_billServer);

            m_authFlag = nodeInfo.Authority;

            cmbStorage.DataSource = UniversalFunction.GetListStorageInfo().Where(k => k.ZeroCostFlag == true).ToList();

            cmbStorage.ValueMember   = "StorageID";
            cmbStorage.DisplayMember = "StorageName";
            cmbStorage.SelectedText  = CE_StorageName.自制半成品库.ToString();

            //DataTable dt = UniversalFunction.GetStorageTb();

            //DataRow[] drList = dt.Select("StorageID in ('01','03','08','10')");
            //DataTable dtTemp = dt.Clone();

            //foreach (DataRow dr in drList)
            //{
            //    dtTemp.ImportRow(dr);
            //}

            //cmbStorage.DataSource = dtTemp;

            checkBillDateAndStatus1.InsertComBox(typeof(HomemadeBillStatus));

            S_HomemadePartBill tempBill = m_billServer.GetBill(txtBill_ID.Text);

            m_lnqWSCode = tempBill == null?
                          m_serverWSBasic.GetPersonnelWorkShop(BasicInfo.LoginID) :
                              m_serverWSBasic.GetPersonnelWorkShop(tempBill.DeclarePersonnelCode);

            btnBatchNo.Visible = m_lnqWSCode == null ? false : true;


            #region 被要求使用服务器时间 Modify by cjb on 2012.6.15
            checkBillDateAndStatus1.dtpStartTime.Value = ServerTime.Time.AddDays(1).AddMonths(-1);
            checkBillDateAndStatus1.dtpEndTime.Value   = ServerTime.Time.AddDays(1);

            #endregion

            btnRefresh_Click(null, null);

            if (!Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块]))
            {
                btnBatchNo.Visible = false;
            }
        }
        /// <summary>
        /// 更新自制件入库单
        /// </summary>
        /// <param name="updateBill">更新的自制件单据信息</param>
        /// <param name="returnBill">返回的单据查询结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateBill(S_HomemadePartBill updateBill, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;
            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                S_HomemadePartBill bill = (from r in dataContxt.S_HomemadePartBill
                                           where r.Bill_ID == updateBill.Bill_ID
                                           select r).Single();

                bill.BatchNo = updateBill.BatchNo;

                bill.Bill_Time            = updateBill.Bill_Time;
                bill.BillStatus           = updateBill.BillStatus;
                bill.DeclareCount         = updateBill.DeclareCount;
                bill.DeclarePersonnel     = updateBill.DeclarePersonnel;
                bill.DeclarePersonnelCode = updateBill.DeclarePersonnelCode;
                bill.GoodsID         = updateBill.GoodsID;
                bill.Provider        = updateBill.Provider;
                bill.ProviderBatchNo = updateBill.ProviderBatchNo;
                bill.RebackReason    = "";
                bill.Remark          = updateBill.Remark;

                #region 获取计划价格
                decimal planUnitPrice = 0;
                bill.PlanUnitPrice = planUnitPrice;
                bill.PlanPrice     = bill.DeclareCount * planUnitPrice;
                #endregion

                #region 获取单价

                bill.UnitPrice  = 0;
                bill.Price      = bill.UnitPrice * bill.DeclareCount;
                bill.TotalPrice = CalculateClass.GetTotalPrice((decimal)bill.Price);

                #endregion

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 添加自制件入库单
        /// </summary>
        /// <param name="bill">自制件单据信息</param>
        /// <param name="returnBill">添加完毕后查询数据库的返回结果</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool AddBill(S_HomemadePartBill bill, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                string billID = m_assignBill.AssignNewNo(this, CE_BillTypeEnum.自制件入库单.ToString());

                bill.Bill_ID   = billID;
                bill.BatchNo   = bill.BatchNo == "系统自动生成" ? billID : bill.BatchNo;
                bill.Bill_Time = ServerModule.ServerTime.Time;

                #region 获取计划价格

                View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfoView(bill.GoodsID);

                decimal planUnitPrice = basicGoods.单价;

                bill.PlanUnitPrice = planUnitPrice;
                bill.PlanPrice     = bill.DeclareCount * planUnitPrice;
                #endregion

                #region 获取单价

                bill.UnitPrice  = 0;
                bill.Price      = bill.UnitPrice * bill.DeclareCount;
                bill.TotalPrice = CalculateClass.GetTotalPrice((decimal)bill.Price);

                #endregion

                if (GlobalObject.GeneralFunction.IsNullOrEmpty(bill.Bill_ID))
                {
                    throw new Exception("【单据号】获取失败,请重新再试");
                }

                dataContxt.S_HomemadePartBill.InsertOnSubmit(bill);
                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemplo n.º 4
0
        private void 修改单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HomemadeBillStatus status = (HomemadeBillStatus)Enum.Parse(typeof(HomemadeBillStatus),
                                                                       dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString());

            if (status != HomemadeBillStatus.回退_编制单据有误)
            {
                MessageDialog.ShowPromptMessage("当前状态不允许修改单据");
                return;
            }

            if (!CheckDataItem())
            {
                return;
            }

            S_HomemadePartBill bill = new S_HomemadePartBill();

            bill.Bill_ID              = txtBill_ID.Text;
            bill.Bill_Time            = ServerModule.ServerTime.Time;           // 报检日期
            bill.BillStatus           = HomemadeBillStatus.等待质检.ToString();
            bill.DeclarePersonnelCode = BasicInfo.LoginID;                      // 自制件员编码
            bill.DeclarePersonnel     = BasicInfo.LoginName;                    // 自制件员签名
            bill.DeclareCount         = Convert.ToInt32(numDeclareCount.Value); // 自制件数
            bill.Provider             = txtProvider.Tag.ToString();             // 供应商编码
            bill.ProviderBatchNo      = txtProviderBatchNo.Text;                // 供应商批次
            bill.GoodsID              = (int)txtCode.Tag;
            bill.Remark    = txtRemark.Text;
            bill.BatchNo   = txtBatchNo.Text;
            bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text);

            if (!m_billServer.UpdateBill(bill, out m_findBill, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("物品【{0}】,批次号【{1}】  ※※※ 等待【检验员】处理", txtName.Text, txtBatchNo.Text);
            PassFlowMessage(sb.ToString(), CE_RoleEnum.自制件检验组长);
            RefreshDataGridView(m_findBill);
            PositioningRecord(bill.Bill_ID);

            MessageDialog.ShowPromptMessage("成功提交,等待重新质检!");
        }
        /// <summary>
        /// 提交质量信息
        /// </summary>
        /// <param name="billID">单据编号</param>
        /// <param name="qualityInfo">质量信息, 只取其中质量部分</param>
        /// <param name="returnBill">返回的单据查询结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool SubmitQualityInfo(string billID, S_HomemadePartBill qualityInfo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_HomemadePartBill
                             where r.Bill_ID == billID
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到入库单号为 [{0}] 的自制件入库单!", billID);
                    return(false);
                }

                S_HomemadePartBill bill = result.Single();

                bill.Checker                = qualityInfo.Checker;                // 检验员
                bill.QualityInputer         = qualityInfo.QualityInputer;         // 质量信息输入者
                bill.EligibleCount          = qualityInfo.EligibleCount;          // 合格数量
                bill.ConcessionCount        = qualityInfo.ConcessionCount;        // 让步数
                bill.ReimbursementCount     = qualityInfo.ReimbursementCount;     // 退货数
                bill.DeclareWastrelCount    = qualityInfo.DeclareWastrelCount;    // 报废数
                bill.QualityInfo            = qualityInfo.QualityInfo;            // 质量信息
                bill.CheckoutReport_ID      = qualityInfo.CheckoutReport_ID;      // 检验报告编号
                bill.CheckoutJoinGoods_Time = qualityInfo.CheckoutJoinGoods_Time; // 检验入库时间
                bill.BillStatus             = qualityInfo.BillStatus;             // 单据状态
                bill.RebackReason           = "";
                bill.CheckTime              = ServerTime.Time;

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 赋值库存信息
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <returns>返回库存信息对象</returns>
        S_Stock AssignStockInfo(DepotManagementDataContext dataContext, S_HomemadePartBill bill)
        {
            S_Stock stock = new S_Stock();

            stock.GoodsID = bill.GoodsID;

            stock.StorageID       = bill.StorageID;
            stock.ShelfArea       = bill.ShelfArea;
            stock.ColumnNumber    = bill.ColumnNumber;
            stock.LayerNumber     = bill.LayerNumber;
            stock.Provider        = bill.Provider;
            stock.ProviderBatchNo = bill.ProviderBatchNo;
            stock.BatchNo         = bill.BatchNo;
            stock.ExistCount      = bill.InDepotCount;
            stock.UnitPrice       = bill.UnitPrice;
            stock.StorageID       = bill.StorageID;

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

            S_InDepotDetailBill detailInfo = AssignDetailInfo(dataContext, bill);
            S_Stock             stockInfo  = AssignStockInfo(dataContext, bill);

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

            if (bill.DeclareCount < bill.InDepotCount)
            {
                throw new Exception("入库数不能大于报检数");
            }

            serverDetail.ProcessInDepotDetail(dataContext, detailInfo, stockInfo);
        }
Exemplo n.º 8
0
        private void 提交单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckDataItem())
            {
                return;
            }

            if (lblBillStatus.Text != "新建单据")
            {
                MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法提交,如果是回退后重新提交请选择“修改单据”功能");
                return;
            }

            S_HomemadePartBill bill = new S_HomemadePartBill();

            bill.Bill_Time            = ServerTime.Time;                        // 报检日期
            bill.BillStatus           = HomemadeBillStatus.等待质检.ToString();
            bill.DeclarePersonnelCode = BasicInfo.LoginID;                      // 自制件员编码
            bill.DeclarePersonnel     = BasicInfo.LoginName;                    // 自制件员签名
            bill.DeclareCount         = Convert.ToInt32(numDeclareCount.Value); // 自制件数
            bill.Provider             = txtProvider.Tag.ToString();             // 供应商编码
            bill.ProviderBatchNo      = txtProviderBatchNo.Text;                // 供应商批次
            bill.GoodsID   = (int)txtCode.Tag;
            bill.Remark    = txtRemark.Text;
            bill.BatchNo   = txtBatchNo.Text;
            bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text);

            if (!m_billServer.AddBill(bill, out m_findBill, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            MessageDialog.ShowPromptMessage("成功提交,等待质检!");

            m_msgPromulgator.DestroyMessage(bill.Bill_ID);
            SendNewFlowMessage(bill);
            RefreshDataGridView(m_findBill);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 发送新的流消息
        /// </summary>
        /// <param name="bill">单据内容</param>
        void SendNewFlowMessage(S_HomemadePartBill bill)
        {
            Flow_BillFlowMessage msg = new Flow_BillFlowMessage();

            msg.初始发起方用户编码 = BasicInfo.LoginID;
            msg.单据号       = bill.Bill_ID;
            msg.单据类型      = labelTitle.Text;
            msg.单据流水号     = bill.Bill_ID;
            msg.接收方类型     = BillFlowMessage_ReceivedUserType.角色.ToString();
            msg.单据状态      = BillStatus.等待处理.ToString();

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("物品【{0}】,批次号【{1}】  ※※※ 等待【检验员】处理", txtName.Text, txtBatchNo.Text);

            msg.发起方消息 = sb.ToString();
            msg.接收方   = CE_RoleEnum.自制件检验组长.ToString();

            msg.期望的处理完成时间 = null;

            m_billFlowMsg.SendRequestMessage(BasicInfo.LoginID, msg);
        }
        /// <summary>
        /// 确认到货数
        /// </summary>
        /// <param name="billID">单据编号</param>
        /// <param name="confirmAmountSignatory">仓库收货员签名</param>
        /// <param name="goodsAmount">货物数量</param>
        /// <param name="billStatusInfo">单据状态消息</param>
        /// <param name="returnBill">返回的单据查询结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool AffirmGoodsAmount(string billID, string confirmAmountSignatory, int goodsAmount,
                                      string billStatusInfo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_HomemadePartBill
                             where r.Bill_ID == billID
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到入库单号为 [{0}] 的自制件入库单!", billID);
                    return(false);
                }

                S_HomemadePartBill bill = result.Single();

                bill.DepotManagerAffirmCount = goodsAmount;
                bill.BillStatus             = billStatusInfo;
                bill.ConfirmAmountSignatory = confirmAmountSignatory;
                bill.RebackReason           = "";

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="dataContxt">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <returns>返回账务信息</returns>
        public S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext dataContxt, S_HomemadePartBill bill)
        {
            S_InDepotDetailBill detailBill = new S_InDepotDetailBill();

            detailBill.ID              = Guid.NewGuid();
            detailBill.BillTime        = (DateTime)bill.InDepotTime;
            detailBill.FillInPersonnel = bill.DeclarePersonnel;
            detailBill.Department      = UniversalFunction.GetPersonnelInfo(dataContxt, bill.DeclarePersonnelCode).部门名称;
            detailBill.FactPrice       = Math.Round(Convert.ToDecimal(bill.InDepotCount) * bill.UnitPrice, 2);
            detailBill.FactUnitPrice   = bill.UnitPrice;
            detailBill.GoodsID         = bill.GoodsID;
            detailBill.BatchNo         = bill.BatchNo;
            detailBill.InDepotBillID   = bill.Bill_ID;
            detailBill.InDepotCount    = bill.InDepotCount;
            detailBill.Price           = Math.Round(Convert.ToDecimal(bill.InDepotCount) * bill.UnitPrice, 2);
            detailBill.UnitPrice       = bill.UnitPrice;
            detailBill.OperationType   = (int)CE_SubsidiaryOperationType.自制件入库;
            detailBill.StorageID       = bill.StorageID;
            detailBill.Provider        = bill.Provider;
            detailBill.FillInDate      = bill.Bill_Time;
            detailBill.AffrimPersonnel = bill.DepotManager;

            return(detailBill);
        }
        /// <summary>
        /// 逐级回退单据
        /// </summary>
        /// <param name="billID">单据号</param>
        /// <param name="rebackReason">回退原因</param>
        /// <param name="returnBill">返回的单据查询结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool RebackBill(string billID, string rebackReason, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            var result = from r in dataContxt.S_HomemadePartBill
                         where r.Bill_ID == billID
                         select r;

            if (result.Count() == 0)
            {
                error = string.Format("找不到编号为 [{0}] 的自制件入库单号", billID);
                return(false);
            }

            S_HomemadePartBill bill = result.Single();

            HomemadeBillStatus status = (HomemadeBillStatus)Enum.Parse(typeof(HomemadeBillStatus), bill.BillStatus);

            bool needReback = false;

            if (status == HomemadeBillStatus.等待质检 || status == HomemadeBillStatus.回退_质检信息有误)
            {
                needReback                  = true;
                bill.BillStatus             = HomemadeBillStatus.回退_编制单据有误.ToString();
                bill.CheckoutJoinGoods_Time = null;
                bill.CheckoutReport_ID      = "";
                bill.EligibleCount          = 0;
                bill.ConcessionCount        = 0;
                bill.ReimbursementCount     = 0;
                bill.QualityInfo            = "";
                bill.Checker                = "";
                bill.QualityInputer         = "";
            }
            else if (status == HomemadeBillStatus.等待入库)
            {
                needReback      = true;
                bill.BillStatus = HomemadeBillStatus.回退_质检信息有误.ToString();
                bill.DepotManagerAffirmCount = 0;
                bill.InDepotCount            = 0;
                bill.ShelfArea    = "";
                bill.ColumnNumber = "";
                bill.LayerNumber  = "";
            }

            if (needReback)
            {
                try
                {
                    bill.RebackReason = rebackReason;
                    dataContxt.SubmitChanges();

                    return(GetAllBill(out returnBill, out error));
                }
                catch (Exception exce)
                {
                    error = exce.Message;
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 提交入库信息
        /// </summary>
        /// <param name="billID">单据编号</param>
        /// <param name="inDepotInfo">入库信息, 只取其中入库部分</param>
        /// <param name="returnBill">添加完毕后查询数据库的返回结果</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool SubmitInDepotInfo(string billID, S_HomemadePartBill inDepotInfo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_HomemadePartBill
                             where r.Bill_ID == billID
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到入库单号为 [{0}] 的自制件入库单!", billID);
                    return(false);
                }

                S_HomemadePartBill bill = result.Single();

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

                bill.DepotManager = inDepotInfo.DepotManager;
                bill.ShelfArea    = inDepotInfo.ShelfArea;
                bill.ColumnNumber = inDepotInfo.ColumnNumber;
                bill.LayerNumber  = inDepotInfo.LayerNumber;
                bill.InDepotCount = inDepotInfo.InDepotCount;
                bill.BillStatus   = inDepotInfo.BillStatus;
                bill.RebackReason = "";
                bill.InDepotTime  = ServerTime.Time;

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

                string mrBillNo = "";

                if ((int)bill.DeclareWastrelCount > 0 && bill.InDepotCount > 0)
                {
                    if (!InsertIntoMaterialRequisition(dataContxt, bill, out mrBillNo, out error))
                    {
                        throw new Exception(error);
                    }
                }

                IFrockStandingBook serviceForck = PMS_ServerFactory.GetServerModule <ServerModule.IFrockStandingBook>();
                serviceForck.RecordFrockUseCounts_HomemadePart(dataContxt, bill.GoodsID, bill.InDepotCount);

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 有检测废的物品直接生成领料单
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="inDepotInfo">自制件入库单信息</param>
        /// <param name="mrBillNo">分配的领料单单号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool InsertIntoMaterialRequisition(DepotManagementDataContext ctx, S_HomemadePartBill inDepotInfo,
                                                  out string mrBillNo, out string error)
        {
            error    = null;
            mrBillNo = null;
            string billNo = null;
            MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();

            billNo = m_assignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

            mrBillNo = billNo;

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

                S_MaterialRequisition lnqMaterial = null;

                if (varData.Count() != 0)
                {
                    error = string.Format("自动生成的报废物品领料单单号 {0} 已被占用,请尝试重新进行此操作,再三出现无法生成可用的单号时与管理员联系", billNo);
                    return(false);
                }
                else
                {
                    lnqMaterial = new S_MaterialRequisition();

                    lnqMaterial.Bill_ID             = billNo;
                    lnqMaterial.Bill_Time           = ServerModule.ServerTime.Time;
                    lnqMaterial.AssociatedBillNo    = "";
                    lnqMaterial.AssociatedBillType  = "";
                    lnqMaterial.BillStatus          = "已出库";
                    lnqMaterial.Department          = "ZK01";
                    lnqMaterial.DepartmentDirector  = "";
                    lnqMaterial.DepotManager        = "";
                    lnqMaterial.FetchCount          = 0;
                    lnqMaterial.FetchType           = "零星领料";
                    lnqMaterial.FillInPersonnel     = inDepotInfo.QualityInputer;
                    lnqMaterial.FillInPersonnelCode = UniversalFunction.GetPersonnelInfo(inDepotInfo.QualityInputer).工号;
                    lnqMaterial.ProductType         = "";
                    lnqMaterial.PurposeCode         = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.破坏性检测).Code;
                    lnqMaterial.Remark    = "因入库零件进行了破坏性检测,由系统自动生成的破坏件领料单,对应单据号:" + inDepotInfo.Bill_ID;
                    lnqMaterial.StorageID = inDepotInfo.StorageID;

                    if (!serverMaterialBill.AutoCreateBill(ctx, lnqMaterial, out error))
                    {
                        return(false);
                    }
                    //ctx.S_MaterialRequisition.InsertOnSubmit(lnqMaterial);
                }

                var varDataList = from a in ctx.S_MaterialRequisitionGoods
                                  where a.Bill_ID == billNo
                                  select a;

                if (varDataList.Count() != 0)
                {
                    error = "此单据号已被占用";
                    return(false);
                }
                else
                {
                    S_MaterialRequisitionGoods lnqMaterialGoods = new S_MaterialRequisitionGoods();

                    lnqMaterialGoods.Bill_ID      = billNo;
                    lnqMaterialGoods.BasicCount   = 0;
                    lnqMaterialGoods.BatchNo      = inDepotInfo.BatchNo;
                    lnqMaterialGoods.GoodsID      = inDepotInfo.GoodsID;
                    lnqMaterialGoods.ProviderCode = inDepotInfo.Provider;
                    lnqMaterialGoods.RealCount    = Convert.ToDecimal(inDepotInfo.DeclareWastrelCount);
                    lnqMaterialGoods.Remark       = "";
                    lnqMaterialGoods.RequestCount = Convert.ToDecimal(inDepotInfo.DeclareWastrelCount);
                    lnqMaterialGoods.ShowPosition = 1;

                    MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

                    if (!serverMaterialGoods.AutoCreateGoods(ctx, lnqMaterialGoods, out error))
                    {
                        return(false);
                    }
                    //ctx.S_MaterialRequisitionGoods.InsertOnSubmit(lnqMaterialGoods);
                }

                ctx.SubmitChanges();

                if (!serverMaterialBill.FinishBill(ctx, lnqMaterial.Bill_ID, "", out error))
                {
                    throw new Exception(error);
                }

                ctx.SubmitChanges();

                return(m_assignBill.UseBillNo(CE_BillTypeEnum.领料单.ToString(), billNo));
            }
            catch (Exception ex)
            {
                serverMaterialBill.DeleteBill(billNo, out error);
                error = ex.Message;
                return(false);
            }
        }
Exemplo n.º 15
0
        private void 零件入库ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0 ||
                dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString() != HomemadeBillStatus.等待入库.ToString())
            {
                MessageDialog.ShowPromptMessage("请选择等待入库的记录后再进行此操作!");
                return;
            }

            if (dataGridView1.SelectedRows.Count > 1)
            {
                MessageDialog.ShowPromptMessage("只允许选择一条记录进行处理!");
                return;
            }


            if (txtShelf.Text == "")
            {
                txtShelf.Focus();
                MessageDialog.ShowPromptMessage("区域信息不能为空");

                return;
            }

            if (txtColumn.Text == "")
            {
                txtColumn.Focus();
                MessageDialog.ShowPromptMessage("区号信息不能为空");

                return;
            }

            if (txtLayer.Text == "")
            {
                txtLayer.Focus();
                MessageDialog.ShowPromptMessage("层号信息不能为空");

                return;
            }

            S_HomemadePartBill inDepotInfo = new S_HomemadePartBill();

            inDepotInfo.DepotManager            = BasicInfo.LoginName;
            inDepotInfo.DepotManagerAffirmCount = Convert.ToInt32(numDeclareCount.Value);
            inDepotInfo.InDepotCount            = Convert.ToInt32(numInDepotCount.Value);
            inDepotInfo.ShelfArea    = txtShelf.Text;
            inDepotInfo.ColumnNumber = txtColumn.Text;
            inDepotInfo.LayerNumber  = txtLayer.Text;
            inDepotInfo.BillStatus   = HomemadeBillStatus.已入库.ToString();

            string billNo = txtBill_ID.Text;

            if (!m_billServer.SubmitInDepotInfo(billNo, inDepotInfo, out m_findBill, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0} 号自制件入库单仓库已经完成, ", billNo);
            sb.AppendFormat("此单据物品:图号【{0}】,名称【{1}】,规格【{2}】", txtCode.Text, txtName.Text, txtSpec.Text);

            EndFlowMessage(sb.ToString());
            RefreshDataGridView(m_findBill);
            PositioningRecord(billNo);

            MessageDialog.ShowPromptMessage("成功将零件入库!");
        }
Exemplo n.º 16
0
        private void 提交质检信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }

            HomemadeBillStatus status = (HomemadeBillStatus)Enum.Parse(typeof(HomemadeBillStatus),
                                                                       dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString());

            if (status != HomemadeBillStatus.等待质检 && status != HomemadeBillStatus.回退_质检信息有误)
            {
                MessageDialog.ShowPromptMessage("请选择等待质检的记录后再进行此操作");
                return;
            }

            dateTime_CheckTime.Value = ServerTime.Time;

            if (dateTime_CheckTime.Value < dateTime_BillTime.Value)
            {
                dateTime_CheckTime.Focus();
                MessageDialog.ShowPromptMessage("检验入库时间必须 >= 自制件时间");
                return;
            }

            if (txtQualityInfo.Text == "")
            {
                txtQualityInfo.Focus();
                MessageDialog.ShowPromptMessage("质量信息不能为空");
                return;
            }

            if (txtCheckoutReportID.Text == "")
            {
                txtCheckoutReportID.Focus();
                MessageDialog.ShowPromptMessage("检验报告编号不能为空");
                return;
            }

            if (numEligibleCount.Value + numConcessionCount.Value + numReimbursementCount.Value
                + numDeclareWastrelCount.Value != numDeclareCount.Value)
            {
                numEligibleCount.Focus();
                MessageDialog.ShowPromptMessage("合格数 + 让步数 + 退货数 + 报废数 之和不等于自制件数量");
                return;
            }

            if (txtChecker.Text == "")
            {
                txtChecker.Focus();
                MessageDialog.ShowPromptMessage("检验人员不能为空");

                return;
            }

            S_HomemadePartBill qualityInfo = new S_HomemadePartBill();

            qualityInfo.Checker                = txtChecker.Text;
            qualityInfo.QualityInputer         = BasicInfo.LoginName;
            qualityInfo.CheckoutJoinGoods_Time = dateTime_CheckTime.Value;
            qualityInfo.CheckoutReport_ID      = txtCheckoutReportID.Text;
            qualityInfo.QualityInfo            = txtQualityInfo.Text;
            qualityInfo.EligibleCount          = Convert.ToInt32(numEligibleCount.Value);
            qualityInfo.ConcessionCount        = Convert.ToInt32(numConcessionCount.Value);
            qualityInfo.ReimbursementCount     = Convert.ToInt32(numReimbursementCount.Value);
            qualityInfo.DeclareWastrelCount    = Convert.ToInt32(numDeclareWastrelCount.Value);
            qualityInfo.BillStatus             = HomemadeBillStatus.等待入库.ToString();

            string billNo = txtBill_ID.Text;

            if (!m_billServer.SubmitQualityInfo(billNo, qualityInfo, out m_findBill, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            MessageDialog.ShowPromptMessage("成功提交,等待仓管将零件入库!");

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("物品【{0}】,批次号【{1}】  ※※※ 等待【仓管员】处理", txtName.Text, txtBatchNo.Text);

            PassFlowMessage(sb.ToString(),
                            m_msgPromulgator.GetRoleStringForStorage(cmbStorage.Text));
            RefreshDataGridView(m_findBill);
            PositioningRecord(billNo);
        }