Example #1
0
        //获得箱的相关信息
        public void GetData(string cartonNo)
        {
            CARTONINFO objCartonInfo = m_PackageFacade.GetCARTONINFO(cartonNo) as CARTONINFO;

            if (objCartonInfo != null)
            {
                this.m_CartonCollection           = new CartonCollection();
                this.m_CartonCollection.CAPACITY  = objCartonInfo.CAPACITY;
                this.m_CartonCollection.COLLECTED = objCartonInfo.COLLECTED;

                object[] objs = m_PackageFacade.GetCarton2LotByCartonNO(cartonNo);
                if (objs != null)
                {
                    this.m_Carton2Lot = new Carton2Lot[objs.Length];
                    for (int i = 0; i < objs.Length; i++)
                    {
                        this.m_Carton2Lot[i] = (Carton2Lot)objs[i];
                    }
                }
                if (this.m_Carton2Lot != null)
                {
                    this.m_CartonCollection.MOCode = this.m_Carton2Lot[0].MOCode;
                    object obj = m_PackageFacade.GetItemCodeByMOCode(this.m_Carton2Lot[0].MOCode);
                    if (obj != null)
                    {
                        this.m_CartonCollection.ItemCode        = ((CartonCollection)obj).ItemCode;
                        this.m_CartonCollection.ItemDescription = ((CartonCollection)obj).ItemDescription;
                        Item2LotCheck item2LotCheck = (Item2LotCheck)m_ItemLotFacade.GetItem2LotCheck(((CartonCollection)obj).ItemCode);
                        if (item2LotCheck != null)
                        {
                            //if (item2LotCheck.SNLength > 0)
                            //{
                            //    chkLotCodeLen.Checked = true;
                            //    chkLotCodeLen.Value = item2LotCheck.SNLength.ToString();
                            //}

                            //if (!string.IsNullOrEmpty(item2LotCheck.SNPrefix))
                            //{
                            //    chkLotCodeFChar.Checked = true;
                            //    chkLotCodeFChar.Value = item2LotCheck.SNPrefix;
                            //}
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 点击编辑按钮后获取与当前行的记录对应的实体,删除时也会调用
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        protected override object GetEditObject(GridRecord row)
        {
            if (m_ItemLotFacade == null)
            {
                m_ItemLotFacade = new ItemLotFacade(this.DataProvider);
            }
            string strCode = string.Empty;
            object objCode = row.Items.FindItemByKey("ItemCode").Value;

            if (objCode != null)
            {
                strCode = objCode.ToString();
            }
            //避免使用row.Cells[1],应使用row.Cells.FromKey("ItemCode")
            object obj = m_ItemLotFacade.GetItem2LotCheck(strCode);

            if (obj != null)
            {
                return((Item2LotCheck)obj);
            }

            return(null);
        }