/// <summary>
        /// 刷新DataGridView
        /// </summary>
        void RefreshDataGridView()
        {
            DataTable dt = m_findSellIn.GetAllBill(CE_MarketingType.入库.ToString(),
                                                   dateTimePicker1.Value.ToShortDateString(),
                                                   dateTimePicker2.Value.ToShortDateString(),
                                                   cmbDJ_ZT.Text,
                                                   out m_err);

            if (dt == null)
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            dgv_Show.DataSource = dt;

            string error = null;

            Hashtable hsTable = new Hashtable();

            hsTable.Add("@BillNo", DBNull.Value);

            DataTable tempTable = GlobalObject.DatabaseServer.QueryInfoPro("S_Marketing_GreenLightInfo", hsTable, out error);

            _List_BillNo = DataSetHelper.ColumnsToList_Distinct(tempTable, "单据号");
        }
        bool frm_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            FM_InstitutionProcess lnqProcess = (FM_InstitutionProcess)form.ResultInfo;

            if (!CheckData(lnqProcess))
            {
                return(false);
            }

            MessageDialog.ShowPromptMessage("请选择相关部门");

            FormDataTableCheck frmCheck = new FormDataTableCheck(UniversalFunction.GetAllDeptInfo());

            if (frmCheck.ShowDialog() == DialogResult.OK)
            {
                List <string> list = DataSetHelper.ColumnsToList_Distinct(frmCheck._DtResult, "部门代码");

                if (!m_serverInstitution.AddInfo(lnqProcess, list, out m_strErr))
                {
                    MessageDialog.ShowPromptMessage(m_strErr);
                    return(false);
                }
            }
            else
            {
                MessageDialog.ShowPromptMessage("请选择相关部门");
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        private void btnCollect_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbYear.Text.Trim().Length == 0)
                {
                    throw new Exception("请选择【计划年份】");
                }

                FormDataTableCheck frm = new FormDataTableCheck(_ServiceSurvey.GetBillInfo_Year(Convert.ToInt32(cmbYear.Text)));

                frm._BlDateTimeControlShow = false;
                frm._BlIsCheckBox          = true;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    if (frm._DtResult != null && frm._DtResult.Rows.Count > 0)
                    {
                        List <string> lstBillNo = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "单据号");
                        _ServiceCollect.GenerateCollectPlan_Year(lstBillNo, Convert.ToInt32(cmbYear.Text));
                        RefreshViewCourse(CE_HR_Train_PlanType.年度培训计划, Convert.ToInt32(cmbYear.Text), null);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 4
0
        public List <string> GetCourse_User(int courseID)
        {
            string error = null;

            Hashtable hsTable = new Hashtable();

            hsTable.Add("@CourseID", courseID);
            DataTable dtTemp = GlobalObject.DatabaseServer.QueryInfoPro("HR_Train_GetCourseUser", hsTable, out error);

            return(DataSetHelper.ColumnsToList_Distinct(dtTemp, "WorkID"));
        }
Exemplo n.º 5
0
        private void btnBenchCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbBillType.Text.Trim().Length > 0)
                {
                    DataTable dataSource = m_serviceOutPut.GetReferenceInfo(cmbBillType.Text,
                                                                            txtApplyingDepartment.Tag == null ? null : txtApplyingDepartment.Tag.ToString(), chbIsRepeat.Checked);
                    FormDataTableCheck frm = new FormDataTableCheck(dataSource);
                    frm._BlDateTimeControlShow = false;

                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        List <string> listTemp = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "单据号");

                        string deptCode = "";
                        m_listViewDetail = m_serviceOutPut.GetReferenceListViewDetail(txtBillNo.Text, listTemp, chbIsRepeat.Checked, out deptCode);

                        if (m_listViewDetail != null)
                        {
                            txtApplyingDepartment.Text = UniversalFunction.GetDeptName(deptCode);
                            txtApplyingDepartment.Tag  = deptCode;

                            List <Business_WarehouseOutPut_Requisition> listRequisition =
                                m_serviceRequistion.GetListBillInfo(m_listViewDetail.Select(k => k.关联业务).Distinct().ToList());

                            cmbTypeDetail.DataSource = listRequisition.Select(k => k.BillTypeDetail).Distinct().ToList();
                            m_serverProductCode.InsertChangeProductCodesBillNo(listRequisition.Select(k => k.BillNo).ToList(), txtBillNo.Text);

                            customDataGridView1.Rows.Clear();
                            RefreshDataGridView(m_listViewDetail);
                        }
                    }

                    cmbBillType.Enabled = customDataGridView1.Rows.Count > 0 ? false : true;
                }
                else
                {
                    MessageDialog.ShowPromptMessage("请选择【业务类型】");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
        private void btnSetUser_Click(object sender, EventArgs e)
        {
            if (txtCourse.Text.Trim().Length == 0)
            {
                MessageDialog.ShowPromptMessage("请选择【课程】");
                return;
            }

            FormDataTableCheck frm = new FormDataTableCheck(_ServiceCollect.GetUserInfo(btnCourse.Tag.ToString()));

            frm._BlDateTimeControlShow = false;
            frm._BlIsCheckBox          = true;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                List <string> lstWork = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "工号");
                btnSetUser.Tag = lstWork;
            }
        }
        private void btnBenchCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbBillType.Text.Trim().Length > 0)
                {
                    switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(cmbBillType.Text))
                    {
                    case CE_InPutBusinessType.生产采购:
                    case CE_InPutBusinessType.普通采购:
                    case CE_InPutBusinessType.委外采购:
                    case CE_InPutBusinessType.样品采购:

                        IQueryable <View_B_OrderFormInfo> findOrderFormInfo;
                        IOrderFormInfoServer orderFormServer = ServerModule.ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();

                        if (!orderFormServer.GetAllOrderFormInfo(BasicInfo.ListRoles, BasicInfo.LoginID, out findOrderFormInfo, out m_strError))
                        {
                            MessageDialog.ShowErrorMessage(m_strError);
                            return;
                        }

                        DataTable          dataSource = GlobalObject.GeneralFunction.ConvertToDataTable <View_B_OrderFormInfo>(findOrderFormInfo);
                        FormDataTableCheck frm        = new FormDataTableCheck(dataSource);

                        frm._BlDateTimeControlShow = false;

                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            List <string> listTemp = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "订单号");

                            m_listViewDetail = m_serviceRequistion.GetListViewDetail_OrderForm(txtBillNo.Text, listTemp);
                            RefreshDataGridView(m_listViewDetail);
                        }

                        foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                        {
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["图号型号"]).m_EndSql =
                                " and 序号 in ( select GoodsID from B_OrderFormGoods where OrderFormNumber = '"
                                + dgvr.Cells["关联业务"].Value.ToString() + "')";
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["批次号"]).ReadOnly = true;
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["供应商"]).ReadOnly = true;
                        }

                        break;

                    default:
                        break;
                    }

                    cmbBillType.Enabled = customDataGridView1.Rows.Count > 0 ? false : true;
                }
                else
                {
                    MessageDialog.ShowPromptMessage("请选择【业务类型】");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }
        }
Exemplo n.º 8
0
        public static DataTable BillInfoShowFilter(DataTable billInfo, string billColumnsName)
        {
            if (billInfo == null)
            {
                return(null);
            }

            billInfo.AcceptChanges();
            string    error       = null;
            string    strBillNo   = "";
            DataTable resultTable = new DataTable();

            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            try
            {
                var varData = from a in ctx.Business_Base_BillNoFilterTemp
                              select a;

                ctx.Business_Base_BillNoFilterTemp.DeleteAllOnSubmit(varData);

                List <string> colList = DataSetHelper.ColumnsToList_Distinct(billInfo, billColumnsName);

                for (int i = 0; i < colList.Count; i++)
                {
                    Business_Base_BillNoFilterTemp tempLnq = new Business_Base_BillNoFilterTemp();

                    tempLnq.ID     = Guid.NewGuid();
                    tempLnq.BillNo = colList[i].ToString();

                    ctx.Business_Base_BillNoFilterTemp.InsertOnSubmit(tempLnq);
                }

                ctx.SubmitChanges();

                Hashtable hsTable = new Hashtable();

                hsTable.Add("@WorkID", BasicInfo.LoginID);

                DataTable tempTable = GlobalObject.DatabaseServer.QueryInfoPro("Business_Base_BillInfoShowFilter", hsTable, out error);

                var varTemp = from a in ctx.Business_Base_BillNoFilterTemp
                              select a;

                if (varTemp.Count() == 0)
                {
                    billInfo.Clear();
                    resultTable = billInfo;
                }
                else
                {
                    foreach (var item in varTemp)
                    {
                        strBillNo += "'" + item.BillNo + "',";
                    }

                    strBillNo = strBillNo.Substring(0, strBillNo.Length - 1);

                    resultTable = DataSetHelper.SiftDataTable(billInfo, billColumnsName + " in (" + strBillNo + ")", out error);
                }

                return(resultTable);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 9
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);
            }
        }
        private void btnMaterialsTransfer_Click(object sender, EventArgs e)
        {
            if (m_lnqWSCode == null)
            {
                return;
            }

            FormDataTableCheck frm =
                new FormDataTableCheck(m_serverMaterials.GetMaterialsTransferInfo(m_lnqWSCode.WSCode));

            frm.OnFormDataTableCheckFind += new GlobalObject.DelegateCollection.FormDataTableCheckFindDelegate(frm_OnFormDataTableCheckFind);
            frm._BlDateTimeControlShow    = true;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                List <string> listRequisition = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "单据号");

                DataTable tempTable =
                    m_serverMaterials.SumMaterialsTransferGoods(listRequisition,
                                                                (int)CE_SubsidiaryOperationType.物料转换后, (int)CE_SubsidiaryOperationType.领料退库,
                                                                m_lnqWSCode.WSCode);

                foreach (DataRow dr in tempTable.Rows)
                {
                    S_MaterialListReturnedInTheDepot goods = new S_MaterialListReturnedInTheDepot();

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

                    StoreQueryCondition condition = new StoreQueryCondition();

                    condition.GoodsID   = Convert.ToInt32(txtCode.Tag);
                    condition.BatchNo   = dr["批次号"].ToString();
                    condition.StorageID = m_strStorage;

                    S_Stock tempStock = m_serverStock.GetStockInfo(condition);

                    if (tempStock != null)
                    {
                        goods.Provider        = tempStock.Provider;
                        goods.ProviderBatchNo = tempStock.ProviderBatchNo;
                    }
                    else
                    {
                        goods.Provider        = "";
                        goods.ProviderBatchNo = "";
                    }

                    goods.BatchNo        = dr["批次号"].ToString();
                    goods.ReturnedAmount = Convert.ToDecimal(dr["数量"]);
                    goods.Remark         = txtRemark.Text;
                    goods.ShelfArea      = "";
                    goods.ColumnNumber   = "";
                    goods.LayerNumber    = "";

                    //产品状态 设置 2012.3.30 by cjb
                    if (cmbProductStatus.Text.Trim() != "")
                    {
                        if (cmbProductStatus.Text.Trim() == "已返修")
                        {
                            goods.RepairStatus = true;
                        }
                        else
                        {
                            goods.RepairStatus = false;
                        }
                    }

                    if (!m_goodsServer.AddGoods(goods, out m_error))
                    {
                        MessageDialog.ShowErrorMessage(m_error);
                        return;
                    }
                }

                m_queryGoodsInfo = m_goodsServer.GetGoods(m_billNo);
                RefreshDataGridView(m_queryGoodsInfo);
            }
        }
Exemplo n.º 11
0
        public void InputQuestionsBank(int courseID, DataTable questionsTable)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

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

            try
            {
                questionsTable = DataSetHelper.OrderBy(questionsTable, "考题ID,选项");

                List <string> lstQuestions = DataSetHelper.ColumnsToList_Distinct(questionsTable, "考题ID");

                foreach (string questionsID in lstQuestions)
                {
                    DataTable tempQuestions = DataSetHelper.SiftDataTable(questionsTable, "考题ID = '" + questionsID + "'");

                    if (tempQuestions.Rows.Count > 0)
                    {
                        CE_HR_Train_QuesitonsType quesType =
                            GeneralFunction.StringConvertToEnum <CE_HR_Train_QuesitonsType>(tempQuestions.Rows[0]["考题类型"].ToString());

                        HR_Train_QuestionBank bank = new HR_Train_QuestionBank();
                        switch (quesType)
                        {
                        case CE_HR_Train_QuesitonsType.判断题:
                            bank.Answer    = tempQuestions.Rows[0]["答案"].ToString().ToUpper();
                            bank.CourseID  = courseID;
                            bank.ID        = Guid.NewGuid();
                            bank.Questions = tempQuestions.Rows[0]["考题内容"].ToString();
                            bank.Type      = tempQuestions.Rows[0]["考题类型"].ToString();

                            ctx.HR_Train_QuestionBank.InsertOnSubmit(bank);

                            break;

                        case CE_HR_Train_QuesitonsType.单选题:
                        case CE_HR_Train_QuesitonsType.多选题:

                            Guid guid = Guid.NewGuid();

                            bank.Answer    = tempQuestions.Rows[0]["答案"].ToString().ToUpper();
                            bank.CourseID  = courseID;
                            bank.ID        = guid;
                            bank.Questions = tempQuestions.Rows[0]["考题内容"].ToString();
                            bank.Type      = tempQuestions.Rows[0]["考题类型"].ToString();

                            ctx.HR_Train_QuestionBank.InsertOnSubmit(bank);
                            ctx.SubmitChanges();

                            foreach (DataRow dr in tempQuestions.Rows)
                            {
                                HR_Train_QuestionBank_Option option = new HR_Train_QuestionBank_Option();

                                option.OptionContent = dr["选项内容"].ToString();
                                option.OptionTag     = dr["选项"].ToString().ToUpper();
                                option.QuestionID    = guid;

                                ctx.HR_Train_QuestionBank_Option.InsertOnSubmit(option);
                            }

                            ctx.SubmitChanges();
                            break;

                        default:
                            break;
                        }
                    }
                }

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