Exemplo n.º 1
0
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            ///仓库名称②不允许重复
            string warehouseName = CommonBLL.GetFieldValue(fields, "WAREHOUSE_NAME");

            if (string.IsNullOrEmpty(warehouseName))
            {
                throw new Exception("MC:0x00000721");///仓库名称不允许为空
            }
            int cnt = dal.GetCounts("[ID] <> " + id + " and [WAREHOUSE_NAME] = N'" + warehouseName + "'");

            if (cnt > 0)
            {
                throw new Exception("MC:0x00000160");///仓库名称重复
            }
            ///如选定仓库类型为外部仓库VMI时,新增或更新供应商信息中的储运供应商
            string        warehouse     = CommonBLL.GetFieldValue(fields, "WAREHOUSE");
            string        modifyUser    = CommonBLL.GetFieldValue(fields, "MODIFY_USER");
            string        warehouseType = CommonBLL.GetFieldValue(fields, "WAREHOUSE_TYPE");
            WarehouseInfo warehouseInfo = new WarehouseInfo();

            warehouseInfo.Warehouse     = warehouse;
            warehouseInfo.WarehouseName = warehouseName;
            int intWarehouseType = 0;

            int.TryParse(warehouseType, out intWarehouseType);

            warehouseInfo.WarehouseType = intWarehouseType;
            new SupplierBLL().SyncSupplierByWarehouse(warehouseInfo, modifyUser);
            ///
            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }