Exemplo n.º 1
0
        private void onload()
        {
            string sql   = string.Empty;
            string error = string.Empty;

            if (ToolManager.CheckQueryString("Id"))
            {
                sql = string.Format(@" select mt.MaterialNumber,mt.MaterialName,mt.Description,
mk.Kind,mt.Type,mt.Brand,mt.StockSafeQty,mt.ProcurementPrice,
 (select WarehouseName from WarehouseInfo where WarehouseNumber=mt.MaterialPosition) as MaterialPosition,
 mt.MinPacking,
 mt.MinOrderQty,mt.ScrapPosition,mt.Remark
 from MarerialInfoTable mt left join MarerialKind mk on mt.Kind=mk.Id  where MaterialNumber='{0}' ", ToolManager.GetQueryString("Id"));
                Model.MarerialInfoTable materialinfotable = MarerialInfoTableManager.ConvertDataTableToModel(sql);
                this.lbMaterialNumber.InnerText   = materialinfotable.MaterialNumber;
                this.lbMaterialName.InnerText     = materialinfotable.MaterialName;
                this.lbDescription.InnerText      = materialinfotable.Description;
                this.lbKind.InnerText             = materialinfotable.Kind;
                this.lbType.InnerText             = materialinfotable.Type;
                this.lbBrand.InnerText            = materialinfotable.Brand;
                this.lbStockSafeQty.InnerText     = materialinfotable.StockSafeQty.ToString();
                this.lbProcurementPrice.InnerText = materialinfotable.ProcurementPrice.ToString();
                this.lbMaterialPosition.InnerText = materialinfotable.MaterialPosition;
                this.lbMinPacking.InnerText       = materialinfotable.MinPacking;
                this.lbMinOrderQty.InnerText      = materialinfotable.MinOrderQty;
                this.lbScrapPosition.InnerText    = materialinfotable.ScrapPosition;
                this.lbRemark.InnerText           = materialinfotable.Remark;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加原材料信息
        /// </summary>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool AddMarerialInfoTable(Model.MarerialInfoTable marerialinfotable, ref string error)
        {
            if (IsExit(marerialinfotable.MaterialNumber))
            {
                error = "已存在该编号!请重新填写编号。";
                return(false);
            }

            if (string.IsNullOrEmpty(marerialinfotable.MaterialNumber) ||
                string.IsNullOrEmpty(marerialinfotable.StockSafeQty.ToString()) ||
                string.IsNullOrEmpty(marerialinfotable.ProcurementPrice.ToString()) || string.IsNullOrEmpty(marerialinfotable.MinPacking) ||
                string.IsNullOrEmpty(marerialinfotable.MinOrderQty))
            {
                error = "原材料信息不完整!";
                return(false);
            }
            List <string> sqls = new List <string>();

            sql = string.Format(@" insert into MarerialInfoTable (MaterialNumber,MaterialName,Description,Kind,Type,Brand,StockSafeQty,
            ProcurementPrice,MaterialPosition,MinPacking,MinOrderQty,ScrapPosition,Remark,Cargo,CargoType,NumberProperties,Unit) 
           values ('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}')",
                                marerialinfotable.MaterialNumber, marerialinfotable.MaterialName, marerialinfotable.Description, marerialinfotable.Kind,
                                marerialinfotable.Type, marerialinfotable.Brand, marerialinfotable.StockSafeQty, marerialinfotable.ProcurementPrice,
                                marerialinfotable.MaterialPosition, marerialinfotable.MinPacking, marerialinfotable.MinOrderQty,
                                marerialinfotable.ScrapPosition, marerialinfotable.Remark, marerialinfotable.Cargo, marerialinfotable.CargoType, marerialinfotable.NumberProperties, marerialinfotable.Unit);
            sqls.Add(sql);
            sql = string.Format(@"insert into MaterialStock (MaterialNumber,StockQty,UpdateTime,WarehouseName)
values('{0}',{1},'{2}','ycl')", marerialinfotable.MaterialNumber, 0, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            sqls.Add(sql);
            return(SqlHelper.BatchExecuteSql(sqls, ref error));
        }