Example #1
0
        private void InitItems(string pPlanCode,string pStationCode)
        {
            StationEntity ent1 = StationFactory.GetByKey(pStationCode);
            WorkunitCode = "";
            txtWorkUnit.Text = ent1.STATION_NAME;
            PlanEntity ent2 = PlanFactory.GetByKey(pPlanCode);
            OrderCode = ent2.ORDER_CODE;
 
            List<PlanStandardBOMEntity> lstBom = PlanStandardBOMFactory.GetByOrderCode(OrderCode);
            List<PlanStandardBOMEntity> lstBom1 = (from p in lstBom
                                                   where p.VIRTUAL_ITEM_CODE == "X" && p.WORKUNIT_CODE == WorkunitCode
                                                   select p).ToList<PlanStandardBOMEntity>();
            
            if (lstBom1.Count == 0)
            {
                cmbVItemCode.SelectedIndex = -1;
                cmbVItemCode.Enabled = false;
            }
            else
            {
                cmbVItemCode.Items.Clear();
                cmbVItemCode.Items.Add("总装件");
                for (int i = 0; i < lstBom1.Count; i++)
                {
                    cmbVItemCode.Items.Add(lstBom1[i].ITEM_CODE + "-" + lstBom1[i].ITEM_NAME);
                }
                cmbVItemCode.Enabled = true;
            }

        }
Example #2
0
        private string GetItemSeq(string itemCode, string virItemCode)
        {
            string item_seq = "";
            List<PlanStandardBOMEntity> p;
            List<PlanStandardBOMEntity> lst_bom= PlanStandardBOMFactory.GetByOrderCodeAndWorkUnit(OrderCode, WorkunitCode);

            if (string.IsNullOrWhiteSpace(virItemCode))
            {
                p = (from s in lst_bom where s.ITEM_CODE == itemCode && s.VIRTUAL_ITEM_CODE == null select s).ToList();
            }
            else
            {

                p = (from s in lst_bom where s.ITEM_CODE == itemCode && s.VIRTUAL_ITEM_CODE == virItemCode select s).ToList();
            }

            item_seq = (p.Count * 10 + 10).ToString("0000");

            return item_seq;
        }
Example #3
0
        private void CreateBomItem(string ItemCode,float ItemQty)
        {

            List<PlanStandardBOMEntity> lst_bom = PlanStandardBOMFactory.GetByOrderCodeAndWorkUnit(OrderCode, WorkunitCode);
            var sss = (from a in lst_bom where a.ITEM_CODE == ItemCode && a.WORKUNIT_CODE == WorkunitCode select a).ToList();
            if (sss.Count > 0)
            {
                MessageBox.Show("此物料在此工序BOM中已经存在");
                return;
            }
            PlanStandardBOMEntity ent_bom = lst_bom.First();
            ItemEntity ent_item = ItemFactory.GetByItem(CompanyCode, ItemCode);
            PlanStandardBOMEntity ent_bom1 = new PlanStandardBOMEntity
            {

                COMPANY_CODE = CompanyCode,
                CREATE_TIME = DateTime.Today,
                ITEM_CODE = ItemCode,
                ITEM_NAME = ent_item.ITEM_NAME,
                ITEM_QTY = ItemQty,
                ITEM_SEQ = GetItemSeq(ItemCode, cmbVItemCode.Text),
                PLAN_CODE = ent_bom.PLAN_CODE,
                LOCATION_CODE = ent_bom.LOCATION_CODE,
                PROCESS_CODE = ent_bom.PROCESS_CODE,
                PLINE_CODE = ent_bom.PLINE_CODE,
                VIRTUAL_ITEM_CODE = cmbVItemCode.Text.Split('-')[0],
                WORKSHOP_CODE = ent_bom.WORKSHOP_CODE,
                STORE_ID = ent_bom.STORE_ID,
                ORDER_CODE = ent_bom.ORDER_CODE,
                WORKUNIT_CODE = ent_bom.WORKUNIT_CODE,
                ITEM_UNIT = ent_item.UNIT_CODE,
                LINESIDE_STOCK_CODE = ent_bom.LINESIDE_STOCK_CODE,
                USER_CODE=LoginInfo.UserInfo.USER_CODE
            };

            DB.GetInstance().Insert(ent_bom1);
        }
Example #4
0
        private void ShowQualityList()
        {
            //根据当前站点LoginInfo.StationInfo.RMES_ID找到rel_station_location对应工位code_location
            List <LocationEntity>    Location     = new List <LocationEntity>();
            List <WorkProcessEntity> process_plan = new List <WorkProcessEntity>(); //站点对应的所有工序集合
            List <DetectItemEntity>  detect_item  = new List <DetectItemEntity>();  //工序对应的检验条目集合

            Location = LocationFactory.GetByStationCode(LoginInfo.StationInfo.RMES_ID);
            if (Location == null)
            {
                return;
            }
            else
            {
                if (_product == null)
                {
                    return;
                }

                //根据站点对应的工位从bom表中取出每个工位对应的工序以及质量检验标准
                for (int i = 0; i < Location.Count; i++)
                {
                    //每个工位对应的工序集合
                    List <WorkProcessEntity> Q = PlanStandardBOMFactory.GetByLocationCode(LoginInfo.StationInfo.COMPANY_CODE, _product.PLAN_CODE, LoginInfo.StationInfo.PLINE_CODE, Location[i].LOCATION_CODE);
                    process_plan.AddRange(Q);
                }
            }

            //根据工序process_plan从bom导出的data_detect_item中获取检测项目
            if (process_plan == null)
            {
                return;
            }
            else
            {
                //存每个工序对应的质检项目data_detect_item
                for (int i = 0; i < process_plan.Count; i++)
                {
                    List <DetectItemEntity> Q = DetectItemFactory.GetByPlanProcessCode(LoginInfo.StationInfo.COMPANY_CODE, _product.PLAN_CODE, process_plan[i].PROCESS_CODE);
                    detect_item.AddRange(Q);
                }
            }
            //每个工序的检测项目detect_item
            GridQuality.DataSource = detect_item;
            //关联data_sn_quality  取工序最新状态
            for (int i = 0; i < detect_item.Count; i++)
            {
                QualitySnItem S = QualityFactory.GetProductInfoByBatchProcessPlan(_product.SN, detect_item[i].LTXA1, _product.PLAN_CODE);
                if (S == null)
                {
                }
                else
                {
                    if (S.CurrentResult != "")
                    {
                        GridQuality.Rows[i].Cells["coldx"].Value = S.CurrentResult;
                    }
                    if (S.CurrentValue != "")
                    {
                        GridQuality.Rows[i].Cells["colCurrentValue"].Value = S.CurrentValue;
                    }
                    GridQuality.Rows[i].DefaultCellStyle.BackColor = Color.Green;
                }
                //if (!string.IsNullOrWhiteSpace(detect_item[i].QUALITAT as string))
                //{
                //    GridQuality.Rows[i].Cells["coldx"].Value = detect_item[i].QUALITAT;
                //}
            }
            for (int j = 0; j < GridQuality.Rows.Count; j++)
            {
                GridQuality.Rows[j].Height = 30;
                //根据值改变grid每行属性
                //if (!string.IsNullOrWhiteSpace(GridQuality.Rows[j].Cells["colRmesId"].Value as string))
                //{
                //    GridQuality.Rows[j].ReadOnly = true;
                //    GridQuality.Rows[j].DefaultCellStyle.BackColor = Color.LightGray;
                //}
            }
        }