コード例 #1
0
ファイル: FStockCheck.aspx.cs プロジェクト: windygu/.net-wms
        protected void Gener_ServerClick(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            string dateStr = DateTime.Now.ToString("yyyyMMdd");

            string perfix = "TDPD" + dateStr;

            BenQGuru.eMES.Domain.Warehouse.Serialbook s = (BenQGuru.eMES.Domain.Warehouse.Serialbook)_WarehouseFacade.GetSerialbook(perfix);
            int max = 0;

            if (s == null)
            {
                max         = 1;
                s           = new BenQGuru.eMES.Domain.Warehouse.Serialbook();
                s.MAXSerial = "1";
                s.MDate     = FormatHelper.TODateInt(DateTime.Now);
                s.MTime     = FormatHelper.TOTimeInt(DateTime.Now);
                s.MUser     = GetUserCode();
                s.SNprefix  = perfix;
                _WarehouseFacade.AddSerialbook(s);
            }
            else
            {
                max = int.Parse(s.MAXSerial);
                max++;
                s           = (BenQGuru.eMES.Domain.Warehouse.Serialbook)_WarehouseFacade.GetSerialbook(perfix);
                s.MAXSerial = max.ToString();
                s.MDate     = FormatHelper.TODateInt(DateTime.Now);
                s.MTime     = FormatHelper.TOTimeInt(DateTime.Now);
                s.MUser     = GetUserCode();
                _WarehouseFacade.UpdateSerialbook(s);
            }

            txtStockCheckEdit.Text = perfix + max.ToString().PadLeft(3, '0');
        }