Beispiel #1
0
        /// <summary>
        /// 审核事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSh_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_strDJZTFlag == "已保存")
                {
                    if (m_findSellIn.AuditingBill(m_intDJID, txtRemarkAll.Text, out m_err))
                    {
                        MessageBox.Show("审核成功!", "提示");

                        m_billMessageServer.PassFlowMessage(txtSellID.Text,
                                                            string.Format("【入库方式】:{0}  【库房】:{1}   ※※※ 等待【质检员】处理", cmbRKFS.Text, cmbStorage.Text),
                                                            CE_RoleEnum.质量工程师.ToString(), true);
                        this.Close();
                    }
                    else
                    {
                        MessageDialog.ShowErrorMessage(m_err);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("请重新确认单据状态!", "提示");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowErrorMessage(ex.Message);
                return;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 审核事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSh_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_strDJZTFlag == "已保存")
                {
                    if (m_findSellIn.AuditingBill(m_intDJID, txtRemarkAll.Text, out m_err))
                    {
                        MessageDialog.ShowPromptMessage("审核成功!");

                        if (m_findSellIn.GetBill("", m_intDJID).Rows[0]["DJZT_FLAG"].ToString() == "已审核")
                        {
                            m_billMessageServer.PassFlowMessage(txtSellID.Text, string.Format("【出库方式】:{0}  【库房】:{1}   ※※※ 等待【仓管】处理", cmbCKFS.Text, cmbStorage.Text),
                                                                m_billMessageServer.GetRoleStringForStorage(cmbStorage.Text).ToString(), true);
                        }
                        else
                        {
                            m_billMessageServer.PassFlowMessage(txtSellID.Text, string.Format("【出库方式】:{0}  【库房】:{1}   ※※※ 等待【会计】处理【销售清单】", cmbCKFS.Text, cmbStorage.Text),
                                                                CE_RoleEnum.会计.ToString(), true);
                        }

                        this.Close();
                    }
                    else
                    {
                        MessageDialog.ShowErrorMessage(m_err);
                        return;
                    }
                }
                else
                {
                    MessageDialog.ShowPromptMessage("请重新确认单据状态!");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowErrorMessage(ex.Message);
                return;
            }
        }
        /// <summary>
        /// 修改销售清单
        /// </summary>
        /// <param name="marketPartBill">销售清单主表信息</param>
        /// <param name="marketPritList">销售清单子表信息</param>
        /// <param name="role">操作角色</param>
        /// <param name="error">错误信息</param>
        /// <returns>修改成功返回True否则返回False</returns>
        public bool UpdateData(S_MarketingPartBill marketPartBill, List <View_S_MarketintPartList> marketPritList, string role, out string error)
        {
            error = "";

            try
            {
                DataTable dt = m_findSellIn.GetBill(marketPartBill.AssociatedBillNo, 0);

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from a in dataContxt.S_MarketingPartBill
                             where a.BillNo == marketPartBill.BillNo && a.AssociatedBillNo == marketPartBill.AssociatedBillNo
                             select a;

                error = "判断角色";

                if (result.Count() > 0)
                {
                    S_MarketingPartBill bill = result.Single();

                    switch (role)
                    {
                    case "销售主管":
                        bill.YX_Auditor   = marketPartBill.YX_Auditor;
                        bill.YX_AuditTime = marketPartBill.YX_AuditTime;
                        bill.Status       = marketPartBill.Status;

                        SystemLog_MarketPart YXAuditorlog = new SystemLog_MarketPart();

                        YXAuditorlog.BillNo  = marketPartBill.BillNo;
                        YXAuditorlog.Content = marketPartBill.YX_AuditTime + "销售主管【"
                                               + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.YX_Auditor).Name + "】审核";
                        YXAuditorlog.Recorder   = marketPartBill.YX_Auditor;
                        YXAuditorlog.RecordTime = Convert.ToDateTime(marketPartBill.YX_AuditTime);

                        dataContxt.SystemLog_MarketPart.InsertOnSubmit(YXAuditorlog);

                        if (dt != null && dt.Rows.Count > 0)
                        {
                            if (m_findSellIn.AuditingBill(Convert.ToInt32(dt.Rows[0]["ID"].ToString()), marketPartBill.Remark, out error))
                            {
                                string storage = dt.Rows[0]["storageID"].ToString();

                                m_billMessageServer.BillType = "营销出库单";
                                m_billMessageServer.PassFlowMessage(marketPartBill.AssociatedBillNo,
                                                                    string.Format("{0} 号营销出库单,请财务审核", marketPartBill.AssociatedBillNo),
                                                                    BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.会计.ToString());

                                error = error + "/n" + "主管审核成功";
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            error = "找不到营销出库单【" + marketPartBill.AssociatedBillNo + "】";
                            return(false);
                        }

                        break;

                    case "销售":
                        bill.Recorder           = marketPartBill.Recorder;
                        bill.RecordTime         = marketPartBill.RecordTime;
                        bill.Status             = marketPartBill.Status;
                        bill.CiteTerminalClient = marketPartBill.CiteTerminalClient;
                        bill.IsCarLoad          = marketPartBill.IsCarLoad;

                        if (bill.ClientID != marketPartBill.ClientID)
                        {
                            bill.Remark = marketPartBill.Remark;

                            SystemLog_MarketPart log = new SystemLog_MarketPart();

                            log.BillNo  = marketPartBill.BillNo;
                            log.Content = marketPartBill.RecordTime + "销售人员【"
                                          + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.Recorder).Name + "】修改客户,将"
                                          + m_clientServer.GetClientName(result.Single().ClientID) + "修改为:"
                                          + m_clientServer.GetClientName(bill.ClientID) + "】";
                            log.Recorder   = marketPartBill.Recorder;
                            log.RecordTime = marketPartBill.RecordTime;

                            dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                        }
                        else
                        {
                            bill.Remark = marketPartBill.Remark;

                            SystemLog_MarketPart log = new SystemLog_MarketPart();

                            log.BillNo  = marketPartBill.BillNo;
                            log.Content = marketPartBill.RecordTime + "销售人员【"
                                          + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.Recorder).Name + "】确认";
                            log.Recorder   = marketPartBill.Recorder;
                            log.RecordTime = marketPartBill.RecordTime;

                            dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                        }

                        bill.ClientID = marketPartBill.ClientID;
                        dataContxt.SubmitChanges();

                        foreach (View_S_MarketintPartList item in marketPritList)
                        {
                            var resultList = from c in dataContxt.S_MarketintPartList
                                             where c.BillNo == item.单据号 && c.GoodsID == item.GoodsID && c.BatchNo == item.批次号
                                             select c;

                            if (resultList.Count() > 0)
                            {
                                S_MarketintPartList list = resultList.Single();

                                if (list.SellUnitPrice != item.销售单价)
                                {
                                    SystemLog_MarketPart log = new SystemLog_MarketPart();

                                    log.BillNo  = marketPartBill.BillNo;
                                    log.Content = marketPartBill.RecordTime + "销售人员【"
                                                  + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.Recorder).Name
                                                  + "】修改销售单价,将" + item.物品名称 + "销售单价" + resultList.Single().SellUnitPrice
                                                  + "修改为:" + item.销售单价 + "】";
                                    log.Recorder   = marketPartBill.Recorder;
                                    log.RecordTime = marketPartBill.RecordTime;

                                    dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                                    dataContxt.SubmitChanges();
                                }

                                list.Reamrk          = item.备注;
                                list.SellUnitPrice   = item.销售单价;
                                list.UnitPrice       = item.最低定价;
                                list.AssemblyCarCode = item.主机厂代码;
                                list.AssemblyCarName = item.主机厂物品名称;

                                dataContxt.SubmitChanges();
                            }
                        }

                        var resultMarketing = from c in dataContxt.S_MarketingBill
                                              where c.DJH == marketPartBill.AssociatedBillNo
                                              select c;

                        if (resultMarketing.Count() > 0)
                        {
                            S_MarketingBill marketing = resultMarketing.Single();

                            marketing.DJZT_FLAG = "已保存";

                            m_billMessageServer.BillType = "营销出库单";
                            m_billMessageServer.PassFlowMessage(marketPartBill.AssociatedBillNo,
                                                                string.Format("{0} 号营销出库单,请主管审核", marketPartBill.AssociatedBillNo),
                                                                BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.营销主管.ToString());
                        }
                        else
                        {
                            error = "找不到营销出库单【" + marketPartBill.AssociatedBillNo + "】";
                            return(false);
                        }

                        break;

                    case "财务":
                        bill.CW_Auditor   = marketPartBill.CW_Auditor;
                        bill.CW_AuditTime = marketPartBill.CW_AuditTime;
                        bill.Status       = marketPartBill.Status;

                        if (bill.ClientID != marketPartBill.ClientID)
                        {
                            SystemLog_MarketPart log = new SystemLog_MarketPart();

                            log.BillNo  = marketPartBill.BillNo;
                            log.Content = marketPartBill.CW_AuditTime + "财务人员【"
                                          + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.CW_Auditor).Name
                                          + "】修改客户,将" + m_clientServer.GetClientName(result.Single().ClientID)
                                          + "修改为:" + m_clientServer.GetClientName(bill.ClientID) + "】";
                            log.Recorder   = marketPartBill.CW_Auditor;
                            log.RecordTime = Convert.ToDateTime(marketPartBill.CW_AuditTime);

                            dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                        }
                        else
                        {
                            SystemLog_MarketPart log = new SystemLog_MarketPart();

                            log.BillNo  = marketPartBill.BillNo;
                            log.Content = marketPartBill.CW_AuditTime + "财务人员【"
                                          + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.CW_Auditor).Name + "】审核";
                            log.Recorder   = marketPartBill.CW_Auditor;
                            log.RecordTime = Convert.ToDateTime(marketPartBill.CW_AuditTime);

                            dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                        }

                        bill.ClientID = marketPartBill.ClientID;
                        bill.Remark   = marketPartBill.Remark;

                        foreach (View_S_MarketintPartList item in marketPritList)
                        {
                            var resultList = from c in dataContxt.S_MarketintPartList
                                             where c.BillNo == item.单据号 && c.GoodsID == item.GoodsID && c.BatchNo == item.批次号 &&
                                             c.Provider == item.供应商
                                             select c;

                            if (resultList.Count() > 0)
                            {
                                S_MarketintPartList list = resultList.Single();

                                if (list.SellUnitPrice != item.销售单价)
                                {
                                    SystemLog_MarketPart log = new SystemLog_MarketPart();

                                    log.BillNo  = marketPartBill.BillNo;
                                    log.Content = marketPartBill.CW_AuditTime + "财务人员【"
                                                  + m_personnerArchiveServer.GetPersonnelInfo(marketPartBill.CW_Auditor).Name
                                                  + "】修改销售单价,将销售单价" + resultList.Single().SellUnitPrice + "修改为:"
                                                  + item.销售单价 + "】";
                                    log.Recorder   = marketPartBill.CW_Auditor;
                                    log.RecordTime = Convert.ToDateTime(marketPartBill.CW_AuditTime);

                                    dataContxt.SystemLog_MarketPart.InsertOnSubmit(log);
                                }

                                list.Reamrk        = item.备注;
                                list.SellUnitPrice = item.销售单价;
                            }
                        }

                        if (dt != null && dt.Rows.Count > 0)
                        {
                            if (dt.Rows[0]["DJZT_FLAG"].ToString() == "等待财务审核")
                            {
                                if (m_findSellIn.RetrialBill(marketPartBill.AssociatedBillNo, marketPartBill.Remark, out error))
                                {
                                    string storage = dt.Rows[0]["storageID"].ToString();

                                    m_billMessageServer.BillType = "营销出库单";
                                    m_billMessageServer.PassFlowMessage(marketPartBill.AssociatedBillNo,
                                                                        string.Format("{0} 号营销出库单,请仓管员确认", marketPartBill.AssociatedBillNo),
                                                                        m_billMessageServer.GetRoleStringForStorage(storage).ToString(), true);
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            error = "找不到营销出库单【" + marketPartBill.AssociatedBillNo + "】";
                            return(false);
                        }

                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    error = "未找到相关单据";
                    return(false);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }