Exemplo n.º 1
0
        /// <summary>
        /// 界面初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 营销出库明细单_Load(object sender, EventArgs e)
        {
            DataTable dt = m_findSellIn.GetBill(m_strDJH, m_intDJID);

            m_drZdCK = dt.NewRow();

            if (m_intDJID != 0)
            {
                m_strDJZTFlag = dt.Rows[0]["DJZT_Flag"].ToString();

                View_HR_Personnel lnqPersonnel = m_findPersonnel.GetPersonnelInfo(dt.Rows[0]["LRRY"].ToString());

                lbUserName.Text   = lnqPersonnel.姓名.ToString();
                lbUserName.Tag    = lnqPersonnel.工号.ToString();
                lbKS.Text         = lnqPersonnel.部门名称.ToString();
                lbKS.Tag          = lnqPersonnel.部门编码.ToString();
                m_dtMxCK          = m_findSellIn.GetList(m_intDJID);
                tbsClient.Tag     = dt.Rows[0]["ObjectDept"].ToString();
                txtSellID.Text    = dt.Rows[0]["DJH"].ToString();
                tbsClient.Text    = m_findClientServer.GetClientName(dt.Rows[0]["ObjectDept"].ToString());
                cmbCKFS.Text      = dt.Rows[0]["YWFS"].ToString();
                txtRemarkAll.Text = dt.Rows[0]["Remark"].ToString();

                cmbStorage.Text = UniversalFunction.GetStorageName(dt.Rows[0]["StorageID"].ToString());
            }
            else
            {
                m_strDJZTFlag   = "已保存";
                lbUserName.Text = BasicInfo.LoginName;
                lbUserName.Tag  = BasicInfo.LoginID;
                lbKS.Text       = BasicInfo.DeptName;
                lbKS.Tag        = BasicInfo.DeptCode;

                txtSellID.Text = m_billNoControl.GetNewBillNo();

                CreateDateTableStyle();
            }

            if (m_strDJZTFlag != "已保存" && m_strDJZTFlag != "")
            {
                cmbCKFS.Enabled    = false;
                tbsClient.Enabled  = false;
                cmbStorage.Enabled = false;

                if (UniversalFunction.CheckStorageAndPersonnel(dt.Rows[0]["StorageID"].ToString()) == false)
                {
                    btnAffirm.Visible = false;
                }
            }

            dgv_Main.DataSource = m_dtMxCK;
            m_strDJH            = txtSellID.Text.Trim();
            dgv_Main.Columns["SellUnitPrice"].Visible = false;
            dgv_Main.Columns["UnitPrice"].Visible     = false;
            dgv_Main.Columns["Price"].Visible         = false;
        }
        private void btnOutput_Click(object sender, EventArgs e)
        {
            //UpdateProductCode(txtProductCode.Text);
            DataRow   drMessage;
            DataTable dtBill = m_findSellIn.GetBill(m_strBillID, 0);

            if (dtBill == null || dtBill.Rows.Count == 0)
            {
                drMessage = null;
            }
            else
            {
                drMessage = m_findSellIn.GetBill(m_strBillID, 0).Rows[0];
            }

            string strDate = drMessage == null?ServerTime.Time.ToString()
                                 : drMessage["Date"].ToString();

            string strYwType = drMessage == null ? ""
                : drMessage["YWFS"].ToString();

            DataTable dtNew = new DataTable();
            DataTable dt    = (DataTable)dataGridView1.DataSource;

            dtNew.Columns.Add("序号");
            dtNew.Columns.Add("产品型号");
            dtNew.Columns.Add("入库日期");
            dtNew.Columns.Add("产品编号");
            dtNew.Columns.Add("产品状态");
            dtNew.Columns.Add("产品说明");
            dtNew.Columns.Add("退库状态");
            dtNew.Columns.Add("箱子编号");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dtNew.NewRow();

                dr["序号"]   = dt.Rows[i]["Number"].ToString();
                dr["产品型号"] = txtGoodsCode.Text.Trim().ToString();
                dr["入库日期"] = strDate;
                dr["产品编号"] = dt.Rows[i]["ProductCode"].ToString();
                dr["产品状态"] = m_dicMarkInfo.First().Value.ToString();
                dr["产品说明"] = "【" + strYwType + "】  " + m_barCodeInfo.Remark;
                dr["退库状态"] = "";
                dr["箱子编号"] = dt.Rows[i]["BoxNo"].ToString();
                dtNew.Rows.Add(dr);
            }

            ExcelHelperP.DataTableToExcel(saveFileDialog1, dtNew, null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 从营销出库单导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadDataFromOutboundOrder_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }

            FormQueryInfo dialog = QueryInfoDialog.GetOutboundBillDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string billNo = dialog.GetStringDataItem("单据号");

                if (MessageDialog.ShowEnquiryMessage("您确定要导入 " + billNo
                                                     + " 营销出库单的信息吗?此过程需要一段时间,是否继续?") == DialogResult.No)
                {
                    return;
                }

                // 营销出库单服务
                ISellIn billServer = ServerModuleFactory.GetServerModule <ISellIn>();

                DataTable bill = billServer.GetBill(billNo, 0);

                string storageID = bill.Rows[0]["StorageID"].ToString();

                DataTable list = billServer.GetList((int)bill.Rows[0]["ID"]);

                if (list.Rows.Count > 0)
                {
                    List <StorageGoods> lstGoods = new List <StorageGoods>(list.Rows.Count);

                    for (int i = 0; i < list.Rows.Count; i++)
                    {
                        StorageGoods goods = new StorageGoods();

                        goods.GoodsCode = list.Rows[i]["GoodsCode"].ToString();
                        goods.GoodsName = list.Rows[i]["GoodsName"].ToString();
                        goods.Spec      = list.Rows[i]["Spec"].ToString();
                        goods.Provider  = list.Rows[i]["Provider"].ToString();
                        goods.BatchNo   = list.Rows[i]["BatchNo"].ToString();
                        goods.Quantity  = (decimal)list.Rows[i]["Count"];
                        goods.StorageID = storageID;

                        lstGoods.Add(goods);
                    }

                    if (是否一次性物品.Checked && GlobalObject.GeneralFunction.IsNullOrEmpty(m_productNumber))
                    {
                        m_productNumber = cmbProductCode.Text;
                    }

                    if (!m_mbpServer.AddFromBill(BasicInfo.LoginID, Convert.ToInt32(
                                                     cmbPurpose.SelectedValue), m_productNumber, billNo, lstGoods, out m_error))
                    {
                        MessageDialog.ShowErrorMessage(m_error);
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("操作成功");

                        SearchData(0);
                    }
                }
            }
        }
        /// <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);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 界面初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 营销入库明细单_Load(object sender, EventArgs e)
        {
            DataTable dt = m_findSellIn.GetBill(m_strDJH, m_intDJID);

            m_drZdRK = dt.NewRow();

            if (m_intDJID != 0)
            {
                View_HR_Personnel lnqPersonnel = m_findPersonnel.GetPersonnelInfo(dt.Rows[0]["LRRY"].ToString());

                m_strDJZTFlag   = dt.Rows[0]["DJZT_Flag"].ToString();
                lbUserName.Text = lnqPersonnel.姓名.ToString();
                lbUserName.Tag  = lnqPersonnel.工号.ToString();
                lbKS.Text       = lnqPersonnel.部门名称.ToString();
                lbKS.Tag        = lnqPersonnel.部门编码.ToString();
                m_dtMxRK        = m_findSellIn.GetList(m_intDJID);
                tbsDept.Tag     = dt.Rows[0]["ObjectDept"].ToString();
                txtSellID.Text  = dt.Rows[0]["DJH"].ToString();

                View_Department linVdepartment = m_findDepartmentServer.GetDepartments(dt.Rows[0]["ObjectDept"].ToString());

                tbsDept.Text      = linVdepartment.部门名称;
                txtPrice.Text     = dt.Rows[0]["Price"].ToString();
                txtRemarkAll.Text = dt.Rows[0]["Remark"].ToString();
                cmbRKFS.Text      = dt.Rows[0]["YWFS"].ToString();
                cmbStorage.Text   = UniversalFunction.GetStorageName(dt.Rows[0]["StorageID"].ToString());
                m_lnqWSCode       = m_serverWSBasic.GetWorkShopCodeInfo(tbsDept.Tag.ToString());
            }
            else
            {
                m_strDJZTFlag   = "已保存";
                lbUserName.Text = BasicInfo.LoginName;
                lbUserName.Tag  = BasicInfo.LoginID;
                lbKS.Text       = BasicInfo.DeptName;
                lbKS.Tag        = BasicInfo.DeptCode;

                WS_WorkShopCode tempWorkCodeInfo = m_serverWSBasic.GetPersonnelWorkShop(BasicInfo.LoginID);

                if (tempWorkCodeInfo != null)
                {
                    tbsDept.Text = tempWorkCodeInfo.WSName;
                    tbsDept.Tag  = tempWorkCodeInfo.DeptCode;
                }

                txtSellID.Text = m_billNoControl.GetNewBillNo();

                CreateDateTableStyle();
            }

            if (!Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块]))
            {
                txtBatchNo.Enabled = false;
            }

            if (m_strDJZTFlag != "已保存" && m_strDJZTFlag != "")
            {
                cmbRKFS.Enabled    = false;
                tbsDept.Enabled    = false;
                cmbStorage.Enabled = false;

                if (UniversalFunction.CheckStorageAndPersonnel(dt.Rows[0]["StorageID"].ToString()) == false)
                {
                    btnAffirm.Visible = false;
                }
            }

            OperationbtnCheckIsVisible(m_dtMxRK);

            //DataRow drDept = m_serverDepartment.GetPersonnelAffiliatedTopFunction(lbUserName.Text).Rows[0];

            //tbsDept.Enabled = false;
            //tbsDept.Text = drDept["DepartmentName"].ToString();
            //tbsDept.Tag = drDept["DepartmentCode"].ToString();
            dgv_Main.DataSource = m_dtMxRK;

            m_strDJH = txtSellID.Text.Trim();
        }
        /// <summary>
        /// 界面初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 营销退货明细单_Load(object sender, EventArgs e)
        {
            DataTable dt = m_findSellIn.GetBill(m_strDJH, m_intDJID);

            m_drZdRK = dt.NewRow();

            if (m_intDJID != 0)
            {
                m_strDJZTFlag = dt.Rows[0]["DJZT_Flag"].ToString();

                View_HR_Personnel lnqPersonnel = m_findPersonnel.GetPersonnelInfo(dt.Rows[0]["LRRY"].ToString());

                lbUserName.Text = lnqPersonnel.姓名.ToString();
                lbUserName.Tag  = lnqPersonnel.工号.ToString();
                lbKS.Text       = lnqPersonnel.部门名称.ToString();
                lbKS.Tag        = lnqPersonnel.部门编码.ToString();
                m_dtMxRK        = m_findSellIn.GetList(m_intDJID);
                tbsDept.Tag     = dt.Rows[0]["ObjectDept"].ToString();

                View_Department linVdepartment = m_findDepartmentServer.GetDepartments(dt.Rows[0]["ObjectDept"].ToString());

                tbsDept.Text      = linVdepartment.部门名称;
                txtSellID.Text    = dt.Rows[0]["DJH"].ToString();
                txtPrice.Text     = dt.Rows[0]["Price"].ToString();
                cmbTHFS.Text      = dt.Rows[0]["YWFS"].ToString();
                txtRemarkAll.Text = dt.Rows[0]["Remark"].ToString();
                cmbStorage.Text   = UniversalFunction.GetStorageName(dt.Rows[0]["StorageID"].ToString());
            }
            else
            {
                m_strDJZTFlag   = "已保存";
                lbUserName.Text = BasicInfo.LoginName;
                lbUserName.Tag  = BasicInfo.LoginID;
                lbKS.Text       = BasicInfo.DeptName;
                lbKS.Tag        = BasicInfo.DeptCode;
                txtSellID.Text  = m_billNoControl.GetNewBillNo();

                CreateDateTableStyle();
            }

            if (m_strDJZTFlag != "已保存" && m_strDJZTFlag != "")
            {
                cmbTHFS.Enabled    = false;
                tbsDept.Enabled    = false;
                cmbStorage.Enabled = false;
            }

            dgv_Main.DataSource = m_dtMxRK;
            m_strDJH            = txtSellID.Text.Trim();


            if (cmbStorage.Text == "售后库房")
            {
                label11.Visible         = true;
                cmbRepairStatus.Visible = true;
                dgv_Main.Columns["RepairStatus"].Visible = true;
            }
            else
            {
                label11.Visible         = false;
                cmbRepairStatus.Visible = false;
                dgv_Main.Columns["RepairStatus"].Visible = false;
            }
        }