Example #1
0
        /// <summary>
        /// 生成新箱电子档案
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGenerateNewCVT_Click(object sender, EventArgs e)
        {
            if (txtRemark.Text.Trim() == "")
            {
                txtRemark.Focus();
                MessageDialog.ShowErrorMessage("说明不允许为空");
                return;
            }

            string oldProductCode = cmbOldCVTType.Text + " " + txtOldCVTNumber.Text;
            string newProductCode = cmbNewCVTType.Text + " " + txtNewCVTNumber.Text;

            if (!m_electronFileServer.IsExists(oldProductCode))
            {
                MessageDialog.ShowErrorMessage("电子档案中找不到旧箱信息,检查操作是否有误,无法继续");
                return;
            }

            if (m_electronFileServer.IsExists(newProductCode))
            {
                MessageDialog.ShowErrorMessage("电子档案中已经存在新箱信息,检查操作是否有误,无法继续");
                return;
            }

            // 检测录入的新箱箱号格式是否正确
            if (!m_productCodeServer.VerifyProductCodesInfo(
                    cmbNewCVTType.Text, txtNewCVTNumber.Text, GlobalObject.CE_BarCodeType.内部钢印码, out error))
            {
                MessageDialog.ShowErrorMessage(error);

                txtNewCVTNumber.SelectAll();
                txtNewCVTNumber.Focus();

                return;
            }

            #region 2013-09-22 夏石友

            //if (m_convertCVTServer.IsNewCVT(cmbOldCVTType.Text, txtOldCVTNumber.Text))
            //{
            //    MessageDialog.ShowErrorMessage("旧箱箱号还没有进行营销业务,不允许进行此操作");

            //    txtOldCVTNumber.SelectAll();
            //    txtOldCVTNumber.Focus();

            //    return;
            //}

            #endregion

            if (!m_convertCVTServer.IsNewCVT(cmbNewCVTType.Text, txtNewCVTNumber.Text))
            {
                MessageDialog.ShowErrorMessage("新箱号已经被使用过,不允许再进行此操作");

                txtNewCVTNumber.SelectAll();
                txtNewCVTNumber.Focus();

                return;
            }

            if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查旧箱信息, cmbOldCVTType.Text, txtOldCVTNumber.Text))
            {
                MessageDialog.ShowErrorMessage("旧箱号已经变更过,不允许再进行此操作");

                txtOldCVTNumber.SelectAll();
                txtOldCVTNumber.Focus();

                return;
            }

            if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查新旧箱信息, cmbNewCVTType.Text, txtNewCVTNumber.Text))
            {
                MessageDialog.ShowErrorMessage("新箱号已经变更过,不允许再进行此操作");

                txtNewCVTNumber.SelectAll();
                txtNewCVTNumber.Focus();

                return;
            }

            if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查新箱档案信息, cmbNewCVTType.Text, txtNewCVTNumber.Text))
            {
                MessageDialog.ShowErrorMessage("新箱号电子档案中已经存在,不允许再进行此操作");

                txtNewCVTNumber.SelectAll();
                txtNewCVTNumber.Focus();

                return;
            }

            if (!ServerModuleFactory.GetServerModule <IPrintProductBarcodeInfo>().IsExists(newProductCode))
            {
                MessageDialog.ShowErrorMessage("新箱号还未分配,不允许进行此操作");

                txtNewCVTNumber.SelectAll();
                txtNewCVTNumber.Focus();

                return;
            }

            ZPX_ConvertedCVTNumber data = new ZPX_ConvertedCVTNumber();

            data.OldProductType   = cmbOldCVTType.Text;
            data.OldProductNumber = txtOldCVTNumber.Text;
            data.NewProductType   = cmbNewCVTType.Text;
            data.NewProductNumber = txtNewCVTNumber.Text;

            data.IsZeroKilometre = chkReturnZeroDistance.Checked;
            data.UserCode        = GlobalObject.BasicInfo.LoginID;
            data.Date            = ServerTime.Time;
            data.Remark          = "单个变更:" + txtRemark.Text;

            if (!m_convertCVTServer.Add(data, out error))
            {
                MessageDialog.ShowErrorMessage(error);
            }
            else
            {
                MessageDialog.ShowPromptMessage("成功添加返修信息, 并在电子档案中生成新箱信息");

                RefreshDataGridViewOfRepairInfo();
            }
        }
Example #2
0
        /// <summary>
        /// 批量提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count == 0)
            {
                MessageDialog.ShowPromptMessage("没有数据需要提交");
                return;
            }

            txtReason.Text = txtReason.Text.Trim();

            if (txtReason.Text.Trim() == "")
            {
                MessageDialog.ShowPromptMessage("请录入变更原因后在进行此操作");
                txtReason.Focus();
                return;
            }

            // 手动模式变更的信息
            List <ZPX_ConvertedCVTNumber> lstManualMode = new List <ZPX_ConvertedCVTNumber>();

            // 自动动模式变更的信息
            List <ZPX_ConvertedCVTNumber> lstAutoMode = new List <ZPX_ConvertedCVTNumber>();

            DateTime date = ServerTime.Time;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                DataGridViewCellCollection cells = dataGridView1.Rows[i].Cells;
                string newCVTNumber = cells["新箱箱号"].Value.ToString();
                string oldCVTNumber = cells["旧箱箱号"].Value.ToString();

                #region 2013-09-18 夏石友,新箱未入库型号变更
                //if (m_convertCVTServer.IsNewCVT(cmbOldCVTType.Text, oldCVTNumber))
                //{
                //    MessageDialog.ShowErrorMessage(string.Format("旧箱箱号 {0} 还没有进行营销业务,不允许进行此操作", oldCVTNumber));
                //    dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];
                //    return;
                //}
                #endregion

                if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查旧箱信息, cmbOldCVTType.Text, oldCVTNumber))
                {
                    MessageDialog.ShowErrorMessage(string.Format("旧箱箱号 {0} 已经变更过,不允许进行此操作", oldCVTNumber));

                    dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                    return;
                }

                if (!m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查旧箱档案信息, cmbOldCVTType.Text, oldCVTNumber))
                {
                    MessageDialog.ShowErrorMessage(string.Format("电子档案中不存在旧箱箱号 {0} 的信息,不允许进行此操作", oldCVTNumber));

                    dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                    return;
                }

                if (cells["变更模式"].Value.ToString() == "手动模式")
                {
                    if (!m_convertCVTServer.IsNewCVT(cmbNewCVTType.Text, newCVTNumber))
                    {
                        MessageDialog.ShowErrorMessage(string.Format("新箱箱号 {0} 已经被使用过,不允许进行此操作", newCVTNumber));

                        dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                        return;
                    }

                    if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查新箱档案信息, cmbNewCVTType.Text, newCVTNumber))
                    {
                        MessageDialog.ShowErrorMessage("新箱号电子档案中已经存在,不允许再进行此操作");

                        dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                        return;
                    }

                    if (m_convertCVTServer.IsExists(ConvertCVTNumber_CheckEnum.检查新旧箱信息, cmbNewCVTType.Text, newCVTNumber))
                    {
                        MessageDialog.ShowErrorMessage(string.Format("新箱箱号 {0} 已经变更过,不允许进行此操作", newCVTNumber));

                        dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                        return;
                    }

                    if (!ServerModuleFactory.GetServerModule <IPrintProductBarcodeInfo>().IsExists(cmbNewCVTType.Text + " " + newCVTNumber))
                    {
                        MessageDialog.ShowErrorMessage(string.Format("新箱箱号 {0} 还未分配,手动模式时新箱箱号必须是已经打过条形码的,否则不允许进行此操作",
                                                                     newCVTNumber));

                        dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];

                        return;
                    }
                }
                else
                {
                    MessageDialog.ShowPromptMessage("当前不允许存在“自动模式”变更方式,必须手动变更,人为设置新箱箱号(可打印条形码分配箱号)");
                    return;
                }

                ZPX_ConvertedCVTNumber data = new ZPX_ConvertedCVTNumber();

                data.Date             = date;
                data.IsZeroKilometre  = chkIsNewCVT.Checked;
                data.NewProductNumber = newCVTNumber;
                data.NewProductType   = cmbNewCVTType.Text + (chkIsNewCVT.Checked ? "" : " FX");
                data.OldProductNumber = cells["旧箱箱号"].Value.ToString();
                data.OldProductType   = cmbOldCVTType.Text;
                data.UserCode         = BasicInfo.LoginID;
                data.Remark           = string.Format("批量变更:{0}", txtReason.Text);

                if (cells["变更模式"].Value.ToString() == "手动模式")
                {
                    lstManualMode.Add(data);
                }
                else
                {
                    lstAutoMode.Add(data);
                }
            }

            if (MessageDialog.ShowEnquiryMessage("变更箱号时将会为新箱号创建电子档案,复制旧箱号数据。是否继续?") == DialogResult.No)
            {
                return;
            }

            if (!m_convertCVTServer.BatchConvertCVTNumber("手动模式", lstManualMode, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            if (!m_convertCVTServer.BatchConvertCVTNumber("自动模式", lstAutoMode, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            MessageDialog.ShowPromptMessage("批量变更箱号成功");

            txtNewCVTNumber.Text = "";

            btnSave.Enabled = false;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                DataGridViewCellCollection cells = dataGridView1.Rows[i].Cells;

                if (cells["变更模式"].Value.ToString() == "自动模式")
                {
                    cells["新箱箱号"].Value  = lstAutoMode[i].NewProductNumber;
                    cells["变更模式"].Value += " 已分配箱号";

                    dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Blue;
                }
            }
        }
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow == null)
            {
                return;
            }


            View_S_MaterialReturnedInTheDepot lnqMaterialReturn = m_goodsServer.GetBillView(m_billNo);
            int intGoodsID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["物品ID"].Value);

            switch (UniversalFunction.GetGoodsType(intGoodsID, m_strStorage))
            {
            case CE_GoodsType.CVT:
            case CE_GoodsType.TCU:
                BarCodeInfo tempInfo = new BarCodeInfo();

                tempInfo.BatchNo   = dataGridView1.CurrentRow.Cells["批次号"].Value.ToString();
                tempInfo.Count     = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["退库数"].Value);
                tempInfo.GoodsCode = dataGridView1.CurrentRow.Cells["图号型号"].Value.ToString();
                tempInfo.GoodsID   = intGoodsID;
                tempInfo.GoodsName = dataGridView1.CurrentRow.Cells["物品名称"].Value.ToString();
                tempInfo.Remark    = dataGridView1.CurrentRow.Cells["备注"].Value.ToString();
                tempInfo.Spec      = dataGridView1.CurrentRow.Cells["规格"].Value.ToString();

                bool blCheck = true;

                if (m_operateMode == CE_BusinessOperateMode.查看)
                {
                    blCheck = false;
                }
                else
                {
                    if (lnqMaterialReturn.单据状态 != "等待仓管退库")
                    {
                        blCheck = false;
                    }
                }

                IMaterialReturnedInTheDepot serverBill = ServerModuleFactory.GetServerModule <IMaterialReturnedInTheDepot>();

                View_S_MaterialReturnedInTheDepot tempLnq = serverBill.GetBillView(m_billNo);

                CE_BusinessType tempType = CE_BusinessType.库房业务;

                Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                    Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();

                WS_WorkShopCode tempWSCode = serverWSBasic.GetPersonnelWorkShop(tempLnq.申请人编码);

                Dictionary <string, string> tempDic = new Dictionary <string, string>();

                tempDic.Add(m_strStorage, CE_MarketingType.领料退库.ToString());

                if (tempWSCode != null)
                {
                    tempType = CE_BusinessType.综合业务;
                    tempDic.Add(tempWSCode.WSCode, CE_SubsidiaryOperationType.领料退库.ToString());
                }

                产品编号 formCode = new 产品编号(tempInfo, tempType, m_billNo, blCheck, tempDic);

                if (m_strStorage == "05")
                {
                    if (dataGridView1.CurrentRow.Cells["返修状态"].Value == null ||
                        dataGridView1.CurrentRow.Cells["返修状态"].Value.ToString() == "")
                    {
                        MessageDialog.ShowPromptMessage("请选择产品的返修状态");
                        return;
                    }
                    else
                    {
                        formCode.BlIsRepaired = (bool)dataGridView1.CurrentRow.Cells["返修状态"].Value;
                    }
                }

                formCode.ShowDialog();
                break;

            case CE_GoodsType.工装:
                工装编号录入窗体 form = new 工装编号录入窗体(m_billNo, intGoodsID, CE_BusinessBillType.领料退库, lnqMaterialReturn.单据状态 == "等待仓管退库" ? true : false);
                form.StartPosition = FormStartPosition.CenterScreen;
                form.ShowDialog();
                break;

            case CE_GoodsType.量检具:
                量检具编号录入窗体 formLJY = new 量检具编号录入窗体(m_billNo, intGoodsID,
                                                  Convert.ToDecimal(dataGridView1.CurrentRow.Cells["退库数"].Value), CE_BusinessBillType.领料退库,
                                                  m_operateMode == CE_BusinessOperateMode.仓库核实 ? true : false);

                formLJY.ShowDialog();
                break;

            case CE_GoodsType.零件:
                break;

            case CE_GoodsType.未知物品:
                break;

            default:
                break;
            }
        }
Example #4
0
        private void btnAutoGenerate_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                MessageDialog.ShowPromptMessage("请删除此清单中的所有物品后再进行此操作!");
                return;
            }

            IOrderFormGoodsServer orderFormGoodsServer    = ServerModuleFactory.GetServerModule <IOrderFormGoodsServer>();
            IQueryable <View_B_OrderFormGoods> goodsGroup = null;

            if (!orderFormGoodsServer.GetOrderFormGoods(
                    BasicInfo.ListRoles, BasicInfo.LoginID, m_billInfo.OrderBill_ID, out goodsGroup, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            S_OrdinaryInDepotBill lnqBill          = m_serverBill.GetBill(m_billNo);
            IOrderFormInfoServer  serviceOrderForm = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
            View_B_OrderFormInfo  orderInfo        = serviceOrderForm.GetOrderFormInfo(m_billInfo.OrderBill_ID);

            foreach (var item in goodsGroup)
            {
                if (item.订货数量 == 0)
                {
                    continue;
                }

                S_OrdinaryInDepotGoodsBill goods    = new S_OrdinaryInDepotGoodsBill();
                View_F_GoodsPlanCost       planCost = GetBasicGoodsInfo(item.图号型号, item.物品名称, item.规格, 0);

                if (planCost == null)
                {
                    return;
                }

                goods.GoodsID         = planCost.序号;
                goods.Bill_ID         = m_billNo;
                goods.ProviderBatchNo = "";

                if (m_serverGoodsShelfLife.IsShelfLife(planCost.序号))
                {
                    goods.BatchNo = m_goodsServer.GetNewBatchNo();
                }
                else
                {
                    goods.BatchNo = "";
                }

                goods.Amount = item.订货数量;

                IBargainGoodsServer serviceBargainGoods = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();

                goods.UnitPrice     = serviceBargainGoods.GetGoodsUnitPrice(orderInfo.订单号, goods.GoodsID, orderInfo.供货单位);
                goods.Price         = decimal.Round(goods.UnitPrice * item.订货数量, (int)2);
                goods.AmountInWords = CalculateClass.GetTotalPrice(goods.Price);
                goods.Remark        = txtRemark.Text;

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

            btnRefresh_Click(sender, e);
        }
        private void 采购员提交单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lblBillStatus.Text != OrdinaryInDepotBillStatus.新建单据.ToString())
            {
                MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法提交");
                return;
            }

            if (!CheckSelectedRow())
            {
                return;
            }

            if (!CheckDataItem())
            {
                return;
            }

            if (!CheckUserOperation(dataGridView1.SelectedRows[0]))
            {
                return;
            }

            string billNo = txtBill_ID.Text;

            if (!m_goodsServer.IsExist(billNo))
            {
                MessageDialog.ShowPromptMessage("您还未设置物品清单,无法提交");
                return;
            }

            IPersonnelInfoServer      server = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>();
            OrdinaryInDepotBillStatus status;
            CE_RoleEnum role;

            string flowMsg = null;
            string msg     = null;


            if (txtMaterialType.Text == CE_GoodsType.工装.ToString())
            {
                msg     = "成功提交,等待工艺人员检验!";
                role    = CE_RoleEnum.未知;//工艺人员要求不看信息
                status  = OrdinaryInDepotBillStatus.等待工装验证报告;
                flowMsg = string.Format("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【工艺人员】处理",
                                        txtOrderFormNumber.Text, txtProposer.Text);
            }
            else
            {
                if (chkQualityAffirmance.Checked)
                {
                    msg     = "成功提交,等待质量验收!";
                    role    = CE_RoleEnum.检验员;
                    status  = OrdinaryInDepotBillStatus.等待质检;
                    flowMsg = string.Format("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【质检员】处理",
                                            txtOrderFormNumber.Text, txtProposer.Text);
                }
                else
                {
                    msg     = "成功提交,等待仓管入库!";
                    role    = m_billMessageServer.GetRoleStringForStorage(cmbStorage.Text);
                    status  = OrdinaryInDepotBillStatus.等待入库;
                    flowMsg = string.Format("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【仓管员】处理",
                                            txtOrderFormNumber.Text, txtProposer.Text);
                }
            }

            if (!m_billServer.SubmitNewBill(billNo, status, out m_queryResult, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            m_billMessageServer.DestroyMessage(billNo);
            SendNewFlowMessage(billNo, role, flowMsg);
            RefreshDataGridView(m_queryResult);
            PositioningRecord(billNo);

            MessageDialog.ShowPromptMessage(msg);
        }
Example #6
0
        /// <summary>
        /// 获取库存中的物品信息对话框
        /// </summary>
        /// <param name="billType">单据类型</param>
        /// <param name="showZeroStoreGoods">是否显示零库存物品</param>
        /// <returns>成功则返回获取到的对话框,失败返回null</returns>
        static public FormQueryInfo GetStoreGoodsInfoDialog(CE_BillTypeEnum billType, bool showZeroStoreGoods, string strStorageID)
        {
            IStoreServer server = ServerModuleFactory.GetServerModule <IStoreServer>();
            IQueryable <View_S_Stock> queryResult;

            System.Data.DataTable dataTable = null;

            if (!server.GetAllStore(null, true, out queryResult, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return(null);
            }

            // 仅显示状态为正常且不在隔离库中的物品
            if (billType == CE_BillTypeEnum.领料单)
            {
                List <string> listTempStockStatus = new List <string>();
                listTempStockStatus.Add("正常");

                foreach (int statusID in _lstStockStatus)
                {
                    switch (statusID)
                    {
                    case 1:
                        listTempStockStatus.Add("仅限于返修箱用");
                        break;

                    case 2:
                        listTempStockStatus.Add("样品");
                        break;

                    case 3:
                        listTempStockStatus.Add("仅限于返修箱用");
                        listTempStockStatus.Add("仅限于售后备件");
                        break;

                    case 4:
                        listTempStockStatus.Add("隔离");
                        break;

                    default:
                        break;
                    }
                }

                queryResult = from r in queryResult
                              where listTempStockStatus.Contains(r.物品状态) &&
                              r.库房代码 == strStorageID
                              select r;
            }
            else if (billType == CE_BillTypeEnum.领料退库单)
            {
                queryResult = from r in queryResult
                              where r.物品状态 != "隔离"
                              select r;
            }

            ////TCU 采购部领用委外装配 Modify by cjb on 2014.5.28
            //if (!GlobalObject.GeneralFunction.IsNullOrEmpty(prefixDepotType) && strStorageID != "03")
            //{
            //    int len = prefixDepotType.Length;
            //    queryResult = from r in queryResult where r.材料类别编码.Substring(0, len) == prefixDepotType select r;
            //}

            if (!showZeroStoreGoods)
            {
                queryResult = from r in queryResult where r.库存数量 > 0 select r;
            }

            FormQueryInfo form = null;

            if (!BasicInfo.ListRoles.Exists(r => r.Contains("库管理员")))
            {
                if (billType == CE_BillTypeEnum.领料单 && !_lstStockStatus.Contains(2) && !_lstStockStatus.Contains(4))
                {
                    var result = (from r in queryResult select r).ToList().Distinct(new StockGoodsComparer());
                    dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(result);
                }
                else
                {
                    dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(queryResult);
                }
            }
            else
            {
                dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(queryResult);
            }

            form = new FormQueryInfo(dataTable);

            if (!showZeroStoreGoods)
            {
                form.Text = form.Text + ",库存数量为0的物品不会显示在列表中。";
            }

            if (!BasicInfo.ListRoles.Exists(r => r.Contains("库管理员")))
            {
                if (billType == CE_BillTypeEnum.报废单 || billType == CE_BillTypeEnum.领料退库单)
                {
                    form.HideColumns = new string[] { "序号", "物品ID", "单位", "单位ID", "库存数量", "仓库", "货架", "层", "列", "实际单价", "实际金额" }
                }
                ;
                else if (billType == CE_BillTypeEnum.领料单)
                {
                    form.HideColumns = new string[] { "序号", "物品ID", "单位", "实际单价", "实际金额" }
                }
                ;
            }
            else
            {
                form.HideColumns = new string[] { "序号", "物品ID", "单位ID", "单位", "实际单价", "实际金额" };
            }

            return(form);
        }
Example #7
0
        /// <summary>
        /// 获取指定工位装配信息
        /// </summary>
        /// <param name="workBench">工位信息</param>
        /// <returns>返回获取到的工位信息</returns>
        public Socket_WorkBenchInfo GetWorkBenchInfo(string workBenchAndProductName)
        {
            char[]   splitChars  = { ',' };
            string[] splitString = workBenchAndProductName.Split(splitChars);
            string   workBench   = splitString[0];
            string   productName = splitString[1];

            Socket_WorkBenchInfo returnInfo = new Socket_WorkBenchInfo();

            returnInfo.WorkBench = workBench;

            if (workBench[0] == 'F')
            {
                returnInfo.WorkBenchType = WorkbenchTypeEnum.分装.ToString();
            }
            else
            {
                returnInfo.WorkBenchType = WorkbenchTypeEnum.总装.ToString();
            }

            try
            {
                //IProductInfoServer productInfoServer = ServerModuleFactory.GetServerModule<IProductInfoServer>();
                IAssemblingBom server = ServerModuleFactory.GetServerModule <IAssemblingBom>();

                // 获取指定工位所有装配信息,包含多种产品
                IQueryable <View_P_AssemblingBom> queryResult = server.GetInfoOfWorkBench(workBench);

                queryResult = from r in queryResult where r.产品名称 == productName orderby r.父总成编码 select r;

                List <string> parentNamesArray = (from r in queryResult select r.父总成名称).Distinct().ToList();

                List <string> parentNamesArray2 = (from r in queryResult where r.是否总成 == true select r.零件名称).Distinct().ToList();

                if (parentNamesArray2 != null && parentNamesArray2.Count > 0)
                {
                    foreach (var item in parentNamesArray2)
                    {
                        if (!parentNamesArray.Contains(item))
                        {
                            parentNamesArray.Add(item);
                        }
                    }
                }

                // 提取指定工位所属的分总成(哪些分总成可以在此工位上装配零件)
                List <string> parentNames = new List <string>(m_sortName);

                for (int i = 0; i < parentNames.Count; i++)
                {
                    if (!parentNamesArray.Contains(parentNames[i]))
                    {
                        parentNames.RemoveAt(i--);
                    }
                }

                returnInfo.ProductName = productName;

                #region 获取此工位父总成名称列表

                StringBuilder sb    = new StringBuilder();
                int           index = 0;

                foreach (var parentName in parentNames)
                {
                    if (index++ == 0)
                    {
                        sb.AppendFormat("{0}_{1}", parentName, m_dicVirtualPartMapping[parentName]);
                    }
                    else
                    {
                        sb.AppendFormat(",{0}_{1}", parentName, m_dicVirtualPartMapping[parentName]);
                    }
                }

                returnInfo.FZC = sb.ToString();
                sb.Remove(0, sb.Length);

                #endregion

                #region 获取此工位能够完成的分总成名称

                index = 0;

                foreach (var parentName in parentNames)
                {
                    IQueryable <View_P_AssemblingBom> childrenPart = server.GetChildrenPart(parentName);

                    // 指定产品指定父总成名称需经历的装配工位
                    List <string> parentWorkBench = (from r in childrenPart
                                                     where r.产品名称 == productName orderby r.工位
                                                     select r.工位).Distinct().ToList();

                    if (parentWorkBench.Count == 0)
                    {
                        continue;
                    }

                    if (workBench == parentWorkBench[parentWorkBench.Count - 1])
                    {
                        if (index++ == 0)
                        {
                            sb.AppendFormat("{0}", parentName);
                        }
                        else
                        {
                            sb.AppendFormat(",{0}", parentName);
                        }
                    }
                }

                returnInfo.FinishedFZC = sb.ToString();
                sb.Remove(0, sb.Length);

                #endregion

                #region 获取此工位可以装配的零件
                List <WorkbenchPartInfo> workBenchPartInfo = new List <WorkbenchPartInfo>();

                IQueryable <View_P_AssemblingBom> info = from r in queryResult where r.产品名称 == productName select r;

                foreach (var item in info)
                {
                    WorkbenchPartInfo partInfo = new WorkbenchPartInfo();

                    partInfo.ProduceName = item.产品名称;
                    partInfo.ParentName  = item.父总成名称;
                    partInfo.ParentCode  = item.父总成编码; //GetVirtualPartCode(item.父总成编码);
                    partInfo.PartCode    = item.零件编码;  //GetVirtualPartCode(item.零件编码);
                    partInfo.PartName    = item.零件名称;
                    partInfo.Spec        = item.规格;
                    partInfo.Amount      = item.装配数量;
                    workBenchPartInfo.Add(partInfo);
                }

                returnInfo.WorkBenchParts = workBenchPartInfo;
                #endregion

                if (workBench == "Z24")
                {
                    returnInfo.IsFirstWorkBenchInAssemblingLine = true;
                }
                else if (workBench == "DB")
                {
                    returnInfo.IsLastWorkBenchAssemblingLine = true;
                }

                returnInfo.OperateState = Socket_WorkBenchInfo.ReturnStateEnum.操作成功;
            }
            catch (Exception exce)
            {
                returnInfo.OperateState = Socket_WorkBenchInfo.ReturnStateEnum.获取工位初始化信息失败;
                returnInfo.ErrorInfo    = "RequestWorkBenchInfo.GetWorkBenchInfo:" + exce.Message;
            }

            return(returnInfo);
        }