Esempio n. 1
0
        private VendorCodeDef convert(SupplierCodeInfo data)
        {
            VendorCodeDef item = new VendorCodeDef();
            item.ID = data.id.ToString();
            item.Vendor = data.vendor;
            item.Idex = data.idex;
            item.VendorCode = data.code;
            item.Editor = data.editor;

            if (data.cdt == DateTime.MinValue)
            {
                item.Cdt = "";
            }
            else
            {
                item.Cdt = ((System.DateTime)data.cdt).ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (data.udt == DateTime.MinValue)
            {
                item.Udt = "";
            }
            else
            {
                item.Udt = ((System.DateTime)data.udt).ToString("yyyy-MM-dd HH:mm:ss");
            }
            return item;
        }
Esempio n. 2
0
        /// <summary>
        /// 保存一条Vendor Code的记录数据(Add)
        /// </summary>
        /// <param name="obj">VendorCodeDef结构</param>
        public void AddVendorCode(VendorCodeDef obj, string SelVender)
        {
            try
            {
                IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();

                //Modify 2012/08/01,UC Update
                //若Vendor<>’AST’,若Vendor Code框中内容已经存在于SupplierCode数据表的Code栏位中,则提示用户“此Vendor Code 已經存在!”,放弃后续操作。
                IList<SupplierCodeInfo> exists =new List<SupplierCodeInfo>();
                if (SelVender != "AST")
                {
                    //若Vendor Code框中内容已经存在于SupplierCode数据表的Code栏位中,则提示用户“此Vendor Code 已經存在!”
                    exists = itemRepository.GetSupplierCodeListByCode(obj.VendorCode);
                    if (exists != null && exists.Count > 0)
                    {
                        List<string> erpara = new List<string>();
                        FisException ex;
                        ex = new FisException("DMT100", erpara);
                        throw ex;

                    }
                }
                else
                {
                    //Modify 2012/08/01,UC Update
                    //若Vendor=‘AST’,则检查PartNo是否在SupplierCode数据表的Code栏位,若存在,则提示用户“此PartNo已经存在”,放弃后续操作 
                    exists = itemRepository.GetSupplierCodeListByCode(obj.Vendor);
                    if (exists != null && exists.Count > 0)
                    {
                        List<string> erpara = new List<string>();
                        FisException ex;
                        ex = new FisException("DMT097", erpara);
                        throw ex;
                    }
                }

                //若Vendor和Priority框中内容已经同时作为某个SupplierCode记录的Vendor和Indx,则提示用户“此Vendor Code的優先級重復!”
                exists = itemRepository.GetSupplierCodeListByCode(obj.Vendor, obj.Idex);
                if (exists != null && exists.Count > 0)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT101", erpara);
                    throw ex;

                }

                SupplierCodeInfo item = new SupplierCodeInfo();
                item.vendor = obj.Vendor;
                item.code = obj.VendorCode;
                item.idex = obj.Idex;
                item.editor = obj.Editor;
                item.cdt = DateTime.Now;
                item.udt = DateTime.Now;
                itemRepository.AddSupplierCodeInfo(item);
            }
            catch (Exception)
            {
                throw;
            }
        }