/// <summary>
        /// 添加基础信息日志
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="ctx">数据上下文</param>
        /// <param name="logID">日志唯一编码</param>
        /// <param name="mode">操作类型</param>
        void AddMainInfo <T>(DepotManagementDataContext ctx, Guid logID, CE_OperatorMode mode)
        {
            SystemLog_Main lnqMain = new SystemLog_Main();

            lnqMain.LogID         = logID;
            lnqMain.OperationTime = ServerTime.Time;
            lnqMain.OperationType = mode.ToString();
            lnqMain.Operator      = BasicInfo.LoginID;
            lnqMain.TableName     = typeof(T).Name;

            ctx.SystemLog_Main.InsertOnSubmit(lnqMain);
        }
Beispiel #2
0
 /// <summary>
 /// 操作数据库
 /// </summary>
 void OperatorInfo(CE_OperatorMode operatorMode)
 {
     try
     {
         m_serverCBOM.OperatorInfo(operatorMode, Convert.ToInt32(tbsGoods.Tag), numSafeStockCount.Value, m_dicNumber);
         MessageDialog.ShowPromptMessage(operatorMode.ToString() + "成功");
         RefreshData();
     }
     catch (Exception ex)
     {
         MessageDialog.ShowPromptMessage(ex.Message);
     }
 }
Beispiel #3
0
        void MainOperation(CE_OperatorMode mode)
        {
            S_StockLackCustomTemplates tempLnq = new S_StockLackCustomTemplates();

            tempLnq.ID            = dataGridView1.CurrentRow == null ? 0 : Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value);
            tempLnq.TemplatesName = txtTemplatesName.Text;

            if (!m_serverLack.OperationMain(mode, tempLnq, out m_strErr))
            {
                MessageDialog.ShowPromptMessage(m_strErr);
                return;
            }
            else
            {
                MessageDialog.ShowPromptMessage(mode.ToString() + "成功");
            }

            BindingMainInfo();
            PositioningRecord1(tempLnq.TemplatesName);
        }
Beispiel #4
0
        void ListOperation(CE_OperatorMode mode)
        {
            S_StockLackCustomTemplatesList tempLnq = new S_StockLackCustomTemplatesList();

            tempLnq.ID      = dataGridView2.CurrentRow == null ? 0 : Convert.ToInt32(dataGridView2.CurrentRow.Cells["ID"].Value);
            tempLnq.Counts  = numOperationCount.Value;
            tempLnq.GoodsID = Convert.ToInt32(txtCode.Tag);
            tempLnq.ListID  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value);

            if (!m_serverLack.OperationList(mode, tempLnq, out m_strErr))
            {
                MessageDialog.ShowPromptMessage(m_strErr);
                return;
            }
            else
            {
                MessageDialog.ShowPromptMessage(mode.ToString() + "成功");
            }

            BindingListInfo(tempLnq.ListID);
            PositioningRecord2(tempLnq.GoodsID);
        }
Beispiel #5
0
        /// <summary>
        /// 明细操作
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="billNo">单据号</param>
        /// <param name="detailInfo">明细信息</param>
        /// <param name="mode">操作类型</param>
        void OperationDetailInfo(DepotManagementDataContext ctx, string billNo, S_MaterialRequisitionGoods detailInfo, CE_OperatorMode mode)
        {
            try
            {
                var varBill = from a in ctx.S_MaterialRequisition
                              where a.Bill_ID == billNo
                              select a;

                if (varBill.Count() != 1)
                {
                    throw new Exception("【单据号】:" + billNo + " 不存在或者不唯一");
                }

                if (varBill.Single().BillStatus == MaterialRequisitionBillStatus.已出库.ToString())
                {
                    throw new Exception("【单据号】:" + billNo + " 已出库 无法进行操作");
                }

                if (mode == CE_OperatorMode.添加 || mode == CE_OperatorMode.除 || mode == CE_OperatorMode.修改)
                {
                    if (detailInfo == null)
                    {
                        throw new Exception("需要操作的记录为空,无法操作【" + mode.ToString() + "】");
                    }

                    var varData = from a in ctx.S_MaterialRequisitionGoods
                                  where a.ID == detailInfo.ID
                                  select a;

                    switch (mode)
                    {
                    case CE_OperatorMode.添加:

                        if (varData.Count() == 1)
                        {
                            S_MaterialRequisitionGoods tempInfo = varData.Single();

                            tempInfo.Bill_ID      = billNo;
                            tempInfo.GoodsID      = detailInfo.GoodsID;
                            tempInfo.BatchNo      = detailInfo.BatchNo;
                            tempInfo.BasicCount   = detailInfo.BasicCount;
                            tempInfo.ProviderCode = detailInfo.ProviderCode;
                            tempInfo.RealCount    = detailInfo.RealCount;
                            tempInfo.Remark       = detailInfo.Remark;
                            tempInfo.RepairStatus = detailInfo.RepairStatus;
                            tempInfo.RequestCount = detailInfo.RequestCount;
                            tempInfo.ShowPosition = detailInfo.ShowPosition;
                        }
                        else if (varData.Count() == 0)
                        {
                            detailInfo.Bill_ID = billNo;
                            ctx.S_MaterialRequisitionGoods.InsertOnSubmit(detailInfo);
                        }
                        else
                        {
                            throw new Exception(UniversalFunction.GetGoodsMessage(ctx, detailInfo.GoodsID) + "【批次号】:"
                                                + detailInfo.BatchNo + "【供应商】:" + detailInfo.ProviderCode + " 数据不唯一");
                        }

                        break;

                    case CE_OperatorMode.修改:

                        if (varData.Count() == 1)
                        {
                            S_MaterialRequisitionGoods tempInfo = varData.Single();

                            tempInfo.Bill_ID      = billNo;
                            tempInfo.GoodsID      = detailInfo.GoodsID;
                            tempInfo.BatchNo      = detailInfo.BatchNo;
                            tempInfo.BasicCount   = detailInfo.BasicCount;
                            tempInfo.ProviderCode = detailInfo.ProviderCode;
                            tempInfo.RealCount    = detailInfo.RealCount;
                            tempInfo.Remark       = detailInfo.Remark;
                            tempInfo.RepairStatus = detailInfo.RepairStatus;
                            tempInfo.RequestCount = detailInfo.RequestCount;
                            tempInfo.ShowPosition = detailInfo.ShowPosition;
                        }
                        else
                        {
                            throw new Exception(UniversalFunction.GetGoodsMessage(ctx, detailInfo.GoodsID) + "【批次号】:"
                                                + detailInfo.BatchNo + "【供应商】:" + detailInfo.ProviderCode + " 数据不唯一或者为空");
                        }

                        break;

                    case CE_OperatorMode.除:
                        ctx.S_MaterialRequisitionGoods.DeleteAllOnSubmit(varData);
                        break;

                    default:
                        break;
                    }
                }
                else if (mode == CE_OperatorMode.批量删除)
                {
                    if (billNo == null)
                    {
                        throw new Exception("单据号为空,无法操作【" + mode.ToString() + "】");
                    }

                    var varAllDelete = from a in ctx.S_MaterialRequisitionGoods
                                       where a.Bill_ID == billNo
                                       select a;
                    ctx.S_MaterialRequisitionGoods.DeleteAllOnSubmit(varAllDelete);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #6
0
        void OperationBusiness()
        {
            string type = GetMode(panel2);
            string mode = GetMode(panel3);

            if (type.Trim().Length == 0 || mode.Trim().Length == 0)
            {
                MessageDialog.ShowPromptMessage("请选择【单据类型】、【操作类型】");
                return;
            }
            CE_HR_AttendanceExceptionType billType =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_HR_AttendanceExceptionType>(type);
            CE_OperatorMode operationMode =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_OperatorMode>(mode);

            if (!CheckData())
            {
                return;
            }

            List <object>             lstInfo      = new List <object>();
            List <PersonnelBasicInfo> lstPersonnel = new List <PersonnelBasicInfo>();

            lstInfo.Add(ServerTime.ConvertToDateTime(dtp_BeginTime.Value));
            lstInfo.Add(ServerTime.ConvertToDateTime(dtp_EndTime.Value));
            lstInfo.Add(cmb_BusinessType.Text);
            lstInfo.Add(txtContent.Text.Trim());
            lstInfo.Add(num_Hours.Value);

            if (operationMode == CE_OperatorMode.添加)
            {
                lstInfo.Add(null);

                MessageDialog.ShowPromptMessage(string.Format("请设置需要【{0}】的人员", billType.ToString()));
                FormSelectPersonnel2 frm = new FormSelectPersonnel2();

                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    if (frm.SelectedNotifyPersonnelInfo.UserType != BillFlowMessage_ReceivedUserType.用户.ToString())
                    {
                        MessageDialog.ShowPromptMessage("请选择【用户】");
                        return;
                    }
                    else
                    {
                        lstPersonnel = frm.SelectedNotifyPersonnelInfo.PersonnelBasicInfoList;
                    }
                }

                _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
            }
            else if (operationMode == CE_OperatorMode.修改)
            {
                lstInfo.Add((int)customDataGridView1.CurrentRow.Cells["单据号"].Value);

                if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No)
                {
                    return;
                }

                _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
            }
            else if (operationMode == CE_OperatorMode.除)
            {
                if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No)
                {
                    return;
                }

                if (customDataGridView1.SelectedRows.Count == 0)
                {
                    MessageDialog.ShowPromptMessage("请选择需要【删除】的记录");
                    return;
                }

                foreach (DataGridViewRow dgvr in customDataGridView1.SelectedRows)
                {
                    lstInfo.Add((int)dgvr.Cells["单据号"].Value);
                    lstPersonnel = new List <PersonnelBasicInfo>();
                    PersonnelBasicInfo personnel = new PersonnelBasicInfo();

                    personnel.工号 = dgvr.Cells["执行人"].Value.ToString();
                    lstPersonnel.Add(personnel);

                    _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
                }
            }

            MessageDialog.ShowPromptMessage(string.Format("【{0}单{1}成功】", billType.ToString(), operationMode.ToString()));
            RefreshDataGridView();
        }